diff options
Diffstat (limited to 'dom/base/ShadowRoot.h')
-rw-r--r-- | dom/base/ShadowRoot.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index 5efff5be7..c525ba8e8 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -21,6 +21,9 @@ class nsIContent; class nsXBLPrototypeBinding; namespace mozilla { + +class EventChainPreVisitor; + namespace dom { class Element; @@ -73,10 +76,26 @@ public: private: /** - * Redistributes a node of the pool, and returns whether the distribution + * Try to reassign an element to a slot and returns whether the assignment * changed. */ - bool RedistributeElement(Element*); + bool MaybeReassignElement(Element* aElement, const nsAttrValue* aOldValue); + + /** + * Try to assign aContent to a slot in the shadow tree, returns the assigned + * slot if found. + */ + const HTMLSlotElement* AssignSlotFor(nsIContent* aContent); + + /** + * Unassign aContent from the assigned slot in the shadow tree, returns the + * assigned slot if found. + * + * Note: slot attribute of aContent may have changed already, so pass slot + * name explicity here. + */ + const HTMLSlotElement* UnassignSlotFor(nsIContent* aContent, + const nsAString& aSlotName); /** * Called when we redistribute content after insertion points have changed. @@ -86,6 +105,9 @@ private: bool IsPooledNode(nsIContent* aChild) const; public: + void AddSlot(HTMLSlotElement* aSlot); + void RemoveSlot(HTMLSlotElement* aSlot); + void SetInsertionPointChanged() { mInsertionPointChanged = true; } void SetAssociatedBinding(nsXBLBinding* aBinding) { mAssociatedBinding = aBinding; } @@ -113,11 +135,18 @@ public: mIsComposedDocParticipant = aIsComposedDocParticipant; } + nsresult GetEventTargetParent(EventChainPreVisitor& aVisitor) override; + protected: virtual ~ShadowRoot(); ShadowRootMode mMode; + // Map from name of slot to an array of all slots in the shadow DOM with with + // the given name. The slots are stored as a weak pointer because the elements + // are in the shadow tree and should be kept alive by its parent. + nsClassHashtable<nsStringHashKey, nsTArray<mozilla::dom::HTMLSlotElement*>> mSlotMap; + nsTHashtable<nsIdentifierMapEntry> mIdentifierMap; nsXBLPrototypeBinding* mProtoBinding; |