Closed Bug 1845816 Opened 1 year ago Closed 1 year ago

[wpt-sync] Sync PR 41207 - Printing: Move page size calculation to Blink.

Categories

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

task

Tracking

()

RESOLVED FIXED
118 Branch
Tracking Status
firefox118 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Morten Stenshorne <mstensho@chromium.org> wrote:

Printing: Move page size calculation to Blink.

This is in preparation for mixed page sizes support (which will be added
in an upcoming CL).

We need to set the correct size for each individual page during layout.
Remove the concept of "the page size", since each page can have its
own size. Note, however, that we still need a uniform page size to use
as the initial containing block, which is used to resolve viewport
units, among other things. The spec defines the initial containing block
as the page area size of the first page:
https://www.w3.org/TR/css-page-3/#page-model

As a result of this change, some cleanup in PrintRenderFrameHelper
should be possible (in future CLs). For one, we no longer need to lay
out everything twice, since we lay out with the correct page sizes in
the first layout pass (rather than first using printer defaults, then
read out sizes and pargins specified in @page rules, and then lay out
again with the correct sizes). It should also be possible to untangle
some margin logic in PrintRenderFrameHelper, since Blink now only
applies CSS-specified margins when it should (e.g. not if the user has
chosen their own margins in the print preview UI). Furthermore, there
are redundant fields in WebPrintParams. We no longer need to store a
page size or content area size (since we're providing a
WebPrintPageDescription now).

PrintContext no longer stores a vector of page rectangles. They will
instead be calculated when needed. We only used the rectangles when
printing with Blink, whereas ChromePluginPrintContext was forced to
populate a page_rects_ vector, just so that we could return the correct
number of pages. Since the code for calculating the page rectangles has
been rewritten, especially when it comes to how additional pages caused
by monolithic content is calculated, I added a web test for that, since
it turned out that we didn't have a good test for that particular case.

No behavior changes intended.

Bug: 835358
Change-Id: Ic669071b3e0ac729a467321720e25d6101e7b13f
Reviewed-on: https://chromium-review.googlesource.com/4725066
WPT-Export-Revision: e5b5c344dc617941dd993eb2618c84ad58a5deec

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

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 ctuns@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/5d3d307b733c
[wpt PR 41207] - Printing: Move page size calculation to Blink., a=testonly
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
You need to log in before you can comment on or make changes to this bug.