Title: [290032] trunk
Revision
290032
Author
commit-qu...@webkit.org
Date
2022-02-17 09:57:53 -0800 (Thu, 17 Feb 2022)

Log Message

Fix abs-pos breadth issue when using 'auto'
https://bugs.webkit.org/show_bug.cgi?id=236626

Patch by Matt Woodrow <mattwood...@apple.com> on 2022-02-17
Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Adds new test that uses RTL and abs-pos items over the padding area, with
padding defined in physical coords.

* web-platform-tests/css/css-grid/abspos/positioned-grid-items-025-expected.html: Added.
* web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html: Added.

Source/WebCore:

The value returned when resolving an 'auto' start/end is in logical coords, but the line
positions are in a hybrid space using logical column sizes, but physical border/padding offset.
This adjusts for this, so that we can compute the breadth correctly.

Adds new test that uses RTL and abs-pos items over the padding area, with
padding defined in physical coords.

Test: imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290031 => 290032)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-17 17:56:10 UTC (rev 290031)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-17 17:57:53 UTC (rev 290032)
@@ -1,3 +1,16 @@
+2022-02-17  Matt Woodrow  <mattwood...@apple.com>
+
+        Fix abs-pos breadth issue when using 'auto'
+        https://bugs.webkit.org/show_bug.cgi?id=236626
+
+        Reviewed by Dean Jackson.
+
+        Adds new test that uses RTL and abs-pos items over the padding area, with
+        padding defined in physical coords.
+
+        * web-platform-tests/css/css-grid/abspos/positioned-grid-items-025-expected.html: Added.
+        * web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html: Added.
+
 2022-02-16  Antoine Quint  <grao...@webkit.org>
 
         SVG SMIL restart="never" does not behave correctly

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025-expected.html (0 => 290032)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025-expected.html	2022-02-17 17:57:53 UTC (rev 290032)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="author" title="Matt Woodrow" href=""
+</head>
+<body>
+    <div style="background-color:blue; height: 100px; width: 50px;display: inline-block;"></div>
+    <div style="background-color:blue; height: 100px; width: 80px;position: relative;display: inline-block;left: 146px;"></div>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html (0 => 290032)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html	2022-02-17 17:57:53 UTC (rev 290032)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>CSS Grid Layout Test: Positioned grid items</title>
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="assert" content="Checks that absolutely positioned items are properly placed and sized.">
+<style>
+  #grid {
+    display: grid;
+    grid-template-columns: 50px 100px;
+    height: 100px;
+    width: 150px;
+    direction: rtl;
+    padding-left: 50px;
+    padding-right: 80px;
+    position: absolute;
+  }
+
+  #grid > div {
+    top: 0px;
+    right: 0px;
+    bottom: 0px;
+    left: 0px;
+    position: absolute;
+    background-color: blue;
+  }
+</style>
+
+</head><body><div id="grid">
+  <div style="grid-column: auto / 1;"></div>
+  <div style="grid-column: -1 / auto;"></div>
+</div>
+</body></html>

Modified: trunk/Source/WebCore/ChangeLog (290031 => 290032)


--- trunk/Source/WebCore/ChangeLog	2022-02-17 17:56:10 UTC (rev 290031)
+++ trunk/Source/WebCore/ChangeLog	2022-02-17 17:57:53 UTC (rev 290032)
@@ -1,3 +1,22 @@
+2022-02-17  Matt Woodrow  <mattwood...@apple.com>
+
+        Fix abs-pos breadth issue when using 'auto'
+        https://bugs.webkit.org/show_bug.cgi?id=236626
+
+        Reviewed by Dean Jackson.
+
+        The value returned when resolving an 'auto' start/end is in logical coords, but the line
+        positions are in a hybrid space using logical column sizes, but physical border/padding offset.
+        This adjusts for this, so that we can compute the breadth correctly.
+
+        Adds new test that uses RTL and abs-pos items over the padding area, with
+        padding defined in physical coords.
+
+        Test: imported/w3c/web-platform-tests/css/css-grid/abspos/positioned-grid-items-025.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
+
 2022-02-17  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         MediaPlayer::videoFrameForCurrentTime() should return VideoFrame

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (290031 => 290032)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2022-02-17 17:56:10 UTC (rev 290031)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2022-02-17 17:57:53 UTC (rev 290032)
@@ -1662,6 +1662,10 @@
     else {
         outOfFlowItemLine.set(&child, startLine);
         start = positions[startLine];
+        if (isRowAxis && !style().isLeftToRightDirection()) {
+            start -= borderAndPaddingLogicalLeft();
+            start += borderLogicalRight() + paddingLogicalRight();
+        }
     }
     if (endIsAuto)
         end = resolveAutoEndGridPosition(direction) + borderEdge;
@@ -1674,6 +1678,11 @@
             end -= guttersSize(m_grid, direction, endLine - 1, 2, availableSizeForGutters);
             end -= isRowAxis ? m_offsetBetweenColumns.distributionOffset : m_offsetBetweenRows.distributionOffset;
         }
+
+        if (isRowAxis && !style().isLeftToRightDirection()) {
+            end -= borderAndPaddingLogicalLeft();
+            end += borderLogicalRight() + paddingLogicalRight();
+        }
     }
     return std::max(end - start, 0_lu);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to