Backed out changeset e6663f10c42b (bug 1404316) for crashing in devtools/server/tests/browser/browser_canvasframe_helper_04.js on Windows 7 debug with non-e10s builds. r=backout

This commit is contained in:
Sebastian Hengst 2017-10-01 10:08:17 +02:00
Родитель eb2c50f444
Коммит 5afa7795ae
1 изменённых файлов: 31 добавлений и 25 удалений

Просмотреть файл

@ -164,13 +164,6 @@ nsIContent::GetFlattenedTreeParentNodeInternal(FlattenedParentType aType) const
}
nsIContent* parent = parentNode->AsContent();
// When getting the flattened tree parent for style, we return null
// for any "document level" native anonymous content subtree root.
// This is NAC generated by an ancestor frame of the document element's
// primary frame, and includes scrollbar elements created by the root
// scroll frame, and the "custom content container" and accessible caret
// generated by the nsCanvasFrame. We distinguish document level NAC
// from NAC generated by the root element's primary frame below.
if (aType == eForStyle &&
IsRootOfNativeAnonymousSubtree() &&
OwnerDoc()->GetRootElement() == parent) {
@ -181,25 +174,38 @@ nsIContent::GetFlattenedTreeParentNodeInternal(FlattenedParentType aType) const
return parent;
}
AutoTArray<nsIContent*, 8> rootElementNAC;
nsContentUtils::AppendNativeAnonymousChildren(
parent, rootElementNAC, nsIContent::eSkipDocumentLevelNativeAnonymousContent);
bool isDocLevelNAC = !rootElementNAC.Contains(this);
#ifdef DEBUG
{
// The code below would be slightly more direct, but it gets the wrong
// answer when the root scrollframe is being bootstrapped and we're
// trying to style the scrollbars (since GetRootScrollFrame() still returns
// null at that point). Verify that the results match otherwise.
AutoTArray<nsIContent*, 8> docLevelNAC;
nsContentUtils::AppendDocumentLevelNativeAnonymousContentTo(OwnerDoc(), docLevelNAC);
MOZ_ASSERT_IF(OwnerDoc()->GetShell()->GetRootScrollFrame(),
isDocLevelNAC == docLevelNAC.Contains(this));
// When getting the flattened tree parent for style, we return null
// for any "document level" native anonymous content subtree root.
// This is NAC generated by an ancestor frame of the document element's
// primary frame, and includes scrollbar elements created by the root
// scroll frame, and the "custom content container" and accessible caret
// generated by the nsCanvasFrame. We distinguish document level NAC
// from NAC generated by the root element's primary frame below.
nsIFrame* parentFrame = parent->GetPrimaryFrame();
if (!parentFrame) {
// If the root element has no primary frame, it means it can't have
// 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 OwnerDoc();
}
#endif
if (isDocLevelNAC) {
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 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 OwnerDoc();
}
}