Bug 1408341 - Implement assignedSlot on Element and Text

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-17 06:38:37 -04:00 committed by Roy Tam
commit 6b075994f5
9 changed files with 81 additions and 9 deletions

View file

@ -15,6 +15,7 @@
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
@ -753,6 +754,20 @@ nsGenericDOMDataNode::GetExistingDestInsertionPoints() const
return nullptr;
}
HTMLSlotElement*
nsGenericDOMDataNode::GetAssignedSlot() const
{
nsDataSlots *slots = GetExistingDataSlots();
return slots ? slots->mAssignedSlot.get() : nullptr;
}
void
nsGenericDOMDataNode::SetAssignedSlot(HTMLSlotElement* aSlot)
{
nsDataSlots *slots = DataSlots();
slots->mAssignedSlot = aSlot;
}
nsXBLBinding *
nsGenericDOMDataNode::GetXBLBinding() const
{
@ -843,6 +858,9 @@ nsGenericDOMDataNode::nsDataSlots::Traverse(nsCycleCollectionTraversalCallback &
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mContainingShadow");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mContainingShadow));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAssignedSlot");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mAssignedSlot.get()));
}
void
@ -850,6 +868,7 @@ nsGenericDOMDataNode::nsDataSlots::Unlink()
{
mXBLInsertionParent = nullptr;
mContainingShadow = nullptr;
mAssignedSlot = nullptr;
}
//----------------------------------------------------------------------