Skip to content

Commit 601b701

Browse files
mstenshochromium-wpt-export-bot
authored andcommitted
Get border/padding from fragment when painting background.
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 <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/main@{#1300711}
1 parent 8648c0b commit 601b701

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">
3+
<style>
4+
@page {
5+
size: 400px 800px;
6+
margin: 0;
7+
}
8+
body {
9+
margin: 0;
10+
}
11+
</style>
12+
<div style="box-sizing:border-box; height:100vh; border:solid hotpink; background:yellow; border-width:40px 80px 120px 160px; padding:4px;">
13+
The page padding (in hotpink) should be smallest at the top, larger at the
14+
right, even larger at the bottom, and largest at the left. There should be no
15+
red.
16+
</div>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">
3+
<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-properties">
4+
<link rel="match" href="page-box-007-print-ref.html">
5+
<meta name="assert" content="Test percentage-based @page padding">
6+
<style>
7+
@page {
8+
size: 400px 800px;
9+
margin: 0;
10+
padding: 5% 20% 15% 40%;
11+
background: red;
12+
}
13+
body {
14+
margin: 0;
15+
background: hotpink;
16+
}
17+
</style>
18+
<div style="box-sizing:border-box; padding:4px; height:100vh; background:yellow;">
19+
The page padding (in hotpink) should be smallest at the top, larger at the
20+
right, even larger at the bottom, and largest at the left. There should be no
21+
red.
22+
</div>

0 commit comments

Comments
 (0)