Title: [284793] trunk
Revision
284793
Author
[email protected]
Date
2021-10-25 10:52:41 -0700 (Mon, 25 Oct 2021)

Log Message

[CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
https://bugs.webkit.org/show_bug.cgi?id=232140

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Update the test expectation file for the following tests. These tests are now passing.
* web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt:
* web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt:
* web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt:

Source/WebCore:

For a child with relative width constraints to the grid area, such as percentaged paddings, we reset the
overridingContainingBlockContentSizeForChild value for columns when we are executing a definite strategy
for columns. Since we have updated the overridingContainingBlockContentSizeForChild inline-axis/width value
in GridTrackSizingAlgorithmStrategy::minContentForChild, we might need to recompute the child's relative
width. For some cases, we probably will not be able to do it during the RenderGrid::layoutGridItems() function
as the grid area does't change there any more. Since we are doing a layout inside
GridTrackSizingAlgorithmStrategy::logicalHeightForChild() function, this CL takes the advantage and set the
preferredLogicalWidth dirty before this layout call.

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284792 => 284793)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-25 17:52:41 UTC (rev 284793)
@@ -1,3 +1,15 @@
+2021-10-25  Ziran Sun  <[email protected]>
+
+        [CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
+        https://bugs.webkit.org/show_bug.cgi?id=232140
+
+        Reviewed by Sergio Villar Senin.
+
+        Update the test expectation file for the following tests. These tests are now passing.
+        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt:
+        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt:
+        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt:
+
 2021-10-25  Tim Nguyen  <[email protected]>
 
         Fix imported/w3c/web-platform-tests/css/selectors/focus-visible-009.html flaky failure on macOS wk1

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt (284792 => 284793)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt	2021-10-25 17:52:41 UTC (rev 284793)
@@ -1,30 +1,10 @@
 
-FAIL .grid 1 assert_equals:
-<div class="grid">
-  <div class="paddingLeft50Percent" data-expected-padding-left="50" data-expected-width="60" data-expected-height="10">X</div>
-  <div data-offset-x="0" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
-</div>
-width expected 60 but got 50
-FAIL .grid 2 assert_equals:
-<div class="grid">
-  <div class="paddingRight50Percent" data-expected-padding-right="50" data-expected-width="60" data-expected-height="10">X</div>
-  <div data-offset-x="0" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
-</div>
-width expected 60 but got 50
+PASS .grid 1
+PASS .grid 2
 PASS .grid 3
 PASS .grid 4
-FAIL .grid 5 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingLeft50Percent" data-expected-padding-left="50" data-expected-width="60" data-expected-height="10">X</div>
-  <div data-offset-x="400" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
-</div>
-width expected 60 but got 50
-FAIL .grid 6 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingRight50Percent" data-expected-padding-right="50" data-expected-width="60" data-expected-height="10">X</div>
-  <div data-offset-x="400" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
-</div>
-width expected 60 but got 50
+PASS .grid 5
+PASS .grid 6
 PASS .grid 7
 PASS .grid 8
 Direction LTR

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt (284792 => 284793)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt	2021-10-25 17:52:41 UTC (rev 284793)
@@ -1,32 +1,12 @@
 
 PASS .grid 1
 PASS .grid 2
-FAIL .grid 3 assert_equals:
-<div class="grid">
-  <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="10" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
-FAIL .grid 4 assert_equals:
-<div class="grid">
-  <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="10" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
+PASS .grid 3
+PASS .grid 4
 PASS .grid 5
 PASS .grid 6
-FAIL .grid 7 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="10" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
-FAIL .grid 8 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="10" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
+PASS .grid 7
+PASS .grid 8
 Direction LTR
 
 Item padding-left: 50%;

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt (284792 => 284793)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt	2021-10-25 17:52:41 UTC (rev 284793)
@@ -1,32 +1,12 @@
 
 PASS .grid 1
 PASS .grid 2
-FAIL .grid 3 assert_equals:
-<div class="grid">
-  <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
-FAIL .grid 4 assert_equals:
-<div class="grid">
-  <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
+PASS .grid 3
+PASS .grid 4
 PASS .grid 5
 PASS .grid 6
-FAIL .grid 7 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="0" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
-FAIL .grid 8 assert_equals:
-<div class="grid directionRTL">
-  <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
-  <div data-offset-x="0" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
-</div>
-height expected 60 but got 50
+PASS .grid 7
+PASS .grid 8
 Direction LTR
 
 Item padding-left: 50%;

Modified: trunk/Source/WebCore/ChangeLog (284792 => 284793)


--- trunk/Source/WebCore/ChangeLog	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/Source/WebCore/ChangeLog	2021-10-25 17:52:41 UTC (rev 284793)
@@ -1,3 +1,22 @@
+2021-10-25  Ziran Sun  <[email protected]>
+
+        [CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
+        https://bugs.webkit.org/show_bug.cgi?id=232140
+
+        Reviewed by Sergio Villar Senin.
+
+        For a child with relative width constraints to the grid area, such as percentaged paddings, we reset the
+        overridingContainingBlockContentSizeForChild value for columns when we are executing a definite strategy
+        for columns. Since we have updated the overridingContainingBlockContentSizeForChild inline-axis/width value
+        in GridTrackSizingAlgorithmStrategy::minContentForChild, we might need to recompute the child's relative
+        width. For some cases, we probably will not be able to do it during the RenderGrid::layoutGridItems() function
+        as the grid area does't change there any more. Since we are doing a layout inside
+        GridTrackSizingAlgorithmStrategy::logicalHeightForChild() function, this CL takes the advantage and set the
+        preferredLogicalWidth dirty before this layout call.
+
+        * rendering/GridTrackSizingAlgorithm.cpp:
+        (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
+
 2021-10-25  Gabriel Nava Marino  <[email protected]>
 
         ASSERT(node) triggered after surroundNodeRangeWithElement for node without editable style

Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (284792 => 284793)


--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp	2021-10-25 17:48:24 UTC (rev 284792)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp	2021-10-25 17:52:41 UTC (rev 284793)
@@ -809,8 +809,15 @@
         return child.minPreferredLogicalWidth() + GridLayoutFunctions::marginLogicalSizeForChild(*renderGrid(), childInlineDirection, child) + m_algorithm.baselineOffsetForChild(child, gridAxisForDirection(direction()));
     }
 
-    if (updateOverridingContainingBlockContentSizeForChild(child, childInlineDirection))
+    if (updateOverridingContainingBlockContentSizeForChild(child, childInlineDirection)) {
         child.setNeedsLayout(MarkOnlyThis);
+        // For a child with relative width constraints to the grid area, such as percentaged paddings, we reset the overridingContainingBlockContentSizeForChild value for columns when we are executing a definite strategy
+        // for columns. Since we have updated the overridingContainingBlockContentSizeForChild inline-axis/width value here, we might need to recompute the child's relative width. For some cases, we probably will not
+        // be able to do it during the RenderGrid::layoutGridItems() function as the grid area does't change there any more. Also, as we are doing a layout inside GridTrackSizingAlgorithmStrategy::logicalHeightForChild()
+        // function, let's take the advantage and set it here. 
+        if (shouldClearOverridingContainingBlockContentSizeForChild(child, childInlineDirection))
+            child.setPreferredLogicalWidthsDirty(true);
+    }
     return logicalHeightForChild(child);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to