Index: third_party/WebKit/Source/core/paint/BoxPainterBase.cpp |
diff --git a/third_party/WebKit/Source/core/paint/BoxPainterBase.cpp b/third_party/WebKit/Source/core/paint/BoxPainterBase.cpp |
index 1946cdfb0fbf3b3efe0e837a05b0cb3b29afa993..acc20eaf7c083b2b6182c565a4b7861b3819375f 100644 |
--- a/third_party/WebKit/Source/core/paint/BoxPainterBase.cpp |
+++ b/third_party/WebKit/Source/core/paint/BoxPainterBase.cpp |
@@ -202,4 +202,38 @@ bool BoxPainterBase::ShouldForceWhiteBackgroundForPrintEconomy( |
!document.GetSettings()->GetShouldPrintBackgrounds()); |
} |
+bool BoxPainterBase::CalculateFillLayerOcclusionCulling( |
+ FillLayerOcclusionOutputList& reversed_paint_list, |
+ const FillLayer& fill_layer, |
+ const Document& document, |
+ const ComputedStyle& style) { |
+ bool is_non_associative = false; |
+ for (auto current_layer = &fill_layer; current_layer; |
+ current_layer = current_layer->Next()) { |
+ reversed_paint_list.push_back(current_layer); |
+ // Stop traversal when an opaque layer is encountered. |
+ // FIXME : It would be possible for the following occlusion culling test to |
+ // be more aggressive on layers with no repeat by testing whether the image |
+ // covers the layout rect. Testing that here would imply duplicating a lot |
+ // of calculations that are currently done in |
+ // LayoutBoxModelObject::paintFillLayer. A more efficient solution might be |
+ // to move the layer recursion into paintFillLayer, or to compute the layer |
+ // geometry here and pass it down. |
+ |
+ // TODO(trchen): Need to check compositing mode as well. |
+ if (current_layer->BlendMode() != kWebBlendModeNormal) |
+ is_non_associative = true; |
+ |
+ // TODO(trchen): A fill layer cannot paint if the calculated tile size is |
+ // empty. This occlusion check can be wrong. |
+ if (current_layer->ClipOccludesNextLayers() && |
+ current_layer->ImageOccludesNextLayers(document, style)) { |
+ if (current_layer->Clip() == kBorderFillBox) |
+ is_non_associative = false; |
+ break; |
+ } |
+ } |
+ return is_non_associative; |
+} |
+ |
} // namespace blink |