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

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

Issue 1675823002: Force bleed avoidance for some background image rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Image over image test Created 4 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 | « third_party/WebKit/Source/core/paint/BoxPainter.h ('k') | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 BoxDecorationData boxDecorationData(m_layoutBox); 86 BoxDecorationData boxDecorationData(m_layoutBox);
87 87
88 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have 88 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have
89 // custom shadows of their own. 89 // custom shadows of their own.
90 if (!m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.blee dAvoidance)) 90 if (!m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.blee dAvoidance))
91 paintBoxShadow(paintInfo, paintRect, style, Normal); 91 paintBoxShadow(paintInfo, paintRect, style, Normal);
92 92
93 GraphicsContextStateSaver stateSaver(paintInfo.context, false); 93 GraphicsContextStateSaver stateSaver(paintInfo.context, false);
94 if (bleedAvoidanceIsClipping(boxDecorationData.bleedAvoidance)) { 94 if (bleedAvoidanceIsClipping(boxDecorationData.bleedAvoidance)) {
95
96 stateSaver.save(); 95 stateSaver.save();
97 FloatRoundedRect border = style.getRoundedBorderFor(paintRect); 96 FloatRoundedRect border = style.getRoundedBorderFor(paintRect);
98 paintInfo.context.clipRoundedRect(border); 97 paintInfo.context.clipRoundedRect(border);
99 98
100 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) 99 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer)
101 paintInfo.context.beginLayer(); 100 paintInfo.context.beginLayer();
102 } 101 }
103 102
104 // If we have a native theme appearance, paint that before painting our back ground. 103 // If we have a native theme appearance, paint that before painting our back ground.
105 // The theme will tell us whether or not we should also paint the CSS backgr ound. 104 // The theme will tell us whether or not we should also paint the CSS backgr ound.
(...skipping 22 matching lines...) Expand all
128 { 127 {
129 if (m_layoutBox.isDocumentElement()) 128 if (m_layoutBox.isDocumentElement())
130 return; 129 return;
131 if (m_layoutBox.backgroundStolenForBeingBody()) 130 if (m_layoutBox.backgroundStolenForBeingBody())
132 return; 131 return;
133 if (m_layoutBox.boxDecorationBackgroundIsKnownToBeObscured()) 132 if (m_layoutBox.boxDecorationBackgroundIsKnownToBeObscured())
134 return; 133 return;
135 paintFillLayers(paintInfo, backgroundColor, m_layoutBox.style()->backgroundL ayers(), paintRect, bleedAvoidance); 134 paintFillLayers(paintInfo, backgroundColor, m_layoutBox.style()->backgroundL ayers(), paintRect, bleedAvoidance);
136 } 135 }
137 136
138 static bool isFillLayerOpaque(const FillLayer& layer, const LayoutObject& imageC lient) 137 bool BoxPainter::isFillLayerOpaque(const FillLayer& layer, const LayoutObject& i mageClient)
139 { 138 {
140 return layer.hasOpaqueImage(&imageClient) 139 return layer.hasOpaqueImage(&imageClient)
141 && layer.image()->canRender() 140 && layer.image()->canRender()
142 && !layer.image()->imageSize(&imageClient, imageClient.style()->effectiv eZoom()).isEmpty() 141 && !layer.image()->imageSize(&imageClient, imageClient.style()->effectiv eZoom()).isEmpty()
143 && layer.hasRepeatXY(); 142 && layer.hasRepeatXY();
144 } 143 }
145 144
146 bool BoxPainter::calculateFillLayerOcclusionCulling(FillLayerOcclusionOutputList &reversedPaintList, const FillLayer& fillLayer) 145 bool BoxPainter::calculateFillLayerOcclusionCulling(FillLayerOcclusionOutputList &reversedPaintList, const FillLayer& fillLayer)
147 { 146 {
148 bool isNonAssociative = false; 147 bool isNonAssociative = false;
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 690 }
692 } 691 }
693 692
694 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) 693 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document)
695 { 694 {
696 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy 695 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy
697 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); 696 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ());
698 } 697 }
699 698
700 } // namespace blink 699 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BoxPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698