Bug 1394935: Return the document as the flattened tree parent of doc-level NAC. r?bholley draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 31 Aug 2017 20:05:03 +0200
changeset 656810 8e79bd7132ca1524ba168f407ff0af2da1bd8ac6
parent 656699 b4ea43ebf3461ba307a3b673f3ac9261506cd2a4
child 656811 867da97dddfb756d8b811a223d8eea300908f790
push id77325
push userbmo:emilio@crisal.io
push dateThu, 31 Aug 2017 18:09:13 +0000
reviewersbholley
bugs1394935
milestone57.0a1
Bug 1394935: Return the document as the flattened tree parent of doc-level NAC. r?bholley MozReview-Commit-ID: 1m3BBU14MNe
dom/base/FragmentOrElement.cpp
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -187,31 +187,31 @@ nsIContent::GetFlattenedTreeParentNodeIn
       // generated any NAC itself.  Thus any NAC we have here must have
       // been generated by an ancestor frame.
       //
       // If we are in here, then either the root element is display:none, or
       // we are in the middle of constructing the root of the frame tree and
       // we are trying to eagerly restyle document level NAC in
       // nsCSSFrameConstructor::GetAnonymousContent before the root
       // element's frame has been constructed.
-      return nullptr;
+      return OwnerDoc();
     }
     nsIAnonymousContentCreator* creator = do_QueryFrame(parentFrame);
     if (!creator) {
       // If the root element does have a frame, but does not implement
       // nsIAnonymousContentCreator, then this must be document level NAC.
-      return nullptr;
+      return OwnerDoc();
     }
     AutoTArray<nsIContent*, 8> elements;
     creator->AppendAnonymousContentTo(elements, 0);
     if (!elements.Contains(this)) {
       // If the root element does have a frame, and also does implement
       // nsIAnonymousContentCreator, but didn't create this node, then
       // it must be document level NAC.
-      return nullptr;
+      return OwnerDoc();
     }
   }
 
   if (parent && nsContentUtils::HasDistributedChildren(parent) &&
       nsContentUtils::IsInSameAnonymousTree(parent, this)) {
     // This node is distributed to insertion points, thus we
     // need to consult the destination insertion points list to
     // figure out where this node was inserted in the flattened tree.