Closed Bug 2086829 Opened 1 month ago Closed 22 days ago

[wpt-sync] Sync PR 64097 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=327176

Categories

(Core :: Layout: Flexbox, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64097 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64097
Details from upstream follow.

Alan Baradlay <zalan@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=327176

WebKit export from bug: [<!---->Flex]<!----> A table flex item with borders is wider than its content and borders

<pre>
[Flex] A table flex item with borders is wider than its content and borders

 &lt;div style=&quot;display: flex; justify-content: flex-end; width: 300px&quot;&gt;
   &lt;table style=&quot;border: 10px solid; border-spacing: 0&quot;&gt;&lt;tr&gt;&lt;td style=&quot;padding: 0&quot;&gt;&lt;div style=&quot;width: 50px&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;

The table should be 70px wide, its 50px content plus 20px of borders. Instead it was 90px and stuck out of the
container.

RenderTable cached its inline borders and only recomputed them when it laid out or computed its intrinsic widths.
The flex layout read them before either, getting 0 on the first layout or the previous widths after a border change.
FlexLayoutItem cached that as the main-axis border and padding, and maxContentMainAxisExtentForFlexItem subtracted the
same stale value from a max-content contribution that had the real borders, so the content size came out too big by
the border widths and the border box added the real borders on top.

Compute borderStart() and borderEnd() on demand, the way borderBefore() and borderAfter() already are, as the FIXMEs
in layout and computeIntrinsicLogicalWidths asked, and remove the cache.

No measurable cost in PerformanceTests/Layout (median ms over 20 iterations; with the change, with the old cache,
then with the change again):

 large-table-with-collapsed-borders-and-no-colspans                  179    180     184
 large-table-with-collapsed-borders-and-colspans                     181    183     183
 large-table-with-collapsed-borders-and-colspans-wider-than-table    498    504.5   512

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=327176">https://bugs.webkit.org/show_bug.cgi?id=327176</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/323471@main">https://commits.webkit.org/323471@main</a>
</pre>

Component: web-platform-tests → Layout: Flexbox
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests

Status Summary

Firefox

PASS: 1

Chrome

PASS: 1

Safari

FAIL: 1

Links

GitHub PR Head
GitHub PR Base

Status: NEW → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.