OLD | NEW |
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/BoxPainterBase.h" | 5 #include "core/paint/BoxPainterBase.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 bool BoxPainterBase::ShouldForceWhiteBackgroundForPrintEconomy( | 196 bool BoxPainterBase::ShouldForceWhiteBackgroundForPrintEconomy( |
197 const Document& document, | 197 const Document& document, |
198 const ComputedStyle& style) { | 198 const ComputedStyle& style) { |
199 return document.Printing() && | 199 return document.Printing() && |
200 style.PrintColorAdjust() == EPrintColorAdjust::kEconomy && | 200 style.PrintColorAdjust() == EPrintColorAdjust::kEconomy && |
201 (!document.GetSettings() || | 201 (!document.GetSettings() || |
202 !document.GetSettings()->GetShouldPrintBackgrounds()); | 202 !document.GetSettings()->GetShouldPrintBackgrounds()); |
203 } | 203 } |
204 | 204 |
| 205 bool BoxPainterBase::CalculateFillLayerOcclusionCulling( |
| 206 FillLayerOcclusionOutputList& reversed_paint_list, |
| 207 const FillLayer& fill_layer, |
| 208 const Document& document, |
| 209 const ComputedStyle& style) { |
| 210 bool is_non_associative = false; |
| 211 for (auto current_layer = &fill_layer; current_layer; |
| 212 current_layer = current_layer->Next()) { |
| 213 reversed_paint_list.push_back(current_layer); |
| 214 // Stop traversal when an opaque layer is encountered. |
| 215 // FIXME : It would be possible for the following occlusion culling test to |
| 216 // be more aggressive on layers with no repeat by testing whether the image |
| 217 // covers the layout rect. Testing that here would imply duplicating a lot |
| 218 // of calculations that are currently done in |
| 219 // LayoutBoxModelObject::paintFillLayer. A more efficient solution might be |
| 220 // to move the layer recursion into paintFillLayer, or to compute the layer |
| 221 // geometry here and pass it down. |
| 222 |
| 223 // TODO(trchen): Need to check compositing mode as well. |
| 224 if (current_layer->BlendMode() != kWebBlendModeNormal) |
| 225 is_non_associative = true; |
| 226 |
| 227 // TODO(trchen): A fill layer cannot paint if the calculated tile size is |
| 228 // empty. This occlusion check can be wrong. |
| 229 if (current_layer->ClipOccludesNextLayers() && |
| 230 current_layer->ImageOccludesNextLayers(document, style)) { |
| 231 if (current_layer->Clip() == kBorderFillBox) |
| 232 is_non_associative = false; |
| 233 break; |
| 234 } |
| 235 } |
| 236 return is_non_associative; |
| 237 } |
| 238 |
205 } // namespace blink | 239 } // namespace blink |
OLD | NEW |