Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: Source/core/paint/BoxPainter.cpp

Issue 1196223008: ViewPainter should skip background in print economy mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix unittests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/BoxPainter.cpp
diff --git a/Source/core/paint/BoxPainter.cpp b/Source/core/paint/BoxPainter.cpp
index fde6d420b05ecee358b48cce77aae4540b1f3dc3..f8ce12e6bd85a23c0cdebf59cbcc752ae2fe06b4 100644
--- a/Source/core/paint/BoxPainter.cpp
+++ b/Source/core/paint/BoxPainter.cpp
@@ -312,13 +312,7 @@ void BoxPainter::paintFillLayerExtended(LayoutBoxModelObject& obj, const PaintIn
Color bgColor = color;
StyleImage* bgImage = bgLayer.image();
- bool forceBackgroundToWhite = false;
- if (obj.document().printing()) {
- if (obj.style()->printColorAdjust() == PrintColorAdjustEconomy)
- forceBackgroundToWhite = true;
- if (obj.document().settings() && obj.document().settings()->shouldPrintBackgrounds())
- forceBackgroundToWhite = false;
- }
+ bool forceBackgroundToWhite = shouldForceWhiteBackgroundForPrintEconomy(obj.styleRef(), obj.document());
// When printing backgrounds is disabled or using economy mode,
// change existing background colors and images to a solid white background.
@@ -1055,4 +1049,10 @@ void BoxPainter::paintBoxShadow(const PaintInfo& info, const LayoutRect& paintRe
}
}
+bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document)
+{
+ return document.printing() && style.printColorAdjust() == PrintColorAdjustEconomy
+ && (!document.settings() || !document.settings()->shouldPrintBackgrounds());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698