Changeset 276572 in webkit


Ignore:
Timestamp:
Apr 25, 2021 2:00:07 PM (15 months ago)
Author:
commit-queue@webkit.org
Message:

[css-flexbox] Table layout disregards overriding width
https://bugs.webkit.org/show_bug.cgi?id=224934

Patch by Felipe Erias <Felipe Erias> on 2021-04-25
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update expectations.

  • web-platform-tests/css/css-flexbox/table-with-percent-intrinsic-width-expected.txt: This test now passes.

Source/WebCore:

If a table's parent has set an overriding width on it, that value will get preference over the one from
the table's "width" property. This fixes several tests where the width assigned by the flexbox algorithm
did not match the width of the table after layout.

  • rendering/AutoTableLayout.cpp:

(WebCore::AutoTableLayout::applyPreferredLogicalWidthQuirks const): Give precedence to the element's
overriding width if it has been set.

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::updateLogicalWidth): Give precedence to the element's overriding width if it
has been set, instead of discarding it if it is smaller than the style width.
(WebCore::RenderTable::computePreferredLogicalWidths): Take the overriding width into account when
computing the preferred min/max values for the element.

LayoutTests:

  • TestExpectations: Remove three WPT tests that now pass.
  • platform/glib/TestExpectations: Remove one WPT test that now passes.
  • platform/gtk/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt: Added.
Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276562 r276572  
     12021-04-25  Felipe Erias  <felipeerias@igalia.com>
     2
     3        [css-flexbox] Table layout disregards overriding width
     4        https://bugs.webkit.org/show_bug.cgi?id=224934
     5
     6        Reviewed by Darin Adler.
     7
     8        * TestExpectations: Remove three WPT tests that now pass.
     9        * platform/glib/TestExpectations: Remove one WPT test that now passes.
     10        * platform/gtk/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt: Added.
     11
    1122021-04-24  Tim Horton  <timothy_horton@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r276558 r276572  
    39653965# Tables as flex items.
    39663966webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-fixed-min-width-3.html [ ImageOnlyFailure ]
    3967 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-percent-width-cell-001.html [ ImageOnlyFailure ]
    3968 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-specified-width.html [ ImageOnlyFailure ]
    39693967webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-1.html [ ImageOnlyFailure ]
    39703968webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-2.html [ ImageOnlyFailure ]
    39713969webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-row-2.html [ ImageOnlyFailure ]
    39723970webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-specified-height.html [ ImageOnlyFailure ]
    3973 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-item-flex-percentage-width.html [ ImageOnlyFailure ]
    39743971
    39753972# SVGs as flex items.
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r276554 r276572  
     12021-04-25  Felipe Erias  <felipeerias@igalia.com>
     2
     3        [css-flexbox] Table layout disregards overriding width
     4        https://bugs.webkit.org/show_bug.cgi?id=224934
     5
     6        Reviewed by Darin Adler.
     7
     8        Update expectations.
     9
     10        * web-platform-tests/css/css-flexbox/table-with-percent-intrinsic-width-expected.txt: This test now passes.
     11
    1122021-04-24  Antoine Quint  <graouts@webkit.org>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/table-with-percent-intrinsic-width-expected.txt

    r272644 r276572  
    11
    2 FAIL table 1 assert_equals:
    3 <div class="container">
    4   <div class="left">
    5   </div>
    6   <table style="width:100%" data-expected-width="100">
    7     <tbody><tr><td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    8     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    9     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    10     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    11     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    12   </tr></tbody></table>
    13 </div>
    14 width expected 100 but got 200
    15 FAIL table 2 assert_equals:
    16 <div class="container">
    17   <div class="left">
    18   </div>
    19   <table style="width:70%; flex-basis: 200px" data-expected-width="100">
    20     <tbody><tr><td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    21     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    22     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    23     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    24     <td data-expected-width="20"><div class="spacer"></div><div class="spacer"></div></td>
    25   </tr></tbody></table>
    26 </div>
    27 width expected 100 but got 140
     2PASS table 1
     3PASS table 2
    284
  • trunk/LayoutTests/platform/glib/TestExpectations

    r276491 r276572  
    435435
    436436webkit.org/b/214682 imported/w3c/web-platform-tests/css/cssom/stylesheet-same-origin.sub.html [ Pass Failure ]
    437 
    438 webkit.org/b/169007 imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict.html [ Failure ]
    439437
    440438webkit.org/b/216767 css3/font-feature-settings-stylistic-set.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r276565 r276572  
     12021-04-25  Felipe Erias  <felipeerias@igalia.com>
     2
     3        [css-flexbox] Table layout disregards overriding width
     4        https://bugs.webkit.org/show_bug.cgi?id=224934
     5
     6        Reviewed by Darin Adler.
     7
     8        If a table's parent has set an overriding width on it, that value will get preference over the one from
     9        the table's "width" property. This fixes several tests where the width assigned by the flexbox algorithm
     10        did not match the width of the table after layout.
     11       
     12        * rendering/AutoTableLayout.cpp:
     13        (WebCore::AutoTableLayout::applyPreferredLogicalWidthQuirks const): Give precedence to the element's
     14        overriding width if it has been set.
     15       
     16        * rendering/RenderTable.cpp:
     17        (WebCore::RenderTable::updateLogicalWidth): Give precedence to the element's overriding width if it
     18        has been set, instead of discarding it if it is smaller than the style width.
     19        (WebCore::RenderTable::computePreferredLogicalWidths): Take the overriding width into account when
     20        computing the preferred min/max values for the element.
     21
    1222021-04-25  Tyler Wilcock  <twilco.o@protonmail.com>
    223
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r275462 r276572  
    281281void AutoTableLayout::applyPreferredLogicalWidthQuirks(LayoutUnit& minWidth, LayoutUnit& maxWidth) const
    282282{
    283     Length tableLogicalWidth = m_table->style().logicalWidth();
    284     if (tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive())
     283    if (m_table->hasOverridingLogicalWidth())
     284        minWidth = maxWidth = std::max(minWidth, m_table->overridingLogicalWidth());
     285    else if (auto tableLogicalWidth = m_table->style().logicalWidth(); tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive())
    285286        minWidth = maxWidth = std::max(minWidth, LayoutUnit(tableLogicalWidth.value()));
    286287}
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r276240 r276572  
    262262
    263263    Length styleLogicalWidth = style().logicalWidth();
    264     if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || styleLogicalWidth.isIntrinsic())
     264    if (hasOverridingLogicalWidth())
     265        setLogicalWidth(overridingLogicalWidth());
     266    else if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || styleLogicalWidth.isIntrinsic())
    265267        setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidth, containerWidthInInlineDirection));
    266268    else {
     
    287289        setLogicalWidth(std::min(availableContentLogicalWidth, maxWidth));
    288290    }
    289 
    290     // Our parent might have set an override content logical width on us, so we must respect it. This
    291     // is how flexbox containers flex or stretch us.
    292     if (hasOverridingLogicalWidth())
    293         setLogicalWidth(std::max(logicalWidth(), overridingLogicalWidth()));
    294291
    295292    // Ensure we aren't bigger than our max-width style.
     
    845842    for (unsigned i = 0; i < m_captions.size(); i++)
    846843        m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_captions[i]->minPreferredLogicalWidth());
     844
     845    if (hasOverridingLogicalWidth()) {
     846        m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, overridingLogicalWidth());
     847        m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, overridingLogicalWidth());
     848    }
    847849
    848850    auto& styleToUse = style();
Note: See TracChangeset for help on using the changeset viewer.