diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:21:48 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:21:48 -0400 |
commit | 43725c7264ca3f63de348d1d1596ce1fe9e64d2d (patch) | |
tree | e1ff1b11cc54e63b665aab1aa3776a62ee56250d /dom/xul | |
parent | 35754dd1af72abcae49edd2eeb76855d999a4e6d (diff) | |
download | UXP-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar UXP-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar.gz UXP-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar.lz UXP-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar.xz UXP-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.zip |
Bug 1426494 - Share more code between nsIDocument and ShadowRoot
Tag #1375
Diffstat (limited to 'dom/xul')
-rw-r--r-- | dom/xul/XULDocument.cpp | 19 | ||||
-rw-r--r-- | dom/xul/XULDocument.h | 5 |
2 files changed, 7 insertions, 17 deletions
diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 929efc1af..d3b94920a 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -1578,24 +1578,13 @@ XULDocument::GetCommandDispatcher(nsIDOMXULCommandDispatcher** aTracker) } Element* -XULDocument::GetElementById(const nsAString& aId) +XULDocument::GetRefById(const nsAString& aID) { - if (!CheckGetElementByIdArg(aId)) - return nullptr; - - nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aId); - if (entry) { - Element* element = entry->GetIdElement(); - if (element) - return element; - } - - nsRefMapEntry* refEntry = mRefMap.GetEntry(aId); - if (refEntry) { - NS_ASSERTION(refEntry->GetFirstElement(), - "nsRefMapEntries should have nonempty content lists"); + if (nsRefMapEntry* refEntry = mRefMap.GetEntry(aID)) { + MOZ_ASSERT(refEntry->GetFirstElement()); return refEntry->GetFirstElement(); } + return nullptr; } diff --git a/dom/xul/XULDocument.h b/dom/xul/XULDocument.h index 06abb797f..a5ed49704 100644 --- a/dom/xul/XULDocument.h +++ b/dom/xul/XULDocument.h @@ -148,6 +148,7 @@ public: using nsDocument::CreateElementNS; NS_FORWARD_NSIDOMDOCUMENT(XMLDocument::) // And explicitly import the things from nsDocument that we just shadowed + using mozilla::dom::DocumentOrShadowRoot::GetElementById; using nsDocument::GetImplementation; using nsDocument::GetTitle; using nsDocument::SetTitle; @@ -156,8 +157,8 @@ public: using nsDocument::GetMozFullScreenElement; using nsIDocument::GetLocation; - // nsDocument interface overrides - virtual Element* GetElementById(const nsAString & elementId) override; + // Helper for StyleScope::GetElementById. + Element* GetRefById(const nsAString & elementId); // nsIDOMXULDocument interface NS_DECL_NSIDOMXULDOCUMENT |