Bug 1394935: Return the document as the flattened tree parent of doc-level NAC. r?bholley
MozReview-Commit-ID: 1m3BBU14MNe
--- 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.