summaryrefslogtreecommitdiff
path: root/dom/base/ShadowRoot.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-06-13 08:21:48 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-06-13 08:21:48 -0400
commit43725c7264ca3f63de348d1d1596ce1fe9e64d2d (patch)
treee1ff1b11cc54e63b665aab1aa3776a62ee56250d /dom/base/ShadowRoot.cpp
parent35754dd1af72abcae49edd2eeb76855d999a4e6d (diff)
downloaduxp-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar.gz
Bug 1426494 - Share more code between nsIDocument and ShadowRoot
Tag #1375
Diffstat (limited to 'dom/base/ShadowRoot.cpp')
-rw-r--r--dom/base/ShadowRoot.cpp42
1 files changed, 3 insertions, 39 deletions
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp
index d6c103e8ef..4aab9e435e 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,44 +279,13 @@ 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)
{
@@ -337,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)
{