diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:41:00 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:41:00 -0400 |
commit | ed7faf3fde0000b139414648269d2ff82846bac1 (patch) | |
tree | ad0bf172f0f3332bf42f09f7644f568924f48a3b /dom/base/ShadowRoot.h | |
parent | 3758434680616e91edf696e546fe3cc3b1d4da9c (diff) | |
download | UXP-ed7faf3fde0000b139414648269d2ff82846bac1.tar UXP-ed7faf3fde0000b139414648269d2ff82846bac1.tar.gz UXP-ed7faf3fde0000b139414648269d2ff82846bac1.tar.lz UXP-ed7faf3fde0000b139414648269d2ff82846bac1.tar.xz UXP-ed7faf3fde0000b139414648269d2ff82846bac1.zip |
Bug 1404789 - Stop reconstructing frames for the whole shadow root each time content is inserted in a shadow tree
* Cleanup a bit the ShadowRoot code
* Privatize ShadowRoot methods
* When the shadow tree distribution changes, post a restyle + reframe
* Simplify ShadowRoot::IsPooledNode
* Be a bit better at detecting distribution changes
Tag #1375
Diffstat (limited to 'dom/base/ShadowRoot.h')
-rw-r--r-- | dom/base/ShadowRoot.h | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index 04943752b..42423c92e 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -54,23 +54,48 @@ public: StyleSheetList* StyleSheets(); /** + * Distributes all the explicit children of the pool host to the content + * insertion points in this ShadowRoot. + */ + void DistributeAllNodes(); + +private: + /** * Distributes a single explicit child of the pool host to the content * insertion points in this ShadowRoot. + * + * Returns the insertion point the element is distributed to after this call. + * + * Note that this doesn't handle distributing the node in the insertion point + * parent's shadow root. */ - void DistributeSingleNode(nsIContent* aContent); + const HTMLContentElement* DistributeSingleNode(nsIContent* aContent); /** * Removes a single explicit child of the pool host from the content * insertion points in this ShadowRoot. + * + * Returns the old insertion point, if any. + * + * Note that this doesn't handle removing the node in the returned insertion + * point parent's shadow root. */ - void RemoveDistributedNode(nsIContent* aContent); + const HTMLContentElement* RemoveDistributedNode(nsIContent* aContent); /** - * Distributes all the explicit children of the pool host to the content - * insertion points in this ShadowRoot. + * Redistributes a node of the pool, and returns whether the distribution + * changed. */ - void DistributeAllNodes(); + bool RedistributeElement(Element*); + /** + * Called when we redistribute content after insertion points have changed. + */ + void DistributionChanged(); + + bool IsPooledNode(nsIContent* aChild) const; + +public: void AddInsertionPoint(HTMLContentElement* aInsertionPoint); void RemoveInsertionPoint(HTMLContentElement* aInsertionPoint); @@ -80,8 +105,6 @@ public: JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; - static bool IsPooledNode(nsIContent* aChild, nsIContent* aContainer, - nsIContent* aHost); static ShadowRoot* FromNode(nsINode* aNode); static void RemoveDestInsertionPoint(nsIContent* aInsertionPoint, |