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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxPainter.cpp

Issue 2689733002: Skip box shadows when printing (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/BoxPainter.h" 5 #include "core/paint/BoxPainter.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
10 #include "core/layout/ImageQualityController.h" 10 #include "core/layout/ImageQualityController.h"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 912 }
913 913
914 void BoxPainter::paintNormalBoxShadow(const PaintInfo& info, 914 void BoxPainter::paintNormalBoxShadow(const PaintInfo& info,
915 const LayoutRect& paintRect, 915 const LayoutRect& paintRect,
916 const ComputedStyle& style, 916 const ComputedStyle& style,
917 bool includeLogicalLeftEdge, 917 bool includeLogicalLeftEdge,
918 bool includeLogicalRightEdge) { 918 bool includeLogicalRightEdge) {
919 if (!style.boxShadow()) 919 if (!style.boxShadow())
920 return; 920 return;
921 GraphicsContext& context = info.context; 921 GraphicsContext& context = info.context;
922
923 // https://bugs.chromium.org/p/skia/issues/detail?id=237
924 if (context.printing())
925 return;
926
922 FloatRoundedRect border = style.getRoundedBorderFor( 927 FloatRoundedRect border = style.getRoundedBorderFor(
923 paintRect, includeLogicalLeftEdge, includeLogicalRightEdge); 928 paintRect, includeLogicalLeftEdge, includeLogicalRightEdge);
924 929
925 bool hasBorderRadius = style.hasBorderRadius(); 930 bool hasBorderRadius = style.hasBorderRadius();
926 bool hasOpaqueBackground = 931 bool hasOpaqueBackground =
927 style.visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255; 932 style.visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255;
928 933
929 GraphicsContextStateSaver stateSaver(context, false); 934 GraphicsContextStateSaver stateSaver(context, false);
930 935
931 const ShadowList* shadowList = style.boxShadow(); 936 const ShadowList* shadowList = style.boxShadow();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1039
1035 void BoxPainter::paintInsetBoxShadowInBounds(const PaintInfo& info, 1040 void BoxPainter::paintInsetBoxShadowInBounds(const PaintInfo& info,
1036 const FloatRoundedRect& bounds, 1041 const FloatRoundedRect& bounds,
1037 const ComputedStyle& style, 1042 const ComputedStyle& style,
1038 bool includeLogicalLeftEdge, 1043 bool includeLogicalLeftEdge,
1039 bool includeLogicalRightEdge) { 1044 bool includeLogicalRightEdge) {
1040 // The caller should have checked style.boxShadow() when computing bounds. 1045 // The caller should have checked style.boxShadow() when computing bounds.
1041 DCHECK(style.boxShadow()); 1046 DCHECK(style.boxShadow());
1042 GraphicsContext& context = info.context; 1047 GraphicsContext& context = info.context;
1043 1048
1049 // https://bugs.chromium.org/p/skia/issues/detail?id=237
1050 if (context.printing())
1051 return;
1052
1044 bool isHorizontal = style.isHorizontalWritingMode(); 1053 bool isHorizontal = style.isHorizontalWritingMode();
1045 GraphicsContextStateSaver stateSaver(context, false); 1054 GraphicsContextStateSaver stateSaver(context, false);
1046 1055
1047 const ShadowList* shadowList = style.boxShadow(); 1056 const ShadowList* shadowList = style.boxShadow();
1048 for (size_t i = shadowList->shadows().size(); i--;) { 1057 for (size_t i = shadowList->shadows().size(); i--;) {
1049 const ShadowData& shadow = shadowList->shadows()[i]; 1058 const ShadowData& shadow = shadowList->shadows()[i];
1050 if (shadow.style() != Inset) 1059 if (shadow.style() != Inset)
1051 continue; 1060 continue;
1052 1061
1053 FloatSize shadowOffset(shadow.x(), shadow.y()); 1062 FloatSize shadowOffset(shadow.x(), shadow.y());
(...skipping 28 matching lines...) Expand all
1082 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( 1091 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(
1083 const ComputedStyle& style, 1092 const ComputedStyle& style,
1084 const Document& document) { 1093 const Document& document) {
1085 return document.printing() && 1094 return document.printing() &&
1086 style.printColorAdjust() == EPrintColorAdjust::kEconomy && 1095 style.printColorAdjust() == EPrintColorAdjust::kEconomy &&
1087 (!document.settings() || 1096 (!document.settings() ||
1088 !document.settings()->getShouldPrintBackgrounds()); 1097 !document.settings()->getShouldPrintBackgrounds());
1089 } 1098 }
1090 1099
1091 } // namespace blink 1100 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698