Closed Bug 2095194 Opened 16 days ago Closed 14 days ago

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

Categories

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

task

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

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

WebKit export from bug: Rendering safer C+<!---->+<!----> results for WebPageProxy.<!---->cpp is a lot slower in Safari compared to Chrome

<pre>
Painting cell backgrounds in a large collapsed-border table is O(rows²) because each edge cell walks its entire column

<a href="https://commits.webkit.org/308969@main">308969@main</a> (bug 309488) insets a cell's background fill rect at the table's
outer edges so a narrow-bordered cell does not paint into the space the column
reserves for the widest collapsed border. To find that per-column maximum it
walked the whole column (cellAbove/cellBelow) for every first/last-column cell,
on every paint.

That makes background painting O(rows²) for the edge columns: each of the N
edge cells walks all N rows. It runs on every paint, including the throwaway
paints driven by ContentfulPaintChecker::qualifiesForContentfulPaint() (e.g.
from PageColorSampler::sampleTop()), so a large collapsed-border table stalls
during load.

The per-column maximum is identical for every cell in the column, so compute
it once per table. recalcCollapsedBorders() already walks every cell whenever
the collapsed border cache is invalid, so it now also collects the maximum
collapsed inner border half of the cells touching the first and last effective
columns. The accessors call recalcCollapsedBorders() and reuse that cache, so
the values are invalidated with the collapsed borders (invalidateCollapsedBorders(),
which layout() also calls). Each edge cell then does an O(1) lookup.

This also changes which cells contribute to the maximum. The old walk used
cellAbove()/cellBelow(), which follow the column a cell starts in and stop at
the first empty slot, so a cell spanning into the last column, or a row with
no cell in the last column, hid the cells beyond it and those cells were not
inset. Every cell touching the edge column now contributes, which is what
<a href="https://commits.webkit.org/308969@main">308969@main</a> intended. The new reftest covers both cases.

Measured with the added perf test (2500-row collapsed-border table, all rows
painted), MiniBrowser release: ~153 ms/frame before, ~43 ms/frame after
(~3.6x; the edge walk drops from the dominant term to zero). The win grows with
table size.

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

Component: web-platform-tests → Layout: Tables
Product: Testing → Core

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

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

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