Closed Bug 1858011 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 42435 - Recalculate style before setting ICB size for printing.

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Morten Stenshorne <mstensho@chromium.org> wrote:

Recalculate style before setting ICB size for printing.

A zoom factor used when viewing a webpage on screen may have been set in
computed style. This would affect @page margin resolution incorrectly
when entering print mode, which in turn would result in an incorrect
initial containing block size. To fix this, recalculate style before
calculating the page area size.

Since we now recalculate style before setting any initial containing
block size for printing at all, viewport units will not be resolved
correctly. So make sure that they get calculated before laying out. This
used to be triggered by calling LayoutViewportWasResized(). It turns out
though, now that we need to do this unconditionally before the first
layout, that LayoutViewportWasResized() does more than we want. For
printing, we don't need to re-evaluate media queries, and we do not want
a resize event to be fired. Therefore, split the viewport units dirtying
into a separate function. Introduce a lamda in
ForceLayoutForPagination() to avoid repetitive code.

Make PrintBrowserTest.NoResizeEvent more evil, by modifying its resource
HTML file to use a named page, and also a wide DIV. This would make the
test fail without this CL.

Add external/wpt/css/printing/ to the scalefactor200 virtual test suite.
Three other tests (the already existing page-margin-xxx tests) would
also fail without this fix, but add a test for this specific issue
(abspos) as well.

Bug: 1488751, 1486499
Change-Id: If42211ddb6aadc49dcdee71ccd9597aa2818a672
Reviewed-on: https://chromium-review.googlesource.com/4922711
WPT-Export-Revision: d86a8f0cc6e1a651d5a8bedc90382f6bfdbe6d23

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

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

Total 1 tests

Status Summary

Firefox

PASS: 1

Chrome

PASS: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/da45dcfecaac [wpt PR 42435] - Recalculate style before setting ICB size for printing., a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.