WebKit Bugzilla
Attachment 348950 Details for
Bug 189311
: [LFC] LayoutContext::displayBoxForLayoutBox() should return a Display::Box&
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189311-20180905113314.patch (text/plain), 47.61 KB, created by
zalan
on 2018-09-05 11:33:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-09-05 11:33:17 PDT
Size:
47.61 KB
patch
obsolete
>Subversion Revision: 235677 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 51cbf46f70efbe5c4b18e670b965efc29f7fe345..7db6e5e31da59e3f4d6a2dcf4ccc3250c70396ca 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,73 @@ >+2018-09-05 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] LayoutContext::displayBoxForLayoutBox() should return a Display::Box& >+ https://bugs.webkit.org/show_bug.cgi?id=189311 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When the layout logic needs a Display::Box, we must have already created one for the associated Layout::Box. >+ (It does not necessarily mean that evey Layout::Box has a Display::Box. For example in case of inline formatting context, >+ we don't create a Display::Box for every inline box, but the formatting logic does not require such pairs.) >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): >+ (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): >+ (WebCore::Layout::FormattingContext::computeBorderAndPadding const): >+ (WebCore::Layout::FormattingContext::mapBoxToAncestor): >+ (WebCore::Layout::FormattingContext::mapTopLeftToAncestor): >+ (WebCore::Layout::FormattingContext::mapCoordinateToAncestor): >+ (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const): >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::contentHeightForFormattingContextRoot): >+ (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned): >+ (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned): >+ (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::computedPadding): >+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): >+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): >+ * layout/LayoutContext.h: >+ (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): >+ * layout/Verification.cpp: >+ (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): >+ (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const): >+ (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const): >+ (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const): >+ (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const): >+ (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const): >+ (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const): >+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): >+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::isMarginTopCollapsedWithParent): >+ (WebCore::Layout::isMarginBottomCollapsedThrough): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent): >+ * layout/floats/FloatingContext.cpp: >+ (WebCore::Layout::FloatingContext::positionForFloat const): >+ (WebCore::Layout::FloatingContext::verticalPositionWithClearance const): >+ * layout/floats/FloatingState.cpp: >+ (WebCore::Layout::FloatingState::append): >+ * layout/inlineformatting/InlineFormattingContext.cpp: >+ (WebCore::Layout::InlineFormattingContext::layout const): >+ * layout/layouttree/LayoutTreeBuilder.cpp: >+ (WebCore::Layout::outputLayoutTree): >+ (WebCore::Layout::showLayoutTree): >+ > 2018-09-05 Zalan Bujtas <zalan@apple.com> > > [LFC] Drop Display:Box from FormattingContext::compute* functions >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 614124c2a159d1d593004be7f517acbfcde8fbe6..91b0d1de1222ac10280de291f3cb8b32d3ccc98c 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -55,7 +55,7 @@ void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutContext& layout > { > auto horizontalGeometry = Geometry::outOfFlowHorizontalGeometry(layoutContext, *this, layoutBox); > >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.widthAndMargin.margin.left); > displayBox.setContentBoxWidth(horizontalGeometry.widthAndMargin.width); > displayBox.setHorizontalMargin(horizontalGeometry.widthAndMargin.margin); >@@ -66,7 +66,7 @@ void FormattingContext::computeOutOfFlowVerticalGeometry(LayoutContext& layoutCo > { > auto verticalGeometry = Geometry::outOfFlowVerticalGeometry(layoutContext, layoutBox); > >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > displayBox.setTop(verticalGeometry.top + verticalGeometry.heightAndMargin.margin.top); > displayBox.setContentBoxHeight(verticalGeometry.heightAndMargin.height); > ASSERT(!verticalGeometry.heightAndMargin.collapsedMargin); >@@ -76,7 +76,7 @@ void FormattingContext::computeOutOfFlowVerticalGeometry(LayoutContext& layoutCo > > void FormattingContext::computeBorderAndPadding(LayoutContext& layoutContext, const Box& layoutBox) const > { >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > displayBox.setBorder(Geometry::computedBorder(layoutContext, layoutBox)); > displayBox.setPadding(Geometry::computedPadding(layoutContext, layoutBox)); > } >@@ -133,20 +133,19 @@ Display::Box FormattingContext::mapBoxToAncestor(const LayoutContext& layoutCont > { > ASSERT(layoutBox.isDescendantOf(ancestor)); > >- auto* displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >- ASSERT(displayBox); >- auto topLeft = displayBox->topLeft(); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto topLeft = displayBox.topLeft(); > > auto* containingBlock = layoutBox.containingBlock(); > for (; containingBlock && containingBlock != &ancestor; containingBlock = containingBlock->containingBlock()) >- topLeft.moveBy(layoutContext.displayBoxForLayoutBox(*containingBlock)->topLeft()); >+ topLeft.moveBy(layoutContext.displayBoxForLayoutBox(*containingBlock).topLeft()); > > if (!containingBlock) { > ASSERT_NOT_REACHED(); >- return Display::Box(*displayBox); >+ return Display::Box(displayBox); > } > >- auto mappedDisplayBox = Display::Box(*displayBox); >+ auto mappedDisplayBox = Display::Box(displayBox); > mappedDisplayBox.setTopLeft(topLeft); > return mappedDisplayBox; > } >@@ -154,7 +153,7 @@ Display::Box FormattingContext::mapBoxToAncestor(const LayoutContext& layoutCont > Position FormattingContext::mapTopLeftToAncestor(const LayoutContext& layoutContext, const Box& layoutBox, const Container& ancestor) > { > ASSERT(layoutBox.isDescendantOf(ancestor)); >- return mapCoordinateToAncestor(layoutContext, layoutContext.displayBoxForLayoutBox(layoutBox)->topLeft(), *layoutBox.containingBlock(), ancestor); >+ return mapCoordinateToAncestor(layoutContext, layoutContext.displayBoxForLayoutBox(layoutBox).topLeft(), *layoutBox.containingBlock(), ancestor); > } > > Position FormattingContext::mapCoordinateToAncestor(const LayoutContext& layoutContext, Position position, const Container& containingBlock, const Container& ancestor) >@@ -162,7 +161,7 @@ Position FormattingContext::mapCoordinateToAncestor(const LayoutContext& layoutC > auto mappedPosition = position; > auto* container = &containingBlock; > for (; container && container != &ancestor; container = container->containingBlock()) >- mappedPosition.moveBy(layoutContext.displayBoxForLayoutBox(*container)->topLeft()); >+ mappedPosition.moveBy(layoutContext.displayBoxForLayoutBox(*container).topLeft()); > > if (!container) { > ASSERT_NOT_REACHED(); >@@ -182,25 +181,24 @@ void FormattingContext::validateGeometryConstraintsAfterLayout(const LayoutConte > for (auto& layoutBox : descendantsOfType<Box>(formattingContextRoot)) { > if (&layoutBox.formattingContextRoot() != &formattingContextRoot) > continue; >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >- auto* displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >- ASSERT(displayBox); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > > // 10.3.3 Block-level, non-replaced elements in normal flow > // 10.3.7 Absolutely positioned, non-replaced elements > if ((layoutBox.isBlockLevelBox() || layoutBox.isOutOfFlowPositioned()) && !layoutBox.replaced()) { > // margin-left + border-left-width + padding-left + width + padding-right + border-right-width + margin-right = width of containing block > auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth(); >- ASSERT(displayBox->marginLeft() + displayBox->borderLeft() + displayBox->paddingLeft().value_or(0) + displayBox->contentBoxWidth() >- + displayBox->paddingRight().value_or(0) + displayBox->borderRight() + displayBox->marginRight() == containingBlockWidth); >+ ASSERT(displayBox.marginLeft() + displayBox.borderLeft() + displayBox.paddingLeft().value_or(0) + displayBox.contentBoxWidth() >+ + displayBox.paddingRight().value_or(0) + displayBox.borderRight() + displayBox.marginRight() == containingBlockWidth); > } > > // 10.6.4 Absolutely positioned, non-replaced elements > if (layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced()) { > // top + margin-top + border-top-width + padding-top + height + padding-bottom + border-bottom-width + margin-bottom + bottom = height of containing block > auto containingBlockHeight = containingBlockDisplayBox.contentBoxHeight(); >- ASSERT(displayBox->top() + displayBox->marginTop() + displayBox->borderTop() + displayBox->paddingTop().value_or(0) + displayBox->contentBoxHeight() >- + displayBox->paddingBottom().value_or(0) + displayBox->borderBottom() + displayBox->marginBottom() == containingBlockHeight); >+ ASSERT(displayBox.top() + displayBox.marginTop() + displayBox.borderTop() + displayBox.paddingTop().value_or(0) + displayBox.contentBoxHeight() >+ + displayBox.paddingBottom().value_or(0) + displayBox.borderBottom() + displayBox.marginBottom() == containingBlockHeight); > } > } > } >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index d11db968a83abfa3b66d042fc1622fcf6559ff09..77d9241c4ab36bac35c470d1de45544fec0abd7b 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -54,10 +54,10 @@ static LayoutUnit contentHeightForFormattingContextRoot(LayoutContext& layoutCon > if (formattingRootContainer.establishesInlineFormattingContext()) > return 0; > >- auto* firstDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild()); >- auto* lastDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild()); >- auto top = firstDisplayBox->rectWithMargin().top(); >- auto bottom = lastDisplayBox->rectWithMargin().bottom(); >+ auto& firstDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild()); >+ auto& lastDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild()); >+ auto top = firstDisplayBox.rectWithMargin().top(); >+ auto bottom = lastDisplayBox.rectWithMargin().bottom(); > > auto* formattingContextRoot = &layoutBox; > // TODO: The document renderer is not a formatting context root by default at all. Need to find out what it is. >@@ -103,17 +103,17 @@ static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutConte > LayoutUnit top; > if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) { > // Add sibling offset >- auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); >+ auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); > top += previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.nonCollapsedMarginBottom(); > } else { > ASSERT(layoutBox.parent()); >- top = layoutContext.displayBoxForLayoutBox(*layoutBox.parent())->contentBoxTop(); >+ top = layoutContext.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxTop(); > } > > // Resolve top all the way up to the containing block. > auto* containingBlock = layoutBox.containingBlock(); > for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) { >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(*container); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(*container); > // Display::Box::top is the border box top position in its containing block's coordinate system. > top += displayBox.top(); > ASSERT(!container->isPositioned()); >@@ -129,12 +129,12 @@ static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutCon > > // Start with this box's border box offset from the parent's border box. > ASSERT(layoutBox.parent()); >- auto left = layoutContext.displayBoxForLayoutBox(*layoutBox.parent())->contentBoxLeft(); >+ auto left = layoutContext.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxLeft(); > > // Resolve left all the way up to the containing block. > auto* containingBlock = layoutBox.containingBlock(); > for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) { >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(*container); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(*container); > // Display::Box::left is the border box left position in its containing block's coordinate system. > left += displayBox.left(); > ASSERT(!container->isPositioned()); >@@ -153,7 +153,7 @@ LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutContext& layoutCo > // 'padding-left', 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars. > > // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width). >- auto availableWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ auto availableWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).width(); > auto instrinsicWidthConstraints = formattingContext.instrinsicWidthConstraints(layoutContext, layoutBox); > return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum); > } >@@ -187,8 +187,8 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet > // 6. 'bottom' is 'auto', 'top' and 'height' are not 'auto', then set 'auto' values for 'margin-top' and 'margin-bottom' to 0 and solve for 'bottom' > > auto& style = layoutBox.style(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > auto containingBlockHeight = containingBlockDisplayBox.height(); > auto containingBlockWidth = containingBlockDisplayBox.width(); > >@@ -305,9 +305,9 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > // 6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right' > > auto& style = layoutBox.style(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > auto& containingBlock = *layoutBox.containingBlock(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth(); > auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection(); > > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); >@@ -435,8 +435,8 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > // 5. If at this point the values are over-constrained, ignore the value for 'bottom' and solve for that value. > > auto& style = layoutBox.style(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > auto containingBlockHeight = containingBlockDisplayBox.height(); > auto containingBlockWidth = containingBlockDisplayBox.width(); > >@@ -508,9 +508,9 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > // 'right' (in case 'direction' is 'ltr') and solve for that value. > > auto& style = layoutBox.style(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > auto& containingBlock = *layoutBox.containingBlock(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth(); > auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection(); > > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); >@@ -604,7 +604,7 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(LayoutContext& lay > > auto& style = layoutBox.style(); > auto& containingBlock = *layoutBox.containingBlock(); >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(containingBlock); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(containingBlock); > auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth(); > > auto height = fixedValue(style.logicalHeight()); >@@ -640,7 +640,7 @@ WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(La > // 2. If 'width' is computed as 'auto', the used value is the "shrink-to-fit" width. > > auto& containingBlock = *layoutBox.containingBlock(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth(); > > // #1 > auto margin = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox); >@@ -732,7 +732,7 @@ HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(Layou > > auto& style = layoutBox.style(); > auto replaced = layoutBox.replaced(); >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > auto containingBlockWidth = containingBlockDisplayBox.width(); > > auto height = fixedValue(style.logicalHeight()); >@@ -787,7 +787,7 @@ WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(LayoutC > // If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead. > > auto& style = layoutBox.style(); >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > auto containingBlockWidth = containingBlockDisplayBox.width(); > > auto computeMarginRight = [&]() { >@@ -859,7 +859,7 @@ std::optional<Edges> FormattingContext::Geometry::computedPadding(LayoutContext& > return std::nullopt; > > auto& style = layoutBox.style(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox); > return Edges { > { valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) }, >@@ -870,7 +870,7 @@ std::optional<Edges> FormattingContext::Geometry::computedPadding(LayoutContext& > HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox) > { > auto& style = layoutBox.style(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); > > auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth).value_or(LayoutUnit { 0 }); > auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth).value_or(LayoutUnit { 0 }); >@@ -882,7 +882,7 @@ HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMargi > VerticalEdges FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox) > { > auto& style = layoutBox.style(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); > > auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(LayoutUnit { 0 }); > auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(LayoutUnit { 0 }); >diff --git a/Source/WebCore/layout/LayoutContext.h b/Source/WebCore/layout/LayoutContext.h >index 08b4c1fce310aa2f6a3e5665632428dd6f51ae32..cc05b91507cf15e9939b296611b4fcadc8a67240 100644 >--- a/Source/WebCore/layout/LayoutContext.h >+++ b/Source/WebCore/layout/LayoutContext.h >@@ -81,7 +81,7 @@ public: > FormattingState& establishedFormattingState(const Box& formattingRoot); > > Display::Box& createDisplayBox(const Box&); >- Display::Box* displayBoxForLayoutBox(const Box& layoutBox) const { return m_layoutToDisplayBox.get(&layoutBox); } >+ Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const { return *m_layoutToDisplayBox.get(&layoutBox); } > > bool inQuirksMode() const { return m_inQuirksMode; } > // For testing purposes only >diff --git a/Source/WebCore/layout/Verification.cpp b/Source/WebCore/layout/Verification.cpp >index 043fbd068bdf604ab0d2c774a90f670bec438d5a..e8bc435352ce36870a7e3ceed9ace8a3f6a62597 100644 >--- a/Source/WebCore/layout/Verification.cpp >+++ b/Source/WebCore/layout/Verification.cpp >@@ -133,36 +133,35 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con > }; > }; > >- auto* displayBox = context.displayBoxForLayoutBox(layoutBox); >- ASSERT(displayBox); >+ auto& displayBox = context.displayBoxForLayoutBox(layoutBox); > > auto frameRect = renderer.frameRect(); > // rendering does not offset for relative positioned boxes. > if (renderer.isInFlowPositioned()) > frameRect.move(renderer.offsetForInFlowPosition()); > >- if (frameRect != displayBox->rect()) { >- outputRect("frameBox", renderer.frameRect(), displayBox->rect()); >+ if (frameRect != displayBox.rect()) { >+ outputRect("frameBox", renderer.frameRect(), displayBox.rect()); > return true; > } > >- if (renderer.marginBoxRect() != renderBoxLikeMarginBox(*displayBox)) { >- outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(*displayBox)); >+ if (renderer.marginBoxRect() != renderBoxLikeMarginBox(displayBox)) { >+ outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(displayBox)); > return true; > } > >- if (renderer.borderBoxRect() != displayBox->borderBox()) { >- outputRect("borderBox", renderer.borderBoxRect(), displayBox->borderBox()); >+ if (renderer.borderBoxRect() != displayBox.borderBox()) { >+ outputRect("borderBox", renderer.borderBoxRect(), displayBox.borderBox()); > return true; > } > >- if (renderer.paddingBoxRect() != displayBox->paddingBox()) { >- outputRect("paddingBox", renderer.paddingBoxRect(), displayBox->paddingBox()); >+ if (renderer.paddingBoxRect() != displayBox.paddingBox()) { >+ outputRect("paddingBox", renderer.paddingBoxRect(), displayBox.paddingBox()); > return true; > } > >- if (renderer.contentBoxRect() != displayBox->contentBox()) { >- outputRect("contentBox", renderer.contentBoxRect(), displayBox->contentBox()); >+ if (renderer.contentBoxRect() != displayBox.contentBox()) { >+ outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox()); > return true; > } > >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 89464acf746bd59b4dcbb4bffe89d7fb04faebb5..a4c19de426ef8b2ad19d2877ed81d2a5f38f25db 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -161,14 +161,14 @@ void BlockFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutCo > > void BlockFormattingContext::computeStaticPosition(LayoutContext& layoutContext, const Box& layoutBox) const > { >- layoutContext.displayBoxForLayoutBox(layoutBox)->setTopLeft(Geometry::staticPosition(layoutContext, layoutBox)); >+ layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::staticPosition(layoutContext, layoutBox)); > } > > void BlockFormattingContext::computeEstimatedMarginTop(LayoutContext& layoutContext, const Box& layoutBox) const > { > auto estimatedMarginTop = Geometry::estimatedMarginTop(layoutContext, layoutBox); > >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > displayBox.setEstimatedMarginTop(estimatedMarginTop); > displayBox.moveVertically(estimatedMarginTop); > } >@@ -189,10 +189,9 @@ void BlockFormattingContext::computeEstimatedMarginTopForAncestors(LayoutContext > // The idea here is that as long as we don't cross the block formatting context boundary, we should be able to pre-compute the final top margin. > > for (auto* ancestor = layoutBox.containingBlock(); ancestor && !ancestor->establishesBlockFormattingContext(); ancestor = ancestor->containingBlock()) { >- auto* displayBox = layoutContext.displayBoxForLayoutBox(*ancestor); >- ASSERT(displayBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(*ancestor); > // FIXME: with incremental layout, we might actually have a valid (non-estimated) margin top as well. >- if (displayBox->estimatedMarginTop()) >+ if (displayBox.estimatedMarginTop()) > return; > > computeEstimatedMarginTop(layoutContext, *ancestor); >@@ -202,12 +201,12 @@ void BlockFormattingContext::computeEstimatedMarginTopForAncestors(LayoutContext > void BlockFormattingContext::computeFloatingPosition(LayoutContext& layoutContext, FloatingContext& floatingContext, const Box& layoutBox) const > { > ASSERT(layoutBox.isFloatingPositioned()); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > // 8.3.1 Collapsing margins > // In block formatting context margins between a floated box and any other box do not collapse. > // Adjust the static position by using the previous inflow box's non-collapsed margin. > if (auto* previousInFlowBox = layoutBox.previousInFlowSibling()) { >- auto& previousDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowBox); >+ auto& previousDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowBox); > displayBox.moveVertically(previousDisplayBox.nonCollapsedMarginBottom() - previousDisplayBox.marginBottom()); > } > computeEstimatedMarginTopForAncestors(layoutContext, layoutBox); >@@ -227,7 +226,7 @@ void BlockFormattingContext::computePositionToAvoidFloats(LayoutContext& layoutC > > computeEstimatedMarginTopForAncestors(layoutContext, layoutBox); > if (auto adjustedPosition = floatingContext.positionForFloatAvoiding(layoutBox)) >- layoutContext.displayBoxForLayoutBox(layoutBox)->setTopLeft(*adjustedPosition); >+ layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(*adjustedPosition); > } > > void BlockFormattingContext::computeVerticalPositionForFloatClear(LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const >@@ -238,12 +237,12 @@ void BlockFormattingContext::computeVerticalPositionForFloatClear(LayoutContext& > > computeEstimatedMarginTopForAncestors(layoutContext, layoutBox); > if (auto verticalPositionWithClearance = floatingContext.verticalPositionWithClearance(layoutBox)) >- layoutContext.displayBoxForLayoutBox(layoutBox)->setTop(*verticalPositionWithClearance); >+ layoutContext.displayBoxForLayoutBox(layoutBox).setTop(*verticalPositionWithClearance); > } > > void BlockFormattingContext::computeInFlowPositionedPosition(LayoutContext& layoutContext, const Box& layoutBox) const > { >- layoutContext.displayBoxForLayoutBox(layoutBox)->setTopLeft(Geometry::inFlowPositionedPosition(layoutContext, layoutBox)); >+ layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::inFlowPositionedPosition(layoutContext, layoutBox)); > } > > void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) const >@@ -257,7 +256,7 @@ void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, > else > ASSERT_NOT_REACHED(); > >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > displayBox.setContentBoxWidth(widthAndMargin.width); > displayBox.moveHorizontally(widthAndMargin.margin.left); > displayBox.setHorizontalMargin(widthAndMargin.margin); >@@ -268,7 +267,7 @@ void BlockFormattingContext::computeHeightAndMargin(LayoutContext& layoutContext > { > HeightAndMargin heightAndMargin; > std::optional<LayoutUnit> marginTopOffset; >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > > if (layoutBox.isInFlow()) { > heightAndMargin = Geometry::inFlowHeightAndMargin(layoutContext, layoutBox); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index cf3678f46f9462e9a9d94ecb2c030b0e87ea535c..5442036f28f7372fe37017274045368171d57fb8 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -98,8 +98,8 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > // and relatively positioned boxes are considered without their offset). Note that the child box may be an anonymous block box. > > auto& style = layoutBox.style(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > > VerticalEdges nonCollapsedMargin = { computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0), > computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0) }; >@@ -128,9 +128,8 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > auto* lastInFlowChild = downcast<Container>(layoutBox).lastInFlowChild(); > ASSERT(lastInFlowChild); > if (!MarginCollapse::isMarginBottomCollapsedWithParent(layoutContext, *lastInFlowChild)) { >- auto* lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild); >- ASSERT(lastInFlowDisplayBox); >- return { lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin }; >+ auto& lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild); >+ return { lastInFlowDisplayBox.bottom() + lastInFlowDisplayBox.marginBottom() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin }; > } > > // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin >@@ -138,9 +137,8 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > while (inFlowChild && MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild)) > inFlowChild = inFlowChild->previousInFlowSibling(); > if (inFlowChild) { >- auto* inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild); >- ASSERT(inFlowDisplayBox); >- return { inFlowDisplayBox->top() + inFlowDisplayBox->borderBox().height() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin }; >+ auto& inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild); >+ return { inFlowDisplayBox.top() + inFlowDisplayBox.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin }; > } > > // 4. zero, otherwise >@@ -183,8 +181,8 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > > auto& style = layoutBox.style(); > auto* containingBlock = layoutBox.containingBlock(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock)->contentBoxWidth(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock).contentBoxWidth(); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > > auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); > auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth); >@@ -247,7 +245,7 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > return widthAndMargin; > } > >- auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxWidth(); >+ auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxWidth(); > widthAndMargin = stretchWidthToInitialContainingBlock(widthAndMargin, initialContainingBlockWidth); > > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); >@@ -281,9 +279,9 @@ Position BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutC > // In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch). > > LayoutUnit top; >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) { >- auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); >+ auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); > top = previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom(); > } else > top = containingBlockDisplayBox.contentBoxTop(); >@@ -307,9 +305,9 @@ Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContex > // 3. If neither is 'auto', 'bottom' is ignored (i.e., the used value of 'bottom' will be minus the value of 'top'). > > auto& style = layoutBox.style(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > auto& containingBlock = *layoutBox.containingBlock(); >- auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->contentBoxWidth(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth(); > > auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); > auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >@@ -392,7 +390,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutCo > if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox)) > return heightAndMargin; > >- auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxHeight(); >+ auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxHeight(); > heightAndMargin = stretchHeightToInitialContainingBlock(heightAndMargin, initialContainingBlockHeight); > > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << heightAndMargin.height << "px) margin(" << heightAndMargin.margin.top << "px, " << heightAndMargin.margin.bottom << "px) -> layoutBox(" << &layoutBox << ")"); >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index 5faa71115a3c266eee45976aba804e8032164902..ccf6dcf3e9a73c20ed57527470f8d0eefcff046c 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -108,7 +108,7 @@ static bool isMarginTopCollapsedWithParent(const LayoutContext& layoutContext, c > if (parent.isDocumentBox() || parent.isInitialContainingBlock()) > return false; > >- auto& parentDisplayBox = *layoutContext.displayBoxForLayoutBox(parent); >+ auto& parentDisplayBox = layoutContext.displayBoxForLayoutBox(parent); > if (parentDisplayBox.borderTop()) > return false; > >@@ -123,7 +123,7 @@ static bool isMarginBottomCollapsedThrough(const LayoutContext& layoutContext, c > ASSERT(layoutBox.isBlockLevelBox()); > > // If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it. >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > > if (displayBox.borderTop() || displayBox.borderBottom()) > return false; >@@ -285,7 +285,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWi > if (parent.isDocumentBox() || parent.isInitialContainingBlock()) > return false; > >- auto& parentDisplayBox = *layoutContext.displayBoxForLayoutBox(parent); >+ auto& parentDisplayBox = layoutContext.displayBoxForLayoutBox(parent); > if (parentDisplayBox.borderTop()) > return false; > >diff --git a/Source/WebCore/layout/floats/FloatingContext.cpp b/Source/WebCore/layout/floats/FloatingContext.cpp >index 05d444345c1a09c6d5fb134686f5c87c1edf588d..1f035d81a9404899541c46830adff49c925f0816 100644 >--- a/Source/WebCore/layout/floats/FloatingContext.cpp >+++ b/Source/WebCore/layout/floats/FloatingContext.cpp >@@ -121,11 +121,11 @@ PointInContainingBlock FloatingContext::positionForFloat(const Box& layoutBox) c > ASSERT(layoutBox.isFloatingPositioned()); > > if (m_floatingState.isEmpty()) { >- auto& displayBox = *layoutContext().displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext().displayBoxForLayoutBox(layoutBox); > > auto alignWithContainingBlock = [&]() -> PositionInContainingBlock { > // If there is no floating to align with, push the box to the left/right edge of its containing block's content box. >- auto& containingBlockDisplayBox = *layoutContext().displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ auto& containingBlockDisplayBox = layoutContext().displayBoxForLayoutBox(*layoutBox.containingBlock()); > > if (layoutBox.isLeftFloatingPositioned()) > return containingBlockDisplayBox.contentBoxLeft() + displayBox.marginLeft(); >@@ -177,7 +177,7 @@ std::optional<PositionInContainingBlock> FloatingContext::verticalPositionWithCl > // 2. The amount necessary to place the top border edge of the block at its hypothetical position. > > auto& layoutContext = this->layoutContext(); >- auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); > auto rootRelativeTop = FormattingContext::mapTopLeftToAncestor(layoutContext, layoutBox, downcast<Container>(m_floatingState.root())).y; > auto clearance = *floatBottom - rootRelativeTop; > if (clearance <= 0) >@@ -185,7 +185,7 @@ std::optional<PositionInContainingBlock> FloatingContext::verticalPositionWithCl > > // Clearance inhibits margin collapsing. Let's reset the relevant adjoining margins. > if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) { >- auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); >+ auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); > > // Since the previous inflow sibling has already been laid out, its margin is collapsed by now. > ASSERT(!previousInFlowDisplayBox.marginBottom()); >diff --git a/Source/WebCore/layout/floats/FloatingState.cpp b/Source/WebCore/layout/floats/FloatingState.cpp >index 31d52c3ef57da6dd00662b3503ab868d8d660534..5b17cfb26ab4c703579fbadea69c1028f79aea0b 100644 >--- a/Source/WebCore/layout/floats/FloatingState.cpp >+++ b/Source/WebCore/layout/floats/FloatingState.cpp >@@ -81,9 +81,6 @@ void FloatingState::append(const Box& layoutBox) > { > ASSERT(is<Container>(*m_formattingContextRoot)); > ASSERT(belongsToThisFloatingContext(layoutBox, *m_formattingContextRoot)); >- >- // Floating state should hold boxes with computed position/size. >- ASSERT(m_layoutContext.displayBoxForLayoutBox(layoutBox)); > ASSERT(is<Container>(*m_formattingContextRoot)); > > m_floats.append({ layoutBox, *this }); >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index e16c2281cd767cde17acb72fee8de73c76695ad9..9e26b7554e486c679b6fa9c3965c8ff4c924c477 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -86,7 +86,7 @@ void InlineFormattingContext::layout(LayoutContext& layoutContext, FormattingSta > ASSERT(!layoutBox || layoutBox->isDescendantOf(formattingRoot)); > } > >- auto& formattingRootDisplayBox = *layoutContext.displayBoxForLayoutBox(formattingRoot); >+ auto& formattingRootDisplayBox = layoutContext.displayBoxForLayoutBox(formattingRoot); > auto lineLeft = formattingRootDisplayBox.contentBoxLeft(); > auto lineRight = formattingRootDisplayBox.contentBoxRight(); > >diff --git a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >index e8a0ee20a538fc717826bc9a82e84553b9baf519..3a4aedd43fd43689b40c73da8a033de15291a917 100644 >--- a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >@@ -155,7 +155,7 @@ static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const Disp > static void outputLayoutTree(const LayoutContext* layoutContext, TextStream& stream, const Container& rootContainer, unsigned depth) > { > for (auto& child : childrenOfType<Box>(rootContainer)) { >- outputLayoutBox(stream, child, layoutContext ? layoutContext->displayBoxForLayoutBox(child) : nullptr, depth); >+ outputLayoutBox(stream, child, layoutContext ? &layoutContext->displayBoxForLayoutBox(child) : nullptr, depth); > if (is<Container>(child)) > outputLayoutTree(layoutContext, stream, downcast<Container>(child), depth + 1); > } >@@ -166,7 +166,7 @@ void showLayoutTree(const Box& layoutBox, const LayoutContext* layoutContext) > TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); > > auto& initialContainingBlock = layoutBox.initialContainingBlock(); >- outputLayoutBox(stream, initialContainingBlock, layoutContext ? layoutContext->displayBoxForLayoutBox(initialContainingBlock) : nullptr, 0); >+ outputLayoutBox(stream, initialContainingBlock, layoutContext ? &layoutContext->displayBoxForLayoutBox(initialContainingBlock) : nullptr, 0); > outputLayoutTree(layoutContext, stream, initialContainingBlock, 1); > WTFLogAlways("%s", stream.release().utf8().data()); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189311
: 348950