diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 7a488379d848..4c29532ee216 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -2627,7 +2627,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle newFrame = frameItems.FirstChild(); NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames"); } else { - MOZ_ASSERT(display->mDisplay == StyleDisplay::Block, + MOZ_ASSERT(display->mDisplay == StyleDisplay::Block || + display->mDisplay == StyleDisplay::FlowRoot, "Unhandled display type for root element"); contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext); nsFrameItems frameItems; @@ -4767,6 +4768,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, static const FrameConstructionDataByDisplay sDisplayData[] = { FCDATA_FOR_DISPLAY(StyleDisplay::None, UNREACHABLE_FCDATA()), FCDATA_FOR_DISPLAY(StyleDisplay::Block, UNREACHABLE_FCDATA()), + FCDATA_FOR_DISPLAY(StyleDisplay::FlowRoot, UNREACHABLE_FCDATA()), // To keep the hash table small don't add inline frames (they're // typically things like FONT and B), because we can quickly // find them if we need to. diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index e6e3a2b290df..6907649af723 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -6907,6 +6907,7 @@ nsBlockFrame::Init(nsIContent* aContent, AddStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION); } + // A display:flow-root box establishes a block formatting context. // If a box has a different block flow direction than its containing block: // ... // If the box is a block container, then it establishes a new block @@ -6914,7 +6915,8 @@ nsBlockFrame::Init(nsIContent* aContent, // (http://dev.w3.org/csswg/css-writing-modes/#block-flow) // If the box has contain: paint (or contain: strict), then it should also // establish a formatting context. - if ((GetParent() && StyleVisibility()->mWritingMode != + if (StyleDisplay()->mDisplay == mozilla::StyleDisplay::FlowRoot || + (GetParent() && StyleVisibility()->mWritingMode != GetParent()->StyleVisibility()->mWritingMode) || StyleDisplay()->IsContainPaint()) { AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);