From 762261863d2e6891c37a18f4516072b9fa6ba37c Mon Sep 17 00:00:00 2001 From: Morten Stenshorne Date: Tue, 14 May 2024 10:42:20 -0700 Subject: [PATCH] Get border/padding from fragment when painting background. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since @page border box layout objects aren't in the the layout tree, any code that wants to walk up the tree to find the containing block will be in for a surprise. This would happen if percentage-based @page padding was used [1]. Recomputing padding during painting when we have already done it during layout is rather pointless anyway. Read it out directly from the fragment. [1] #1 blink::LayoutBox::ContainingBlockLogicalWidthForContent() #2 blink::LayoutBoxModelObject::ComputedCSSPadding() #3 blink::LayoutBoxModelObject::PaddingTop() #4 blink::LayoutBoxModelObject::PaddingOutsets() #5 blink::BoxPainterBase::PaintFillLayer() #6 blink::BoxPainterBase::PaintFillLayers() #7 blink::BoxFragmentPainter::PaintBackground() Bug: 40286153 Change-Id: I1e6e92c2ce1d81aab2673ec9a877eac455534102 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5526469 Commit-Queue: Morten Stenshorne Reviewed-by: Xianzhu Wang Reviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1300711} --- css/css-page/page-box-007-print-ref.html | 16 ++++++++++++++++ css/css-page/page-box-007-print.html | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 css/css-page/page-box-007-print-ref.html create mode 100644 css/css-page/page-box-007-print.html diff --git a/css/css-page/page-box-007-print-ref.html b/css/css-page/page-box-007-print-ref.html new file mode 100644 index 00000000000000..9f5550f8f585a0 --- /dev/null +++ b/css/css-page/page-box-007-print-ref.html @@ -0,0 +1,16 @@ + + + +
+ The page padding (in hotpink) should be smallest at the top, larger at the + right, even larger at the bottom, and largest at the left. There should be no + red. +
diff --git a/css/css-page/page-box-007-print.html b/css/css-page/page-box-007-print.html new file mode 100644 index 00000000000000..2ed198b32ef540 --- /dev/null +++ b/css/css-page/page-box-007-print.html @@ -0,0 +1,22 @@ + + + + + + +
+ The page padding (in hotpink) should be smallest at the top, larger at the + right, even larger at the bottom, and largest at the left. There should be no + red. +