mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
Bug 1409975 - Implement node distribution for shadow tree slots
* Implementation for assignedNodes * Include slots in the flat tree * Fix event get-the-parent algorithm for a node * Update and add reftests for Shadow DOM v1 * Update web platform tests expectations Tag #1375
This commit is contained in:
parent
a7ba34c672
commit
cab78760e5
49 changed files with 775 additions and 429 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue