Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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/c/chromium/src/+/4725066 Reviewed-by: Chris Harrelson <[email protected]> Commit-Queue: Morten Stenshorne <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/main@{#1177868}
- Loading branch information