Bug 1322191 part 2 - [css-display] Implement layout for display:flow-root. r=dholbert

This commit is contained in:
Mats Palmgren 2016-12-23 19:11:03 +01:00
Родитель 69e8c00577
Коммит 46f54ec32b
2 изменённых файлов: 6 добавлений и 2 удалений

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

@ -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.

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

@ -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);