diff options
Diffstat (limited to 'dom/base/ShadowRoot.cpp')
-rw-r--r-- | dom/base/ShadowRoot.cpp | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index 2383c951a..c354e04c1 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -58,6 +58,7 @@ ShadowRoot::ShadowRoot(Element* aElement, bool aClosed, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, nsXBLPrototypeBinding* aProtoBinding) : DocumentFragment(aNodeInfo) + , DocumentOrShadowRoot(this) , mProtoBinding(aProtoBinding) , mInsertionPointChanged(false) , mIsComposedDocParticipant(false) @@ -240,7 +241,7 @@ ShadowRoot::InsertSheet(StyleSheet* aSheet, linkingElement->SetStyleSheet(aSheet); // This sets the ownerNode on the sheet - MOZ_DIAGNOSTIC_ASSERT(mProtoBinding->SheetCount() == StyleScope::SheetCount()); + MOZ_DIAGNOSTIC_ASSERT(mProtoBinding->SheetCount() == DocumentOrShadowRoot::SheetCount()); #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED // FIXME(emilio, bug 1425759): For now we keep them duplicated, the proto // binding will disappear soon (tm). @@ -278,49 +279,17 @@ void ShadowRoot::RemoveSheet(StyleSheet* aSheet) { mProtoBinding->RemoveStyleSheet(aSheet); - StyleScope::RemoveSheet(*aSheet); + DocumentOrShadowRoot::RemoveSheet(*aSheet); if (aSheet->IsApplicable()) { StyleSheetChanged(); } } -Element* -ShadowRoot::GetElementById(const nsAString& aElementId) -{ - nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aElementId); - return entry ? entry->GetIdElement() : nullptr; -} - -already_AddRefed<nsContentList> -ShadowRoot::GetElementsByTagName(const nsAString& aTagName) -{ - return NS_GetContentList(this, kNameSpaceID_Unknown, aTagName); -} - -already_AddRefed<nsContentList> -ShadowRoot::GetElementsByTagNameNS(const nsAString& aNamespaceURI, - const nsAString& aLocalName) -{ - int32_t nameSpaceId = kNameSpaceID_Wildcard; - - if (!aNamespaceURI.EqualsLiteral("*")) { - nsresult rv = - nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI, - nameSpaceId); - NS_ENSURE_SUCCESS(rv, nullptr); - } - - NS_ASSERTION(nameSpaceId != kNameSpaceID_Unknown, "Unexpected namespace ID!"); - - return NS_GetContentList(this, nameSpaceId, aLocalName); -} - void ShadowRoot::AddToIdTable(Element* aElement, nsIAtom* aId) { - nsIdentifierMapEntry *entry = - mIdentifierMap.PutEntry(nsDependentAtomString(aId)); + nsIdentifierMapEntry* entry = mIdentifierMap.PutEntry(aId); if (entry) { entry->AddIdElement(aElement); } @@ -329,8 +298,7 @@ ShadowRoot::AddToIdTable(Element* aElement, nsIAtom* aId) void ShadowRoot::RemoveFromIdTable(Element* aElement, nsIAtom* aId) { - nsIdentifierMapEntry *entry = - mIdentifierMap.GetEntry(nsDependentAtomString(aId)); + nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(aId); if (entry) { entry->RemoveIdElement(aElement); if (entry->IsEmpty()) { @@ -339,12 +307,6 @@ ShadowRoot::RemoveFromIdTable(Element* aElement, nsIAtom* aId) } } -already_AddRefed<nsContentList> -ShadowRoot::GetElementsByClassName(const nsAString& aClasses) -{ - return nsContentUtils::GetElementsByClassName(this, aClasses); -} - nsresult ShadowRoot::GetEventTargetParent(EventChainPreVisitor& aVisitor) { @@ -499,6 +461,12 @@ ShadowRoot::DistributeAllNodes() DistributionChanged(); } +Element* +ShadowRoot::GetActiveElement() +{ + return GetRetargetedFocusedElement(); +} + void ShadowRoot::GetInnerHTML(nsAString& aInnerHTML) { |