Bug 1596768 - Remove GetBindingParent usage in RangeUtils. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 15 Nov 2019 15:32:14 +0000
changeset 502211 bc106b1c9d292c8c8aa72415e18610a1e4a4ef9f
parent 502210 3b5c6aaf5a182cb13691f0917af88da2a0f4df8e
child 502212 ec8cad6891215a6db48cf2bc927ef6c77838035f
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1596768
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596768 - Remove GetBindingParent usage in RangeUtils. r=smaug Shadow DOM is handled above. Differential Revision: https://phabricator.services.mozilla.com/D53193
dom/base/RangeUtils.cpp
--- a/dom/base/RangeUtils.cpp
+++ b/dom/base/RangeUtils.cpp
@@ -32,23 +32,25 @@ nsINode* RangeUtils::ComputeRootNode(nsI
   if (aNode->IsContent()) {
     if (aNode->NodeInfo()->NameAtom() == nsGkAtoms::documentTypeNodeName) {
       return nullptr;
     }
 
     nsIContent* content = aNode->AsContent();
 
     // If the node is in a shadow tree then the ShadowRoot is the root.
+    //
+    // FIXME(emilio): Should this be after the NAC check below? We can have NAC
+    // inside Shadow DOM which will peek this path rather than the one below.
     if (ShadowRoot* containingShadow = content->GetContainingShadow()) {
       return containingShadow;
     }
 
-    // If the node has a binding parent, that should be the root.
-    // XXXbz maybe only for native anonymous content?
-    if (nsINode* root = content->GetBindingParent()) {
+    // If the node is in NAC, then the NAC parent should be the root.
+    if (nsINode* root = content->GetClosestNativeAnonymousSubtreeRootParent()) {
       return root;
     }
   }
 
   // Elements etc. must be in document or in document fragment,
   // text nodes in document, in document fragment or in attribute.
   if (nsINode* root = aNode->GetUncomposedDoc()) {
     return root;