Title: [289132] trunk/Source/WebCore
Revision
289132
Author
[email protected]
Date
2022-02-04 11:36:13 -0800 (Fri, 04 Feb 2022)

Log Message

[LFC][Integration] Input geometry to layout (BoxGeometry) should be all logical
https://bugs.webkit.org/show_bug.cgi?id=236120

Reviewed by Antti Koivisto.

Now (after adding support for inline base direction), it's clear that BoxGeometry, as input to inline line layout,
should hold logical values only (this is somewhat of a revert of r269818).
It also fixes ~40 tests under imported/w3c/web-platform-tests/css/css-writing-modes.

(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions): We need logical vs. visual flip based on
in what writing direction the box lives in and not what it establishes for its descendants.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289131 => 289132)


--- trunk/Source/WebCore/ChangeLog	2022-02-04 19:19:42 UTC (rev 289131)
+++ trunk/Source/WebCore/ChangeLog	2022-02-04 19:36:13 UTC (rev 289132)
@@ -1,3 +1,17 @@
+2022-02-04  Alan Bujtas  <[email protected]>
+
+        [LFC][Integration] Input geometry to layout (BoxGeometry) should be all logical
+        https://bugs.webkit.org/show_bug.cgi?id=236120
+
+        Reviewed by Antti Koivisto.
+
+        Now (after adding support for inline base direction), it's clear that BoxGeometry, as input to inline line layout,
+        should hold logical values only (this is somewhat of a revert of r269818).
+        It also fixes ~40 tests under imported/w3c/web-platform-tests/css/css-writing-modes.
+
+        (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions): We need logical vs. visual flip based on
+        in what writing direction the box lives in and not what it establishes for its descendants.
+
 2022-02-04  Andres Gonzalez  <[email protected]>
 
         Cache some expensive AXIsolatedObject properties lazily.

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (289131 => 289132)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-04 19:19:42 UTC (rev 289131)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-04 19:36:13 UTC (rev 289132)
@@ -148,6 +148,16 @@
     updateLayoutBoxDimensions(inlineBlock);
 }
 
+static inline LayoutUnit contentLogicalWidthForRenderer(const RenderBox& renderer)
+{
+    return renderer.parent()->style().isHorizontalWritingMode() ? renderer.contentWidth() : renderer.contentHeight();
+}
+
+static inline LayoutUnit contentLogicalHeightForRenderer(const RenderBox& renderer)
+{
+    return renderer.parent()->style().isHorizontalWritingMode() ? renderer.contentHeight() : renderer.contentWidth();
+}
+
 static inline Layout::BoxGeometry::HorizontalMargin logicalMargin(const RenderBoxModelObject& renderer, bool isLeftToRightDirection, bool retainMarginStart = true, bool retainMarginEnd = true)
 {
     auto marginStart = LayoutUnit { 0_lu };
@@ -187,9 +197,7 @@
     // Internally both replaced and inline-box content use replaced boxes.
     auto& replacedBox = downcast<Layout::ReplacedBox>(layoutBox);
 
-    // Always use the physical size here for inline level boxes (this is where the logical vs. physical coords flip happens).
     auto& replacedBoxGeometry = m_layoutState.ensureGeometryForBox(replacedBox);
-
     // Scrollbars eat into the padding box area. They never stretch the border box but they may shrink the padding box.
     // In legacy render tree, RenderBox::contentWidth/contentHeight values are adjusted to accomodate the scrollbar width/height.
     // e.g. <div style="width: 10px; overflow: scroll;">content</div>, RenderBox::contentWidth() won't be returning the value of 10px but instead 0px (10px - 15px).
@@ -199,8 +207,8 @@
     auto verticalSpaceReservedForScrollbar = replacedOrInlineBlock.paddingBoxRectIncludingScrollbar().height() - replacedOrInlineBlock.paddingBoxHeight();
     replacedBoxGeometry.setVerticalSpaceForScrollbar(verticalSpaceReservedForScrollbar);
 
-    replacedBoxGeometry.setContentBoxWidth(replacedOrInlineBlock.contentWidth());
-    replacedBoxGeometry.setContentBoxHeight(replacedOrInlineBlock.contentHeight());
+    replacedBoxGeometry.setContentBoxWidth(contentLogicalWidthForRenderer(replacedOrInlineBlock));
+    replacedBoxGeometry.setContentBoxHeight(contentLogicalHeightForRenderer(replacedOrInlineBlock));
 
     replacedBoxGeometry.setVerticalMargin({ replacedOrInlineBlock.marginTop(), replacedOrInlineBlock.marginBottom() });
     auto isLeftToRightDirection = replacedOrInlineBlock.parent()->style().isLeftToRightDirection();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to