Skip to content

Commit

Permalink
Table flex-item inside inline-flex with column flex-direction has inc…
Browse files Browse the repository at this point in the history
…orrect cross-size (width)

https://bugs.webkit.org/show_bug.cgi?id=253922
<rdar://problem/107029563>

Reviewed by Antti Koivisto.

It looks like 237008@main incorrectly applied "overriding logical width" to all preferred width cases, while
according to both the commit message and one of the un-skipped test cases description, only fixed width tables have this requirement.

"<meta name="assert" content="Table's specified width does not count as another min-width for the purposes of the flexbox algorithm.">"

All the un-skipped tests (see 237008@main) are still passing:
imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-percent-width-cell-001.html
imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-specified-width.html
imported/w3c/web-platform-tests/css/css-flexbox/table-item-flex-percentage-width.html
imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict.html

* LayoutTests/fast/flexbox/flex-with-table-preferred-width-expected.html: Added.
* LayoutTests/fast/flexbox/flex-with-table-preferred-width.html: Added.
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::applyPreferredLogicalWidthQuirks const):

Canonical link: https://commits.webkit.org/263001@main
  • Loading branch information
alanbaradlay committed Apr 15, 2023
1 parent 50e4d48 commit 13134c6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
@@ -0,0 +1,11 @@
<style>
table {
font-family: Ahem;
font-size: 20px;
}
</style>
<table>
<tr>
<td>PASS if text does not wrap.</td>
</tr>
</table>
17 changes: 17 additions & 0 deletions LayoutTests/fast/flexbox/flex-with-table-preferred-width.html
@@ -0,0 +1,17 @@
<style>
.container {
display: inline-flex;
flex-direction: column;
}
table {
font-family: Ahem;
font-size: 20px;
}
</style>
<div class="container">
<table>
<tr>
<td>PASS if text does not wrap.</td>
</tr>
</table>
</div>
8 changes: 4 additions & 4 deletions Source/WebCore/rendering/AutoTableLayout.cpp
Expand Up @@ -274,10 +274,10 @@ void AutoTableLayout::computeIntrinsicLogicalWidths(LayoutUnit& minWidth, Layout

void AutoTableLayout::applyPreferredLogicalWidthQuirks(LayoutUnit& minWidth, LayoutUnit& maxWidth) const
{
if (m_table->hasOverridingLogicalWidth())
minWidth = maxWidth = std::max(minWidth, m_table->overridingLogicalWidth());
else if (auto tableLogicalWidth = m_table->style().logicalWidth(); tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive())
minWidth = maxWidth = std::max(minWidth, LayoutUnit(tableLogicalWidth.value()));
if (auto tableLogicalWidth = m_table->style().logicalWidth(); tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive()) {
minWidth = std::max(minWidth, m_table->hasOverridingLogicalWidth() ? m_table->overridingLogicalWidth() : LayoutUnit(tableLogicalWidth.value()));
maxWidth = minWidth;
}
}

/*
Expand Down

0 comments on commit 13134c6

Please sign in to comment.