author | Boris Zbarsky <bzbarsky@mit.edu> |
Wed, 08 Mar 2017 03:14:10 -0500 | |
changeset 346541 | 8c3640c241d8d109de1bc25b42e6b2b37eee68f7 |
parent 346540 | cce6ce016dfa75e6fd0a90a9e5934417a04feed0 |
child 346553 | 6964fbecaacc7ea2af787b2c2157e22eb53c678d |
push id | 87834 |
push user | bzbarsky@mozilla.com |
push date | Wed, 08 Mar 2017 15:49:58 +0000 |
treeherder | mozilla-inbound@8c3640c241d8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bholley |
bugs | 1343879 |
milestone | 55.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
|
--- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10869,26 +10869,32 @@ nsCSSFrameConstructor::AddFCItemsForAnon // for us. nsIFrame* inheritFrame = aFrame; if (!content->IsNativeScrollbarContent()) { while (inheritFrame->GetContent()->IsNativeAnonymous()) { inheritFrame = inheritFrame->GetInFlowParent(); } } - if (inheritFrame->GetType() == nsGkAtoms::canvasFrame) { - // CorrectStyleParentFrame returns nullptr if the prospective parent is - // the canvas frame, so avoid calling it in that situation. - } else { - inheritFrame = nsFrame::CorrectStyleParentFrame(inheritFrame, pseudo); - } - Element* originating = pseudo ? inheritFrame->GetContent()->AsElement() : nullptr; - + nsIFrame* styleParentFrame = + nsFrame::CorrectStyleParentFrame(inheritFrame, pseudo); + // The only way we can not have a style parent now is if inheritFrame is the + // canvas frame and we're the NAC parent for all the things added via + // nsIDocument::InsertAnonymousContent. + MOZ_ASSERT_IF(!styleParentFrame, + inheritFrame->GetType() == nsGkAtoms::canvasFrame); + // And that anonymous div has no pseudo. + MOZ_ASSERT_IF(!styleParentFrame, !pseudo); + + Element* originating = + pseudo ? styleParentFrame->GetContent()->AsElement() : nullptr; + nsStyleContext* parentStyle = + styleParentFrame ? styleParentFrame->StyleContext() : nullptr; styleContext = - ResolveStyleContext(inheritFrame->StyleContext(), content, &aState, originating); + ResolveStyleContext(parentStyle, content, &aState, originating); nsTArray<nsIAnonymousContentCreator::ContentInfo>* anonChildren = nullptr; if (!aAnonymousItems[i].mChildren.IsEmpty()) { anonChildren = &aAnonymousItems[i].mChildren; } uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK | ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT | aExtraFlags;