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

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

Issue 1787733003: Consolidate background fill layer opaqueness into one method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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: third_party/WebKit/Source/core/paint/BoxPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/BoxPainter.cpp b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
index 609fa400ff3c48207a40828f1381f1bfaf4106b3..2474d90f69c3708c254048170978f339cc6c4e43 100644
--- a/third_party/WebKit/Source/core/paint/BoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
@@ -134,16 +134,6 @@ void BoxPainter::paintBackground(const PaintInfo& paintInfo, const LayoutRect& p
paintFillLayers(paintInfo, backgroundColor, m_layoutBox.style()->backgroundLayers(), paintRect, bleedAvoidance);
}
-bool BoxPainter::isFillLayerOpaque(const FillLayer& layer, const LayoutObject& imageClient)
-{
- // The default object size passed down to imageSize is empty with the implication that images
- // with no intrinsic size are treated as empty.
- return layer.hasOpaqueImage(&imageClient)
- && layer.image()->canRender()
- && !layer.image()->imageSize(&imageClient, imageClient.style()->effectiveZoom(), LayoutSize()).isEmpty()
- && layer.hasRepeatXY();
-}
-
bool BoxPainter::calculateFillLayerOcclusionCulling(FillLayerOcclusionOutputList &reversedPaintList, const FillLayer& fillLayer)
{
bool isNonAssociative = false;
@@ -163,7 +153,7 @@ bool BoxPainter::calculateFillLayerOcclusionCulling(FillLayerOcclusionOutputList
// TODO(trchen): A fill layer cannot paint if the calculated tile size is empty.
// This occlusion check can be wrong.
if (currentLayer->clipOccludesNextLayers()
- && isFillLayerOpaque(*currentLayer, m_layoutBox)) {
+ && currentLayer->backgroundImageIsOpaque(m_layoutBox, m_layoutBox.style()->effectiveZoom())) {
if (currentLayer->clip() == BorderFillBox)
isNonAssociative = false;
break;
@@ -433,7 +423,7 @@ void BoxPainter::paintFillLayer(const LayoutBoxModelObject& obj, const PaintInfo
if (isBottomLayer) {
IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));
bool boxShadowShouldBeAppliedToBackground = obj.boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
- bool backgroundImageOccludesBackgroundColor = shouldPaintBackgroundImage && isFillLayerOpaque(bgLayer, obj);
+ bool backgroundImageOccludesBackgroundColor = shouldPaintBackgroundImage && bgLayer.backgroundImageIsOpaque(obj, obj.style()->effectiveZoom());
if (boxShadowShouldBeAppliedToBackground || !backgroundImageOccludesBackgroundColor) {
GraphicsContextStateSaver shadowStateSaver(context, boxShadowShouldBeAppliedToBackground);
if (boxShadowShouldBeAppliedToBackground)

Powered by Google App Engine
This is Rietveld 408576698