Changeset 262124 in webkit


Ignore:
Timestamp:
May 25, 2020 7:18:22 AM (4 years ago)
Author:
svillar@igalia.com
Message:

[css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
https://bugs.webkit.org/show_bug.cgi?id=212264

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-flexbox/percentage-heights-003-expected.txt: There were 3 subtests

marked as failures. All of them work fine now.

Source/WebCore:

Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified
the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that
they're really definite.

This allows us to mark 3 tests which were testing percentages in flex items as correct.

Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org>

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size
definiteness when computing the main size for percentage resolution, no need to check flex basis at all.

LayoutTests:

  • css3/flexbox/definite-main-size-expected.txt: Updated expectation.
  • css3/flexbox/definite-main-size.html: Updated comment.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r262123 r262124  
     12020-05-22  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
     4        https://bugs.webkit.org/show_bug.cgi?id=212264
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        * css3/flexbox/definite-main-size-expected.txt: Updated expectation.
     9        * css3/flexbox/definite-main-size.html: Updated comment.
     10
    1112020-05-25  Diego Pino Garcia  <dpino@igalia.com>
    212
  • trunk/LayoutTests/css3/flexbox/definite-main-size-expected.txt

    r213149 r262124  
    1010Simple case of percentage resolution, columns:
    1111
    12 auto flex-basis, we should ignore the percentage height here:
     12auto flex-basis. This is still definite.
    1313
    1414
  • trunk/LayoutTests/css3/flexbox/definite-main-size.html

    r213149 r262124  
    6262</div>
    6363
    64 <p>auto flex-basis, we should ignore the percentage height here:</p>
     64<p>auto flex-basis. This is still definite.</p>
    6565<div class="flexbox column" style="height: 300px;">
    6666  <div data-expected-height="50">
    67     <div style="height: 50%;" data-expected-height="50">
     67    <div style="height: 50%;" data-expected-height="25">
    6868      <div class="rect"></div>
    6969    </div>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r262056 r262124  
     12020-05-22  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
     4        https://bugs.webkit.org/show_bug.cgi?id=212264
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        * web-platform-tests/css/css-flexbox/percentage-heights-003-expected.txt: There were 3 subtests
     9        marked as failures. All of them work fine now.
     10
    1112020-05-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-003-expected.txt

    r261859 r262124  
    11
    2 FAIL .flexbox 1 assert_equals:
    3 <div class="flexbox column" style="height: 0">
    4         <div>
    5             <span data-expected-height="100"></span>
    6         </div>
    7     </div>
    8 height expected 100 but got 0
    9 FAIL .flexbox 2 assert_equals:
    10 <div class="flexbox column-wrap" style="height: 0">
    11        <div>
    12             <span data-expected-height="50"></span>
    13         </div>
    14         <div>
    15             <span data-expected-height="50"></span>
    16         </div>
    17     </div>
    18 height expected 50 but got 0
     2PASS .flexbox 1
     3PASS .flexbox 2
    194PASS .flexbox 3
    205PASS .flexbox 4
    216PASS .flexbox 5
    227PASS .flexbox 6
    23 FAIL .flexbox 7 assert_equals:
    24 <div class="flexbox vert-wm">
    25         <div class="horiz-wm">
    26             <span data-expected-height="100"></span>
    27         </div>
    28     </div>
    29 height expected 100 but got 0
     8PASS .flexbox 7
    309
  • trunk/Source/WebCore/ChangeLog

    r262122 r262124  
     12020-05-22  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
     4        https://bugs.webkit.org/show_bug.cgi?id=212264
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified
     9        the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that
     10        they're really definite.
     11
     12        This allows us to mark 3 tests which were testing percentages in flex items as correct.
     13
     14        Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org>
     15
     16        * rendering/RenderFlexibleBox.cpp:
     17        (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size
     18        definiteness when computing the main size for percentage resolution, no need to check flex basis at all.
     19
    1202020-05-25  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r260055 r262124  
    11441144Optional<LayoutUnit> RenderFlexibleBox::mainSizeForPercentageResolution(const RenderBox& child)
    11451145{
    1146     // This function implements section 9.8. Definite and Indefinite Sizes, case
    1147     // 2) of the flexbox spec.
    1148     // We need to check for the flexbox to have a definite main size, and for the
    1149     // flex item to have a definite flex basis.
    1150     const Length& flexBasis = flexBasisForChild(child);
    1151     if (!mainAxisLengthIsDefinite(child, flexBasis))
     1146    // This function implements section 9.8. Definite and Indefinite Sizes, case 2) of the flexbox spec.
     1147    // If the flex container has a definite main size the flex item post-flexing main size is also treated
     1148    // as definite. We make up a percentage to check whether we have a definite size.
     1149    if (!mainAxisLengthIsDefinite(child, Length(0, Percent)))
    11521150        return WTF::nullopt;
    1153     if (!flexBasis.isPercentOrCalculated()) {
    1154         // If flex basis had a percentage, our size is guaranteed to be definite or
    1155         // the flex item's size could not be definite. Otherwise, we make up a
    1156         // percentage to check whether we have a definite size.
    1157         if (!mainAxisLengthIsDefinite(child, Length(0, Percent)))
    1158             return WTF::nullopt;
    1159     }
    1160    
     1151
    11611152    if (hasOrthogonalFlow(child))
    11621153        return child.hasOverrideContentLogicalHeight() ? Optional<LayoutUnit>(child.overrideContentLogicalHeight()) : WTF::nullopt;
Note: See TracChangeset for help on using the changeset viewer.