Title: [268948] trunk/Source/WebCore
Revision
268948
Author
za...@apple.com
Date
2020-10-24 05:43:21 -0700 (Sat, 24 Oct 2020)

Log Message

[LFC] BoxGeometry logicalWidth/Height/Rect functions are confusing
https://bugs.webkit.org/show_bug.cgi?id=218145

Reviewed by Antti Koivisto.

BoxGeometry represents the layout node both as a box relative to the containing block (BoxGeometry::logicalRect(), logicalLeft(), logicalWidth())
and as a box relative to the border box (BoxGeometry::marginBox(), paddingBox(), contentBox()).
These 2 sets of geometries may be confusing in certain cases, e.g. logicalWidth() does not say whether it's border, padding or content box.
BoxGometry is mostly used as a box relative to the border box (0, 0, border box width, border box height) so let's make the other set as a
static API.

* display/DisplayTreeBuilder.cpp:
(WebCore::Display::TreeBuilder::build const):
(WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):
(WebCore::Display::TreeBuilder::displayBoxForRootBox const):
(WebCore::Display::TreeBuilder::displayBoxForLayoutBox const):
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
(WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
(WebCore::Layout::FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned const):
(WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear):
(WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::staticVerticalPosition const):
* layout/flexformatting/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::positionForFloat const):
(WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const):
(WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const):
(WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const):
* layout/floats/FloatingState.h:
(WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
(WebCore::Layout::FloatingState::FloatItem::bottom const):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::inlineItemWidth const):
* layout/layouttree/LayoutBoxGeometry.cpp:
(WebCore::Layout::BoxGeometry::borderBox const):
* layout/layouttree/LayoutBoxGeometry.h:
(WebCore::Layout::BoxGeometry::logicalTop):
(WebCore::Layout::BoxGeometry::logicalLeft):
(WebCore::Layout::BoxGeometry::logicalTopLeft):
(WebCore::Layout::BoxGeometry::borderRect):
(WebCore::Layout::BoxGeometry::marginRect):
(WebCore::Layout::BoxGeometry::logicalBottom const): Deleted.
(WebCore::Layout::BoxGeometry::logicalRight const): Deleted.
(WebCore::Layout::BoxGeometry::logicalBottomRight const): Deleted.
(WebCore::Layout::BoxGeometry::logicalSize const): Deleted.
(WebCore::Layout::BoxGeometry::logicalWidth const): Deleted.
(WebCore::Layout::BoxGeometry::logicalHeight const): Deleted.
(WebCore::Layout::BoxGeometry::isEmpty const): Deleted.
(WebCore::Layout::BoxGeometry::logicalRect const): Deleted.
(WebCore::Layout::BoxGeometry::logicalRectWithMargin const): Deleted.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputLayoutBox):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
* layout/tableformatting/TableFormattingContextGeometry.cpp:
(WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
* layout/tableformatting/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268947 => 268948)


--- trunk/Source/WebCore/ChangeLog	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/ChangeLog	2020-10-24 12:43:21 UTC (rev 268948)
@@ -1,3 +1,80 @@
+2020-10-24  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] BoxGeometry logicalWidth/Height/Rect functions are confusing
+        https://bugs.webkit.org/show_bug.cgi?id=218145
+
+        Reviewed by Antti Koivisto.
+
+        BoxGeometry represents the layout node both as a box relative to the containing block (BoxGeometry::logicalRect(), logicalLeft(), logicalWidth())
+        and as a box relative to the border box (BoxGeometry::marginBox(), paddingBox(), contentBox()).
+        These 2 sets of geometries may be confusing in certain cases, e.g. logicalWidth() does not say whether it's border, padding or content box.
+        BoxGometry is mostly used as a box relative to the border box (0, 0, border box width, border box height) so let's make the other set as a
+        static API.
+
+        * display/DisplayTreeBuilder.cpp:
+        (WebCore::Display::TreeBuilder::build const):
+        (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):
+        (WebCore::Display::TreeBuilder::displayBoxForRootBox const):
+        (WebCore::Display::TreeBuilder::displayBoxForLayoutBox const):
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
+        (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
+        (WebCore::Layout::FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned const):
+        (WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider):
+        (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear):
+        (WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::staticVerticalPosition const):
+        * layout/flexformatting/FlexFormattingContext.cpp:
+        (WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
+        * layout/floats/FloatingContext.cpp:
+        (WebCore::Layout::FloatingContext::positionForFloat const):
+        (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const):
+        (WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const):
+        (WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const):
+        * layout/floats/FloatingState.h:
+        (WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
+        (WebCore::Layout::FloatingState::FloatItem::bottom const):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::inlineItemWidth const):
+        * layout/layouttree/LayoutBoxGeometry.cpp:
+        (WebCore::Layout::BoxGeometry::borderBox const):
+        * layout/layouttree/LayoutBoxGeometry.h:
+        (WebCore::Layout::BoxGeometry::logicalTop):
+        (WebCore::Layout::BoxGeometry::logicalLeft):
+        (WebCore::Layout::BoxGeometry::logicalTopLeft):
+        (WebCore::Layout::BoxGeometry::borderRect):
+        (WebCore::Layout::BoxGeometry::marginRect):
+        (WebCore::Layout::BoxGeometry::logicalBottom const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalRight const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalBottomRight const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalSize const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalWidth const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalHeight const): Deleted.
+        (WebCore::Layout::BoxGeometry::isEmpty const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalRect const): Deleted.
+        (WebCore::Layout::BoxGeometry::logicalRectWithMargin const): Deleted.
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::outputLayoutBox):
+        * layout/tableformatting/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
+        * layout/tableformatting/TableFormattingContextGeometry.cpp:
+        (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
+        * layout/tableformatting/TableLayout.cpp:
+        (WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
+
 2020-10-23  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r260276): Unable to click on image and text link at the bottom of https://www.nytimes.com/ article

Modified: trunk/Source/WebCore/display/DisplayTreeBuilder.cpp (268947 => 268948)


--- trunk/Source/WebCore/display/DisplayTreeBuilder.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/display/DisplayTreeBuilder.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -67,8 +67,8 @@
     if (!rootLayoutBox.firstChild())
         return makeUnique<Tree>(WTFMove(rootDisplayContainerBox));
 
-    auto borderBox = LayoutRect { geometry.logicalRect() };
-    auto offset = toLayoutSize(borderBox.location());
+    auto borderBoxRect = LayoutRect { Layout::BoxGeometry::borderBoxRect(geometry) };
+    auto offset = toLayoutSize(borderBoxRect.location());
     recursiveBuildDisplayTree(layoutState, offset, *rootLayoutBox.firstChild(), *rootDisplayContainerBox);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "Display tree:\n" << displayTreeAsText(*rootDisplayContainerBox));
@@ -124,8 +124,8 @@
     if (!layoutContainerBox.hasChild())
         return result;
 
-    auto borderBox = LayoutRect { geometry.logicalRect() };
-    offsetFromRoot += toLayoutSize(borderBox.location());
+    auto borderBoxRect = LayoutRect { Layout::BoxGeometry::borderBoxRect(geometry) };
+    offsetFromRoot += toLayoutSize(borderBoxRect.location());
 
     auto& displayContainerBox = downcast<ContainerBox>(*result);
 
@@ -146,18 +146,18 @@
 std::unique_ptr<Box> TreeBuilder::displayBoxForRootBox(const Layout::BoxGeometry& geometry, const Layout::ContainerBox& rootBox) const
 {
     // FIXME: Need to do logical -> physical coordinate mapping here.
-    auto borderBox = LayoutRect { geometry.logicalRect() };
+    auto borderBoxRect = LayoutRect { Layout::BoxGeometry::borderBoxRect(geometry) };
 
     auto style = Style { rootBox.style() };
-    return makeUnique<ContainerBox>(snapRectToDevicePixels(borderBox, m_pixelSnappingFactor), WTFMove(style));
+    return makeUnique<ContainerBox>(snapRectToDevicePixels(borderBoxRect, m_pixelSnappingFactor), WTFMove(style));
 }
 
 std::unique_ptr<Box> TreeBuilder::displayBoxForLayoutBox(const Layout::BoxGeometry& geometry, const Layout::Box& layoutBox, LayoutSize offsetFromRoot) const
 {
     // FIXME: Need to map logical to physical rects.
-    auto borderBox = LayoutRect { geometry.logicalRect() };
-    borderBox.move(offsetFromRoot);
-    auto pixelSnappedBorderBox = snapRectToDevicePixels(borderBox, m_pixelSnappingFactor);
+    auto borderBoxRect = LayoutRect { Layout::BoxGeometry::borderBoxRect(geometry) };
+    borderBoxRect.move(offsetFromRoot);
+    auto pixelSnappedBorderBoxRect = snapRectToDevicePixels(borderBoxRect, m_pixelSnappingFactor);
 
     // FIXME: Handle isAnonymous()
     // FIXME: Do hoisting of <body> styles to the root where appropriate.
@@ -168,11 +168,11 @@
     if (is<Layout::ReplacedBox>(layoutBox)) {
         // FIXME: Wrong; geometry needs to vend the correct replaced content rect.
         auto replacedContentRect = LayoutRect { geometry.contentBoxLeft(), geometry.contentBoxTop(), geometry.contentBoxWidth(), geometry.contentBoxHeight() };
-        replacedContentRect.moveBy(borderBox.location());
+        replacedContentRect.moveBy(borderBoxRect.location());
         auto pixelSnappedReplacedContentRect = snapRectToDevicePixels(replacedContentRect, m_pixelSnappingFactor);
 
         // FIXME: Don't assume it's an image.
-        auto imageBox = makeUnique<ImageBox>(pixelSnappedBorderBox, WTFMove(style), pixelSnappedReplacedContentRect);
+        auto imageBox = makeUnique<ImageBox>(pixelSnappedBorderBoxRect, WTFMove(style), pixelSnappedReplacedContentRect);
 
         if (auto* cachedImage = downcast<Layout::ReplacedBox>(layoutBox).cachedImage())
             imageBox->setImage(cachedImage->image());
@@ -182,10 +182,10 @@
     
     if (is<Layout::ContainerBox>(layoutBox)) {
         // FIXME: The decision to make a ContainerBox should be made based on whether this Display::Box will have children.
-        return makeUnique<ContainerBox>(pixelSnappedBorderBox, WTFMove(style));
+        return makeUnique<ContainerBox>(pixelSnappedBorderBoxRect, WTFMove(style));
     }
 
-    return makeUnique<Box>(snapRectToDevicePixels(borderBox, m_pixelSnappingFactor), WTFMove(style));
+    return makeUnique<Box>(snapRectToDevicePixels(borderBoxRect, m_pixelSnappingFactor), WTFMove(style));
 }
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -294,7 +294,7 @@
         if (layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplacedBox()) {
             // top + margin-top + border-top-width + padding-top + height + padding-bottom + border-bottom-width + margin-bottom + bottom = height of containing block
             auto containingBlockHeight = containingBlockGeometry.contentBoxHeight();
-            ASSERT(boxGeometry.logicalTop() + boxGeometry.marginBefore() + boxGeometry.borderTop() + boxGeometry.paddingTop().valueOr(0) + boxGeometry.contentBoxHeight()
+            ASSERT(BoxGeometry::borderBoxTop(boxGeometry) + boxGeometry.marginBefore() + boxGeometry.borderTop() + boxGeometry.paddingTop().valueOr(0) + boxGeometry.contentBoxHeight()
                 + boxGeometry.paddingBottom().valueOr(0) + boxGeometry.borderBottom() + boxGeometry.marginAfter() == containingBlockHeight);
         }
     }

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -209,8 +209,8 @@
         if (formattingContextRoot.hasInFlowChild()) {
             auto& firstBoxGeometry = formattingContext.geometryForBox(*formattingContextRoot.firstInFlowChild(), EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
             auto& lastBoxGeometry = formattingContext.geometryForBox(*formattingContextRoot.lastInFlowChild(), EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
-            top = firstBoxGeometry.logicalRectWithMargin().top();
-            bottom = lastBoxGeometry.logicalRectWithMargin().bottom();
+            top = BoxGeometry::marginBoxRect(firstBoxGeometry).top();
+            bottom = BoxGeometry::marginBoxRect(lastBoxGeometry).bottom();
         }
     } else
         ASSERT_NOT_REACHED();
@@ -288,7 +288,7 @@
         auto& formattingState = downcast<BlockFormattingState>(layoutState().formattingStateForBox(previousInFlowSibling));
         auto usedVerticalMarginForPreviousBox = formattingState.usedVerticalMargin(previousInFlowSibling);
 
-        top += previousInFlowBoxGeometry.logicalBottom() + usedVerticalMarginForPreviousBox.nonCollapsedValues.after;
+        top += BoxGeometry::borderBoxRect(previousInFlowBoxGeometry).bottom() + usedVerticalMarginForPreviousBox.nonCollapsedValues.after;
     } else
         top = formattingContext.geometryForBox(layoutBox.parent(), EscapeReason::OutOfFlowBoxNeedsInFlowGeometry).contentBoxTop();
 
@@ -298,7 +298,7 @@
     for (auto* ancestor = &layoutBox.parent(); ancestor != &containingBlock; ancestor = &ancestor->containingBlock()) {
         auto& boxGeometry = formattingContext.geometryForBox(*ancestor, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);
         // BoxGeometry::top is the border box top position in its containing block's coordinate system.
-        top += boxGeometry.logicalTop();
+        top += BoxGeometry::borderBoxTop(boxGeometry);
         ASSERT(!ancestor->isPositioned() || layoutBox.isFixedPositioned());
     }
     // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes.
@@ -320,7 +320,7 @@
     for (auto* ancestor = &layoutBox.parent(); ancestor != &containingBlock; ancestor = &ancestor->containingBlock()) {
         auto& boxGeometry = formattingContext.geometryForBox(*ancestor, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);
         // BoxGeometry::left is the border box left position in its containing block's coordinate system.
-        left += boxGeometry.logicalLeft();
+        left += BoxGeometry::borderBoxLeft(boxGeometry);
         ASSERT(!ancestor->isPositioned() || layoutBox.isFixedPositioned());
     }
     // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes.
@@ -826,8 +826,8 @@
             height = 0_lu;
         else if (layoutBox.isDocumentBox() && !layoutBox.establishesFormattingContext()) {
             auto& documentBox = downcast<ContainerBox>(layoutBox);
-            auto top = formattingContext().geometryForBox(*documentBox.firstInFlowChild()).logicalRectWithMargin().top();
-            auto bottom = formattingContext().geometryForBox(*documentBox.lastInFlowChild()).logicalRectWithMargin().bottom();
+            auto top = BoxGeometry::marginBoxRect(formattingContext().geometryForBox(*documentBox.firstInFlowChild())).top();
+            auto bottom = BoxGeometry::marginBoxRect(formattingContext().geometryForBox(*documentBox.lastInFlowChild())).bottom();
             // This is a special (quirk?) behavior since the document box is not a formatting context root and
             // all the float boxes end up at the ICB level.
             auto& initialContainingBlock = documentBox.formattingContextRoot();
@@ -964,7 +964,7 @@
         height = replacedBox.intrinsicHeight();
     } else if (heightIsAuto && replacedBox.hasIntrinsicRatio()) {
         // #3
-        auto usedWidth = formattingContext.geometryForBox(replacedBox).logicalWidth();
+        auto usedWidth = formattingContext.geometryForBox(replacedBox).contentBoxWidth();
         height = usedWidth / replacedBox.intrinsicRatio();
     } else if (heightIsAuto && replacedBox.hasIntrinsicHeight()) {
         // #4

Modified: trunk/Source/WebCore/layout/Verification.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/Verification.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/Verification.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -179,7 +179,7 @@
 
     auto renderBoxLikeMarginBox = [&] (const auto& boxGeometry) {
         if (layoutBox.isInitialContainingBlock())
-            return boxGeometry.logicalRect();
+            return BoxGeometry::borderBoxRect(boxGeometry);
 
         // Produce a RenderBox matching margin box.
         auto containingBlockWidth = layoutState.geometryForBox(layoutBox.containingBlock()).contentBoxWidth();
@@ -220,7 +220,7 @@
         // When the <table> is out-of-flow positioned, the wrapper table box has the offset
         // while the actual table box is static, inflow.
         auto& tableWrapperBoxGeometry = layoutState.geometryForBox(layoutBox.containingBlock());
-        boxGeometry.moveBy(tableWrapperBoxGeometry.logicalTopLeft());
+        boxGeometry.moveBy(BoxGeometry::borderBoxTopLeft(tableWrapperBoxGeometry));
         // Table wrapper box has the margin values for the table.
         boxGeometry.setHorizontalMargin(tableWrapperBoxGeometry.horizontalMargin());
         boxGeometry.setVerticalMargin(tableWrapperBoxGeometry.verticalMargin());
@@ -234,8 +234,8 @@
         if (is<RenderTableSection>(renderer) && (downcast<RenderTableSection>(renderer).table()->collapseBorders() || renderer.style().hasBorder()))
             return false;
     }
-    if (!areEssentiallyEqual(frameRect, boxGeometry.logicalRect())) {
-        outputRect("frameBox", renderer.frameRect(), boxGeometry.logicalRect());
+    if (!areEssentiallyEqual(frameRect, BoxGeometry::borderBoxRect(boxGeometry))) {
+        outputRect("frameBox", renderer.frameRect(), BoxGeometry::borderBoxRect(boxGeometry));
         return true;
     }
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -182,9 +182,9 @@
     precomputeVerticalPositionForBoxAndAncestors(layoutBox, constraintsPair);
 
     auto logicalTopInFormattingContextRootCoordinate = [&] (auto& floatAvoider) {
-        auto top = geometryForBox(floatAvoider).logicalTop();
+        auto top = BoxGeometry::borderBoxTop(geometryForBox(floatAvoider));
         for (auto* ancestor = &floatAvoider.containingBlock(); ancestor != &root(); ancestor = &ancestor->containingBlock())
-            top += geometryForBox(*ancestor).logicalTop();
+            top += BoxGeometry::borderBoxTop(geometryForBox(*ancestor));
         return top;
     };
 
@@ -193,7 +193,7 @@
             return FloatingContext::Constraints { };
         auto offset = LayoutSize { };
         for (auto* ancestor = &layoutBox.containingBlock(); ancestor != &root(); ancestor = &ancestor->containingBlock())
-            offset += toLayoutSize(geometryForBox(*ancestor).logicalTopLeft());
+            offset += toLayoutSize(BoxGeometry::borderBoxTopLeft(geometryForBox(*ancestor)));
         if (floatConstraints.left)
             floatConstraints.left = PointInContextRoot { *floatConstraints.left - offset };
         if (floatConstraints.right)
@@ -308,7 +308,7 @@
         return;
 
     auto& boxGeometry = formattingState().boxGeometry(layoutBox);
-    ASSERT(verticalPositionAndClearance->position >= boxGeometry.logicalTop());
+    ASSERT(verticalPositionAndClearance->position >= BoxGeometry::borderBoxTop(boxGeometry));
     boxGeometry.setLogicalTop(verticalPositionAndClearance->position);
     if (verticalPositionAndClearance->clearance)
         formattingState().setHasClearance(layoutBox);
@@ -476,7 +476,7 @@
     // 4. Go to previous box and start from step #1 until we hit the parent box.
     auto& boxGeometry = geometryForBox(layoutBox);
     if (formattingState().hasClearance(layoutBox))
-        return boxGeometry.logicalTop();
+        return BoxGeometry::borderBoxTop(boxGeometry);
 
     auto* currentLayoutBox = &layoutBox;
     while (currentLayoutBox) {
@@ -485,12 +485,12 @@
         auto& previousInFlowSibling = *currentLayoutBox->previousInFlowSibling();
         if (!marginCollapse().marginBeforeCollapsesWithPreviousSiblingMarginAfter(*currentLayoutBox)) {
             auto& previousBoxGeometry = geometryForBox(previousInFlowSibling);
-            return previousBoxGeometry.logicalRectWithMargin().bottom() + marginBefore(verticalMargin);
+            return BoxGeometry::marginBoxRect(previousBoxGeometry).bottom() + marginBefore(verticalMargin);
         }
 
         if (!marginCollapse().marginsCollapseThrough(previousInFlowSibling)) {
             auto& previousBoxGeometry = geometryForBox(previousInFlowSibling);
-            return previousBoxGeometry.logicalBottom() + marginBefore(verticalMargin);
+            return BoxGeometry::borderBoxRect(previousBoxGeometry).bottom() + marginBefore(verticalMargin);
         }
         currentLayoutBox = &previousInFlowSibling;
     }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -88,7 +88,7 @@
         auto& lastInFlowChild = *layoutContainer.lastInFlowChild();
         if (!formattingContext().marginCollapse().marginAfterCollapsesWithParentMarginAfter(lastInFlowChild)) {
             auto& lastInFlowBoxGeometry = formattingContext().geometryForBox(lastInFlowChild);
-            auto bottomEdgeOfBottomMargin = lastInFlowBoxGeometry.logicalBottom() + lastInFlowBoxGeometry.marginAfter(); 
+            auto bottomEdgeOfBottomMargin = BoxGeometry::borderBoxRect(lastInFlowBoxGeometry).bottom() + lastInFlowBoxGeometry.marginAfter();
             return { bottomEdgeOfBottomMargin - borderAndPaddingTop, nonCollapsedMargin };
         }
 
@@ -98,7 +98,7 @@
             inFlowChild = inFlowChild->previousInFlowSibling();
         if (inFlowChild) {
             auto& inFlowBoxGeometry = formattingContext().geometryForBox(*inFlowChild);
-            return { inFlowBoxGeometry.logicalTop() + inFlowBoxGeometry.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin };
+            return { BoxGeometry::borderBoxTop(inFlowBoxGeometry) + inFlowBoxGeometry.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin };
         }
 
         // 4. zero, otherwise
@@ -238,7 +238,7 @@
     // Vertical margins between adjacent block-level boxes in a block formatting context collapse.
     if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
         auto& previousInFlowBoxGeometry = formattingContext().geometryForBox(*previousInFlowSibling);
-        return previousInFlowBoxGeometry.logicalBottom() + previousInFlowBoxGeometry.marginAfter();
+        return BoxGeometry::borderBoxRect(previousInFlowBoxGeometry).bottom() + previousInFlowBoxGeometry.marginAfter();
     }
     return verticalConstraints.logicalTop;
 }

Modified: trunk/Source/WebCore/layout/flexformatting/FlexFormattingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/flexformatting/FlexFormattingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/flexformatting/FlexFormattingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -91,8 +91,8 @@
 
             flexItemGeometry.setContentBoxHeight(geometry.contentHeightForFormattingContextRoot(flexItem));
             flexItemGeometry.setContentBoxWidth(flexItemLogicalWidth);
-            flexItemMainAxisEnd= flexItemGeometry.logicalRight();
-            flexItemCrosAxisEnd = std::max(flexItemCrosAxisEnd, flexItemGeometry.logicalBottom());
+            flexItemMainAxisEnd= BoxGeometry::borderBoxRect(flexItemGeometry).right();
+            flexItemCrosAxisEnd = std::max(flexItemCrosAxisEnd, BoxGeometry::borderBoxRect(flexItemGeometry).bottom());
         };
         computeFlexItemGeometry();
     }

Modified: trunk/Source/WebCore/layout/floats/FloatingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/floats/FloatingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -229,10 +229,10 @@
             // If there is no floating to align with, push the box to the left/right edge of its containing block's content box.
             if (layoutBox.isLeftFloatingPositioned())
                 return { horizontalConstraints.logicalLeft + boxGeometry.marginStart() };
-            return { horizontalConstraints.logicalRight() - boxGeometry.marginEnd() - boxGeometry.logicalWidth() };
+            return { horizontalConstraints.logicalRight() - boxGeometry.marginEnd() - boxGeometry.borderBoxWidth() };
         };
         // No float box on the context yet -> align it with the containing block's left/right edge.
-        return { alignWithContainingBlock(), boxGeometry.logicalTop() };
+        return { alignWithContainingBlock(), BoxGeometry::borderBoxTop(boxGeometry) };
     }
 
     // Find the top most position where the float box fits.
@@ -269,7 +269,7 @@
     absoluteTopLeft.setY(verticalPositionCandidate);
     auto horizontalMargin = computedHorizontalMargin(layoutBox, horizontalConstraints.logicalWidth);
     auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { boxGeometry.marginBefore(), boxGeometry.marginAfter() } };
-    auto floatBox = FloatAvoider { layoutBox, absoluteTopLeft, boxGeometry.logicalWidth(), margins, absoluteCoordinates.containingBlockContentBox };
+    auto floatBox = FloatAvoider { layoutBox, absoluteTopLeft, boxGeometry.borderBoxWidth(), margins, absoluteCoordinates.containingBlockContentBox };
     findAvailablePosition(floatBox, m_floatingState.floats());
     // Convert box coordinates from formatting root back to containing block.
     auto containingBlockTopLeft = absoluteCoordinates.containingBlockTopLeft;
@@ -284,13 +284,13 @@
     ASSERT(areFloatsHorizontallySorted(m_floatingState));
 
     if (isEmpty())
-        return formattingContext().geometryForBox(layoutBox).logicalTopLeft();
+        return BoxGeometry::borderBoxTopLeft(formattingContext().geometryForBox(layoutBox));
 
     auto absoluteCoordinates = this->absoluteCoordinates(layoutBox);
     auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
     auto horizontalMargin = computedHorizontalMargin(layoutBox, horizontalConstraints.logicalWidth);
     auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { boxGeometry.marginBefore(), boxGeometry.marginAfter() } };
-    auto floatAvoider = FloatAvoider { layoutBox, absoluteCoordinates.topLeft, boxGeometry.logicalWidth(), margins, absoluteCoordinates.containingBlockContentBox };
+    auto floatAvoider = FloatAvoider { layoutBox, absoluteCoordinates.topLeft, boxGeometry.borderBoxWidth(), margins, absoluteCoordinates.containingBlockContentBox };
     findPositionForFormattingContextRoot(floatAvoider);
     auto containingBlockTopLeft = absoluteCoordinates.containingBlockTopLeft;
     return { floatAvoider.left() - containingBlockTopLeft.x(), floatAvoider.top() - containingBlockTopLeft.y() };
@@ -509,9 +509,9 @@
 LayoutPoint FloatingContext::mapTopLeftToFloatingStateRoot(const Box& floatBox) const
 {
     auto& floatingStateRoot = floatingState().root();
-    auto topLeft = formattingContext().geometryForBox(floatBox, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot).logicalTopLeft();
+    auto topLeft = BoxGeometry::borderBoxTopLeft(formattingContext().geometryForBox(floatBox, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot));
     for (auto* containingBlock = &floatBox.containingBlock(); containingBlock != &floatingStateRoot; containingBlock = &containingBlock->containingBlock())
-        topLeft.moveBy(formattingContext().geometryForBox(*containingBlock, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot).logicalTopLeft());
+        topLeft.moveBy(BoxGeometry::borderBoxTopLeft(formattingContext().geometryForBox(*containingBlock, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot)));
     return topLeft;
 }
 
@@ -523,7 +523,7 @@
         return position;
     auto mappedPosition = position;
     for (auto* containingBlock = &from; containingBlock != &to; containingBlock = &containingBlock->containingBlock())
-        mappedPosition.moveBy(formattingContext().geometryForBox(*containingBlock, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot).logicalTopLeft());
+        mappedPosition.moveBy(BoxGeometry::borderBoxTopLeft(formattingContext().geometryForBox(*containingBlock, FormattingContext::EscapeReason::FloatBoxIsAlwaysRelativeToFloatStateRoot)));
     return mappedPosition;
 }
 

Modified: trunk/Source/WebCore/layout/floats/FloatingState.h (268947 => 268948)


--- trunk/Source/WebCore/layout/floats/FloatingState.h	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/floats/FloatingState.h	2020-10-24 12:43:21 UTC (rev 268948)
@@ -62,9 +62,9 @@
         bool isLeftPositioned() const { return m_position == Position::Left; }
         bool isInFormattingContextOf(const ContainerBox& formattingContextRoot) const { return m_layoutBox->isInFormattingContextOf(formattingContextRoot); }
 
-        Rect rectWithMargin() const { return m_absoluteBoxGeometry.logicalRectWithMargin(); }
+        Rect rectWithMargin() const { return BoxGeometry::marginBoxRect(m_absoluteBoxGeometry); }
         BoxGeometry::HorizontalMargin horizontalMargin() const { return m_absoluteBoxGeometry.horizontalMargin(); }
-        PositionInContextRoot bottom() const { return { m_absoluteBoxGeometry.logicalBottom() }; }
+        PositionInContextRoot bottom() const { return { BoxGeometry::borderBoxRect(m_absoluteBoxGeometry).bottom() }; }
 
 #if ASSERT_ENABLED
         const Box* floatBox() const { return m_layoutBox.get(); }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -485,7 +485,7 @@
                 continue;
             }
             // This is a just a simple box geometry for the line spanning inline box. getBoundingClientRect looks into each line boxes (will turn into fragmented boxes).
-            boxGeometry.setLogicalLeft(std::min(boxGeometry.logicalLeft(), toLayoutUnit(borderBoxLogicalTopLeft.x())));
+            boxGeometry.setLogicalLeft(std::min(BoxGeometry::borderBoxLeft(boxGeometry), toLayoutUnit(borderBoxLogicalTopLeft.x())));
             boxGeometry.setContentBoxWidth(std::max(toLayoutUnit(contentBoxWidth), boxGeometry.contentBoxWidth()));
             boxGeometry.setContentBoxHeight(boxGeometry.contentBoxHeight() + toLayoutUnit(logicalRect.height()));
         }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -241,7 +241,7 @@
         return boxGeometry.marginBoxWidth();
 
     if (layoutBox.isReplacedBox())
-        return boxGeometry.logicalWidth();
+        return boxGeometry.borderBoxWidth();
 
     if (inlineItem.isContainerStart())
         return boxGeometry.marginStart() + boxGeometry.borderLeft() + boxGeometry.paddingLeft().valueOr(0);
@@ -250,7 +250,7 @@
         return boxGeometry.marginEnd() + boxGeometry.borderRight() + boxGeometry.paddingRight().valueOr(0);
 
     // Non-replaced inline box (e.g. inline-block)
-    return boxGeometry.logicalWidth();
+    return boxGeometry.borderBoxWidth();
 }
 
 LineBuilder::LineBuilder(const InlineFormattingContext& inlineFormattingContext, const FloatingContext& floatingContext, const ContainerBox& formattingContextRoot, const InlineItems& inlineItems)

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -77,7 +77,7 @@
 {
     Rect borderBox;
     borderBox.setTopLeft({ });
-    borderBox.setSize({ logicalWidth(), logicalHeight() });
+    borderBox.setSize({ borderBoxWidth(), borderBoxHeight() });
     return borderBox;
 }
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h (268947 => 268948)


--- trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h	2020-10-24 12:43:21 UTC (rev 268948)
@@ -41,21 +41,12 @@
     BoxGeometry() = default;
     ~BoxGeometry();
 
-    LayoutUnit logicalTop() const;
-    LayoutUnit logicalLeft() const;
-    LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
-    LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
+    static LayoutUnit borderBoxTop(const BoxGeometry& box) { return box.logicalTop(); }
+    static LayoutUnit borderBoxLeft(const BoxGeometry& box) { return box.logicalLeft(); }
+    static LayoutPoint borderBoxTopLeft(const BoxGeometry& box) { return box.logicalTopLeft(); }
+    static Rect borderBoxRect(const BoxGeometry& box) { return { box.logicalTop(), box.logicalLeft(), box.borderBoxWidth(), box.borderBoxHeight() }; }
+    static Rect marginBoxRect(const BoxGeometry& box) { return { box.logicalTop() - box.marginBefore(), box.logicalLeft() - box.marginStart(), box.marginBoxWidth(), box.marginBoxHeight() }; }
 
-    LayoutPoint logicalTopLeft() const;
-    LayoutPoint logicalBottomRight() const { return { logicalRight(), logicalBottom() }; }
-
-    LayoutSize logicalSize() const { return { logicalWidth(), logicalHeight() }; }
-    LayoutUnit logicalWidth() const { return borderLeft() + paddingBoxWidth() + borderRight(); }
-    LayoutUnit logicalHeight() const { return borderTop() + paddingBoxHeight() + borderBottom(); }
-    bool isEmpty() const { return logicalSize().isEmpty(); }
-    Rect logicalRect() const { return { logicalTop(), logicalLeft(), logicalWidth(), logicalHeight() }; }
-    Rect logicalRectWithMargin() const { return { logicalTop() - marginBefore(), logicalLeft() - marginStart(), marginStart() + logicalWidth() + marginEnd(), marginBefore() + logicalHeight() + marginAfter() }; }
-
     struct VerticalMargin {
         LayoutUnit before;
         LayoutUnit after;
@@ -137,6 +128,10 @@
     void setPadding(Optional<Layout::Edges>);
 
 private:
+    LayoutUnit logicalTop() const;
+    LayoutUnit logicalLeft() const;
+    LayoutPoint logicalTopLeft() const;
+
 #if ASSERT_ENABLED
     void invalidateMargin();
     void invalidateBorder() { m_hasValidBorder = false; }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -469,8 +469,10 @@
     else
         stream << "unknown box";
 
-    if (boxGeometry)
-        stream << " at (" << boxGeometry->logicalLeft() << "," << boxGeometry->logicalTop() << ") size " << boxGeometry->logicalWidth() << "x" << boxGeometry->logicalHeight();
+    if (boxGeometry) {
+        auto borderBox = BoxGeometry::borderBoxRect(*boxGeometry);
+        stream << " at (" << borderBox.left() << "," << borderBox.top() << ") size " << borderBox.width() << "x" << borderBox.height();
+    }
     stream << " (" << &layoutBox << ")";
     if (is<InlineTextBox>(layoutBox)) {
         auto textContent = downcast<InlineTextBox>(layoutBox).content();

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -245,7 +245,7 @@
         auto sectionContentHeight = LayoutUnit { };
         size_t rowCount = 0;
         for (auto& rowBox : childrenOfType<ContainerBox>(sectionBox)) {
-            sectionContentHeight += geometryForBox(rowBox).logicalHeight();
+            sectionContentHeight += geometryForBox(rowBox).borderBoxHeight();
             ++rowCount;
         }
         sectionContentHeight += verticalSpacing * (rowCount - 1);
@@ -253,7 +253,7 @@
         sectionBoxGeometry.setLogicalLeft(constraints.horizontal.logicalLeft);
         sectionBoxGeometry.setLogicalTop(logicalTop);
 
-        logicalTop += sectionBoxGeometry.logicalHeight();
+        logicalTop += sectionBoxGeometry.borderBoxHeight();
     }
 }
 

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -50,8 +50,8 @@
         auto& firstInFlowChildGeometry = formattingContext.geometryForBox(firstInFlowChild, EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
         auto& lastInFlowChildGeometry = formattingContext.geometryForBox(lastInFlowChild, EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
 
-        auto top = firstInFlowChild.style().hasMarginBeforeQuirk() ? firstInFlowChildGeometry.logicalTop() : firstInFlowChildGeometry.logicalRectWithMargin().top();
-        auto bottom = lastInFlowChild.style().hasMarginAfterQuirk() ? lastInFlowChildGeometry.logicalBottom() : lastInFlowChildGeometry.logicalRectWithMargin().bottom();
+        auto top = firstInFlowChild.style().hasMarginBeforeQuirk() ? BoxGeometry::borderBoxRect(firstInFlowChildGeometry).top() : BoxGeometry::marginBoxRect(firstInFlowChildGeometry).top();
+        auto bottom = lastInFlowChild.style().hasMarginAfterQuirk() ? BoxGeometry::borderBoxRect(lastInFlowChildGeometry).bottom() : BoxGeometry::marginBoxRect(lastInFlowChildGeometry).bottom();
         contentHeight = bottom - top;
     } else
         contentHeight = contentHeightForFormattingContextRoot(cellBox);

Modified: trunk/Source/WebCore/layout/tableformatting/TableLayout.cpp (268947 => 268948)


--- trunk/Source/WebCore/layout/tableformatting/TableLayout.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/layout/tableformatting/TableLayout.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -279,7 +279,7 @@
             // linebox containing the cells originating in the row.
             auto& cell = slot.cell();
             auto& cellBox = cell.box();
-            auto height = formattingContext().geometryForBox(cellBox).logicalHeight();
+            auto height = formattingContext().geometryForBox(cellBox).borderBoxHeight();
             if (cellBox.style().verticalAlign() == VerticalAlign::Baseline) {
                 maximumColumnAscent = std::max(maximumColumnAscent, cell.baseline());
                 maximumColumnDescent = std::max(maximumColumnDescent, height - cell.baseline());
@@ -296,7 +296,7 @@
     // Distribute extra space if the table is supposed to be taller than the sum of the row heights.
     return distributeAvailableSpace<RowSpan>(m_grid, availableSpace, [&] (const TableGrid::Slot& slot, size_t rowIndex) {
         if (slot.hasRowSpan())
-            return GridSpace { formattingContext().geometryForBox(slot.cell().box()).logicalHeight(), formattingContext().geometryForBox(slot.cell().box()).logicalHeight() };
+            return GridSpace { formattingContext().geometryForBox(slot.cell().box()).borderBoxHeight(), formattingContext().geometryForBox(slot.cell().box()).borderBoxHeight() };
         auto& rows = m_grid.rows();
         auto computedRowHeight = formattingContext().geometry().computedHeight(rows.list()[rowIndex].box(), { });
         auto height = std::max<float>(rowHeight[rowIndex], computedRowHeight.valueOr(0_lu));

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (268947 => 268948)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2020-10-24 06:30:39 UTC (rev 268947)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2020-10-24 12:43:21 UTC (rev 268948)
@@ -73,7 +73,7 @@
 
     // Clean up the render tree state when we don't run RenderView::layout.
     if (renderView.needsLayout()) {
-        auto contentSize = m_layoutState->geometryForBox(*m_layoutState->root().firstChild()).logicalSize();
+        auto contentSize = Layout::BoxGeometry::marginBoxRect(m_layoutState->geometryForBox(*m_layoutState->root().firstChild())).size();
         renderView.setSize(contentSize);
         renderView.repaintViewRectangle({ 0, 0, contentSize.width(), contentSize.height() });
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to