Changeset 276634 in webkit


Ignore:
Timestamp:
Apr 27, 2021 3:15:02 AM (15 months ago)
Author:
svillar@igalia.com
Message:

[css-flexbox] percent children don't resolve against the flex basis on a fully inflexible item with fixed flex-basis
https://bugs.webkit.org/show_bug.cgi?id=210478

Reviewed by Darin Adler.

Source/WebCore:

Flexbox spec defines some additional cases where sizes could be considered definite despite they are
actually indefinite. One of those cases is whenever we have a fully inflexible item with a definite
flex-basis. In that case we should allow desdendants of flex item to resolve against the post-flexing
size of the flex item which is basically the value of the definite flex-basis. Note that in the majority
of cases those percentages are resolved before flexing the item and not recomputed after that.

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): let descendants of
fully inflexible flex items with definite flex-basis to resolve against the post-flexing size. Also added
some documentation because that part of the code is far from obvious for the casual reader.

LayoutTests:

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276631 r276634  
     12021-04-21  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flexbox] percent children don't resolve against the flex basis on a fully inflexible item with fixed flex-basis
     4        https://bugs.webkit.org/show_bug.cgi?id=210478
     5
     6        Reviewed by Darin Adler.
     7
     8        * TestExpectations: Unskipped a couple of tests that are passing now.
     9
    1102021-04-27  Rob Buis  <rbuis@igalia.com>
    211
  • trunk/LayoutTests/TestExpectations

    r276627 r276634  
    39103910webkit.org/b/210093 imported/w3c/web-platform-tests/css/css-flexbox/select-element-zero-height-002.html [ ImageOnlyFailure ]
    39113911webkit.org/b/210144 imported/w3c/web-platform-tests/css/css-flexbox/anonymous-flex-item-005.html [ ImageOnlyFailure ]
    3912 webkit.org/b/210478 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-006.html [ ImageOnlyFailure ]
    39133912webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/overflow-area-001.html [ ImageOnlyFailure ]
    39143913webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/overflow-area-002.html [ ImageOnlyFailure ]
    39153914webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/overflow-auto-005.html [ ImageOnlyFailure ]
    3916 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-007.html [ ImageOnlyFailure ]
    39173915webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-014.html [ ImageOnlyFailure ]
    39183916webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/scrollbars-auto.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r276633 r276634  
     12021-04-21  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flexbox] percent children don't resolve against the flex basis on a fully inflexible item with fixed flex-basis
     4        https://bugs.webkit.org/show_bug.cgi?id=210478
     5
     6        Reviewed by Darin Adler.
     7
     8        Flexbox spec defines some additional cases where sizes could be considered definite despite they are
     9        actually indefinite. One of those cases is whenever we have a fully inflexible item with a definite
     10        flex-basis. In that case we should allow desdendants of flex item to resolve against the post-flexing
     11        size of the flex item which is basically the value of the definite flex-basis. Note that in the majority
     12        of cases those percentages are resolved before flexing the item and not recomputed after that.
     13
     14        * rendering/RenderFlexibleBox.cpp:
     15        (WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): let descendants of
     16        fully inflexible flex items with definite flex-basis to resolve against the post-flexing size. Also added
     17        some documentation because that part of the code is far from obvious for the casual reader.
     18
    1192021-04-27  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r276235 r276634  
    12421242}
    12431243
     1244// This method is only called whenever a descendant of a flex item wants to resolve a percentage in its
     1245// block axis (logical height). The key here is that percentages should be generally resolved before the
     1246// flex item is flexed, meaning that they shouldn't be recomputed once the flex item has been flexed. There
     1247// are some exceptions though that are implemented here, like the case of fully inflexible items with
     1248// definite flex-basis, or whenever the flex container has a definite main size. See
     1249// https://drafts.csswg.org/css-flexbox/#definite-sizes for additional details.
    12441250bool RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution(const RenderBox& child)
    12451251{
    12461252    ASSERT(!mainAxisIsChildInlineAxis(child));
     1253
     1254    // The main size of a fully inflexible item with a definite flex basis is, by definition, definite.
     1255    if (child.style().flexGrow() == 0.0 && child.style().flexShrink() == 0.0 && childMainSizeIsDefinite(child, flexBasisForChild(child)))
     1256        return child.hasOverridingLogicalHeight();
     1257
    12471258    // This function implements section 9.8. Definite and Indefinite Sizes, case 2) of the flexbox spec.
    12481259    // If the flex container has a definite main size the flex item post-flexing main size is also treated
    12491260    // as definite. We make up a percentage to check whether we have a definite size.
    1250     auto updateDescendants = m_inLayout ? UpdatePercentageHeightDescendants::Yes : UpdatePercentageHeightDescendants::No;
    1251     if (!canComputePercentageFlexBasis(child, Length(0, LengthType::Percent), updateDescendants))
     1261    if (!canComputePercentageFlexBasis(child, Length(0, LengthType::Percent), UpdatePercentageHeightDescendants::Yes))
    12521262        return false;
    12531263
Note: See TracChangeset for help on using the changeset viewer.