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

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

Issue 1196223008: ViewPainter should skip background in print economy mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « LayoutTests/printing/print-no-background-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ViewPainter.cpp
diff --git a/Source/core/paint/ViewPainter.cpp b/Source/core/paint/ViewPainter.cpp
index fd892d571a52e8ebc3a2a99f43c804adeaff4f20..b67f1471e100fe1feccf04f78c842c64c91a3720 100644
--- a/Source/core/paint/ViewPainter.cpp
+++ b/Source/core/paint/ViewPainter.cpp
@@ -56,12 +56,22 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
bool paintsBaseBackground = isMainFrame && !frameView.isTransparent();
bool shouldClearCanvas = paintsBaseBackground && (document.settings() && document.settings()->shouldClearDocumentBackground());
Color baseBackgroundColor = paintsBaseBackground ? frameView.baseBackgroundColor() : Color();
+ Color rootBackgroundColor = m_layoutView.style()->visitedDependentColor(CSSPropertyBackgroundColor);
const LayoutObject* rootObject = document.documentElement() ? document.documentElement()->layoutObject() : nullptr;
LayoutObjectDrawingRecorder recorder(context, m_layoutView, DisplayItem::BoxDecorationBackground, documentRect);
if (recorder.canUseCachedDrawing())
return;
+ // Special handling for print economy mode.
+ if (document.printing() && m_layoutView.style()->printColorAdjust() == PrintColorAdjustEconomy
chrishtr 2015/06/23 17:42:57 Where did this logic used to be before your refact
trchen 2015/06/23 20:40:15 https://code.google.com/p/chromium/codesearch#chro
+ && (!document.settings() || !document.settings()->shouldPrintBackgrounds())) {
+ // If for any reason the view background is not transparent, paint white instead, otherwise keep transparent as is.
+ if (paintsBaseBackground || rootBackgroundColor.alpha() || m_layoutView.style()->backgroundLayers().image())
+ context.fillRect(documentRect, Color::white, SkXfermode::kSrc_Mode);
+ return;
+ }
+
// Compute the enclosing rect of the view, in root element space.
//
// For background colors we can simply paint the document rect in the default space.
@@ -100,7 +110,6 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
BoxPainter::FillLayerOcclusionOutputList reversedPaintList;
bool shouldDrawBackgroundInSeparateBuffer = BoxPainter(m_layoutView).calculateFillLayerOcclusionCulling(reversedPaintList, m_layoutView.style()->backgroundLayers());
ASSERT(reversedPaintList.size());
- Color rootBackgroundColor = m_layoutView.style()->visitedDependentColor(CSSPropertyBackgroundColor);
// If the root background color is opaque, isolation group can be skipped because the canvas
// will be cleared by root background color.
« no previous file with comments | « LayoutTests/printing/print-no-background-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698