Bug 1928512 - Use opaque backstop color for page canvas background. r=dholbert

This restores behavior from before bug 1835864, effectively.

The top level image document's root element has transparent background.
Before that patch, we used to blend that with
GetDefaultBackgroundColorDraw(), which was white.

This should generally not change behavior, because the page frame itself
is white, but it does on PrintTargetWindows (probably a cairo bug?),
where it causes our page content clip not to apply.

In any case, restoring behavior here is trivial, so let's do that for
now, I'll file a follow-up bug for the underlying issue.

Differential Revision: https://phabricator.services.mozilla.com/D228514
This commit is contained in:
Emilio Cobos Álvarez 2024-11-09 19:46:47 +00:00
parent 9ef8e05f19
commit 219b9544e1
2 changed files with 8 additions and 3 deletions

View File

@ -379,10 +379,13 @@ void nsPageContentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Add the canvas background color to the bottom of the list. This
// happens after we've built the list so that AddCanvasBackgroundColorItem
// can monkey with the contents if necessary.
// can monkey with the contents if necessary. The opaque backstop should
// ideally not be needed, but it workarounds some windows-specific clipping
// issues, see bug 1928512 and bug 1930269.
const nsRect backgroundRect(aBuilder->ToReferenceFrame(this), GetSize());
PresShell()->AddCanvasBackgroundColorItem(
aBuilder, &content, this, backgroundRect, NS_RGBA(0, 0, 0, 0));
constexpr nscolor kBackstop = NS_RGB(255, 255, 255);
PresShell()->AddCanvasBackgroundColorItem(aBuilder, &content, this,
backgroundRect, kBackstop);
}
content.AppendNewToTop<nsDisplayTransform>(

View File

@ -0,0 +1,2 @@
[pseudo-first-margin-004-print.html]
fuzzy: maxDifference=0-20;totalPixels=0-500