⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284793 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 10:52:41 AM (5 years ago)
Author:
Ziran Sun
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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r284774 r284793  
     12021-10-25  Ziran Sun  <zsun@igalia.com>
     2
     3        [CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
     4        https://bugs.webkit.org/show_bug.cgi?id=232140
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Update the test expectation file for the following tests. These tests are now passing.
     9        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt:
     10        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt:
     11        * web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt:
     12
    1132021-10-25  Tim Nguyen  <ntim@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-002-expected.txt

    r281662 r284793  
    11
    2 FAIL .grid 1 assert_equals:
    3 <div class="grid">
    4   <div class="paddingLeft50Percent" data-expected-padding-left="50" data-expected-width="60" data-expected-height="10">X</div>
    5   <div data-offset-x="0" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
    6 </div>
    7 width expected 60 but got 50
    8 FAIL .grid 2 assert_equals:
    9 <div class="grid">
    10   <div class="paddingRight50Percent" data-expected-padding-right="50" data-expected-width="60" data-expected-height="10">X</div>
    11   <div data-offset-x="0" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
    12 </div>
    13 width expected 60 but got 50
     2PASS .grid 1
     3PASS .grid 2
    144PASS .grid 3
    155PASS .grid 4
    16 FAIL .grid 5 assert_equals:
    17 <div class="grid directionRTL">
    18   <div class="paddingLeft50Percent" data-expected-padding-left="50" data-expected-width="60" data-expected-height="10">X</div>
    19   <div data-offset-x="400" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
    20 </div>
    21 width expected 60 but got 50
    22 FAIL .grid 6 assert_equals:
    23 <div class="grid directionRTL">
    24   <div class="paddingRight50Percent" data-expected-padding-right="50" data-expected-width="60" data-expected-height="10">X</div>
    25   <div data-offset-x="400" data-offset-y="10" data-expected-width="100" data-expected-height="10"></div>
    26 </div>
    27 width expected 60 but got 50
     6PASS .grid 5
     7PASS .grid 6
    288PASS .grid 7
    299PASS .grid 8
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-lr-002-expected.txt

    r281662 r284793  
    22PASS .grid 1
    33PASS .grid 2
    4 FAIL .grid 3 assert_equals:
    5 <div class="grid">
    6   <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
    7   <div data-offset-x="10" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
    8 </div>
    9 height expected 60 but got 50
    10 FAIL .grid 4 assert_equals:
    11 <div class="grid">
    12   <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
    13   <div data-offset-x="10" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
    14 </div>
    15 height expected 60 but got 50
     4PASS .grid 3
     5PASS .grid 4
    166PASS .grid 5
    177PASS .grid 6
    18 FAIL .grid 7 assert_equals:
    19 <div class="grid directionRTL">
    20   <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
    21   <div data-offset-x="10" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
    22 </div>
    23 height expected 60 but got 50
    24 FAIL .grid 8 assert_equals:
    25 <div class="grid directionRTL">
    26   <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
    27   <div data-offset-x="10" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
    28 </div>
    29 height expected 60 but got 50
     8PASS .grid 7
     9PASS .grid 8
    3010Direction LTR
    3111
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-vertical-rl-002-expected.txt

    r281662 r284793  
    22PASS .grid 1
    33PASS .grid 2
    4 FAIL .grid 3 assert_equals:
    5 <div class="grid">
    6   <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
    7   <div data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
    8 </div>
    9 height expected 60 but got 50
    10 FAIL .grid 4 assert_equals:
    11 <div class="grid">
    12   <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
    13   <div data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="100"></div>
    14 </div>
    15 height expected 60 but got 50
     4PASS .grid 3
     5PASS .grid 4
    166PASS .grid 5
    177PASS .grid 6
    18 FAIL .grid 7 assert_equals:
    19 <div class="grid directionRTL">
    20   <div class="paddingTop50Percent" data-expected-padding-top="50" data-expected-width="10" data-expected-height="60">X</div>
    21   <div data-offset-x="0" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
    22 </div>
    23 height expected 60 but got 50
    24 FAIL .grid 8 assert_equals:
    25 <div class="grid directionRTL">
    26   <div class="paddingBottom50Percent" data-expected-padding-bottom="50" data-expected-width="10" data-expected-height="60">X</div>
    27   <div data-offset-x="0" data-offset-y="400" data-expected-width="10" data-expected-height="100"></div>
    28 </div>
    29 height expected 60 but got 50
     8PASS .grid 7
     9PASS .grid 8
    3010Direction LTR
    3111
  • trunk/Source/WebCore/ChangeLog

    r284792 r284793  
     12021-10-25  Ziran Sun  <zsun@igalia.com>
     2
     3        [CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
     4        https://bugs.webkit.org/show_bug.cgi?id=232140
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        For a child with relative width constraints to the grid area, such as percentaged paddings, we reset the
     9        overridingContainingBlockContentSizeForChild value for columns when we are executing a definite strategy
     10        for columns. Since we have updated the overridingContainingBlockContentSizeForChild inline-axis/width value
     11        in GridTrackSizingAlgorithmStrategy::minContentForChild, we might need to recompute the child's relative
     12        width. For some cases, we probably will not be able to do it during the RenderGrid::layoutGridItems() function
     13        as the grid area does't change there any more. Since we are doing a layout inside
     14        GridTrackSizingAlgorithmStrategy::logicalHeightForChild() function, this CL takes the advantage and set the
     15        preferredLogicalWidth dirty before this layout call.
     16
     17        * rendering/GridTrackSizingAlgorithm.cpp:
     18        (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
     19
    1202021-10-25  Gabriel Nava Marino  <gnavamarino@apple.com>
    221
  • trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

    r283439 r284793  
    810810    }
    811811
    812     if (updateOverridingContainingBlockContentSizeForChild(child, childInlineDirection))
     812    if (updateOverridingContainingBlockContentSizeForChild(child, childInlineDirection)) {
    813813        child.setNeedsLayout(MarkOnlyThis);
     814        // 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
     815        // 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
     816        // 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()
     817        // function, let's take the advantage and set it here.
     818        if (shouldClearOverridingContainingBlockContentSizeForChild(child, childInlineDirection))
     819            child.setPreferredLogicalWidthsDirty(true);
     820    }
    814821    return logicalHeightForChild(child);
    815822}
Note: See TracChangeset for help on using the changeset viewer.