Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move page margin handling over to Blink. #46205

Merged
merged 1 commit into from May 13, 2024

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented May 10, 2024

Remove the margin handling code from PrintRenderFrameHelper (used by the
actual browser) and SpoolPagesWithBoundariesForTesting() (web tests).

This allows @page backgrounds to cover the entire page box, including
the margin area. Tests included.

This CL also paves the road for implementing @page margin boxes (such as
author-specified headers and footers), which was the main objective
anyway.

The fact that Blink is now responsible for the entire page box means
that the code that deals with shrinking / centering paginated content to
fit the target paper also has to be moved over to Blink.

WebPrintPageDescription still provides margin info for each page.
Although PrintRenderFrameHelper no longer needs to position the page
area within the page box based on margins, the margins are still needed
in order to figure out if there's enough room for UA-generated headers
and footers.

By moving all of this into Blink, it will be rather straight-forward to
add web tests for page fitting, rather than writing clunky
PrintRenderFrameHelper component browser tests for it. Will follow up
with a CL for this.

Three page-orientation tests now start passing. The code in
SpoolPagesWithBoundariesForTesting() didn't add margin translation at
the correct time when rotating. The margins are no longer added there,
so the problem is gone.

Bug: 40286153, 40341678
Change-Id: I418b2e08ed76b297ea5d5fc223545b52b3e9b09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5526464
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1300225}

Remove the margin handling code from PrintRenderFrameHelper (used by the
actual browser) and SpoolPagesWithBoundariesForTesting() (web tests).

This allows @page backgrounds to cover the entire page box, including
the margin area. Tests included.

This CL also paves the road for implementing @page margin boxes (such as
author-specified headers and footers), which was the main objective
anyway.

The fact that Blink is now responsible for the entire page box means
that the code that deals with shrinking / centering paginated content to
fit the target paper also has to be moved over to Blink.

WebPrintPageDescription still provides margin info for each page.
Although PrintRenderFrameHelper no longer needs to position the page
area within the page box based on margins, the margins are still needed
in order to figure out if there's enough room for UA-generated headers
and footers.

By moving all of this into Blink, it will be rather straight-forward to
add web tests for page fitting, rather than writing clunky
PrintRenderFrameHelper component browser tests for it. Will follow up
with a CL for this.

Three page-orientation tests now start passing. The code in
SpoolPagesWithBoundariesForTesting() didn't add margin translation at
the correct time when rotating. The margins are no longer added there,
so the problem is gone.

Bug: 40286153, 40341678
Change-Id: I418b2e08ed76b297ea5d5fc223545b52b3e9b09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5526464
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1300225}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 287e8d7 into master May 13, 2024
15 of 17 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-5526464 branch May 13, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants