Bug 1715783 - Do not backplate using a background-color that isn't drawn due to print settings. r=morgan

When printing, we lighten backgrounds and darken colors, unless color-adjust:
exact is used. So with the current backplating logic we might end up using a dark
system color background for a backplate, but then darkening the test, ending up
in both more ink being used, and the text being unreadable.

We don't have a great test story for these but I can try...

Differential Revision: https://phabricator.services.mozilla.com/D117729
This commit is contained in:
Emilio Cobos Alvarez 2021-06-17 11:15:14 +00:00
parent ad22267e19
commit f7b37252ad

View File

@ -228,7 +228,7 @@ static Maybe<nscolor> GetBackplateColor(nsIFrame* aFrame) {
continue;
}
nscolor backgroundColor = bg->BackgroundColor(frame);
if (NS_GET_A(backgroundColor) != 0) {
if (NS_GET_A(backgroundColor) != 0 && frame->ComputeShouldPaintBackground().mColor) {
// NOTE: We intentionally disregard the alpha channel here for the purpose
// of the backplate, in order to guarantee contrast.
return Some(NS_RGB(NS_GET_R(backgroundColor), NS_GET_G(backgroundColor),