diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-04 19:47:42 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:17 -0500 |
commit | a2c7b5f1d971cd529e65179ad97d39750e956644 (patch) | |
tree | b9f2a279ba276dd4700f86075815d921d3b68df9 /dom/base/CustomElementRegistry.h | |
parent | 9d51b9d06a16b4725e4540a6424c71f6a1ee94c3 (diff) | |
download | uxp-a2c7b5f1d971cd529e65179ad97d39750e956644.tar.gz |
Bug 1325279 - Put the reaction queue in CustomElementData structure instead of using a map;
Bug 1347446 makes accessing ElementReactionQueue becomes a bit non-trival (have to get it via DocGroup). Since bug 1359346 already refactors the creation time of CustomElementData, ReactionQueue can also be put into CustomElementData, then we can just get ReactionQueue from Element.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/CustomElementRegistry.h')
-rw-r--r-- | dom/base/CustomElementRegistry.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 6184c0ac3f..cb7bd67a57 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -25,6 +25,7 @@ struct CustomElementData; struct ElementDefinitionOptions; struct LifecycleCallbacks; class CallbackFunction; +class CustomElementReaction; class Function; class Promise; @@ -102,6 +103,13 @@ struct CustomElementData int32_t mAssociatedMicroTask; // Custom element state as described in the custom element spec. State mState; + // custom element reaction queue as described in the custom element spec. + // There is 1 reaction in reaction queue, when 1) it becomes disconnected, + // 2) it’s adopted into a new document, 3) its attributes are changed, + // appended, removed, or replaced. + // There are 3 reactions in reaction queue when doing upgrade operation, + // e.g., create an element, insert a node. + AutoTArray<nsAutoPtr<CustomElementReaction>, 3> mReactionQueue; // Empties the callback queue. void RunCallbackQueue(); @@ -190,7 +198,7 @@ public: } // nsWeakPtr is a weak pointer of Element - // The element reaction queues are stored in ElementReactionQueueMap. + // The element reaction queues are stored in CustomElementData. // We need to lookup ElementReactionQueueMap again to get relevant reaction queue. // The choice of 1 for the auto size here is based on gut feeling. typedef AutoTArray<nsWeakPtr, 1> ElementQueue; @@ -215,17 +223,6 @@ public: private: ~CustomElementReactionsStack() {}; - // There is 1 reaction in reaction queue, when 1) it becomes disconnected, - // 2) it’s adopted into a new document, 3) its attributes are changed, - // appended, removed, or replaced. - // There are 3 reactions in reaction queue when doing upgrade operation, - // e.g., create an element, insert a node. - typedef AutoTArray<nsAutoPtr<CustomElementReaction>, 3> ReactionQueue; - typedef nsClassHashtable<nsISupportsHashKey, ReactionQueue> - ElementReactionQueueMap; - - ElementReactionQueueMap mElementReactionQueueMap; - // The choice of 8 for the auto size here is based on gut feeling. AutoTArray<ElementQueue, 8> mReactionsStack; ElementQueue mBackupQueue; |