| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/BoxPaintInvalidator.h" | 5 #include "core/paint/BoxPaintInvalidator.h" |
| 6 | 6 |
| 7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 10 #include "core/paint/ObjectPaintInvalidator.h" | 10 #include "core/paint/ObjectPaintInvalidator.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // Don't save old box geometries if the paint rect is empty because we'll | 292 // Don't save old box geometries if the paint rect is empty because we'll |
| 293 // fully invalidate once the paint rect becomes non-empty. | 293 // fully invalidate once the paint rect becomes non-empty. |
| 294 if (m_box.visualRect().isEmpty()) | 294 if (m_box.visualRect().isEmpty()) |
| 295 return false; | 295 return false; |
| 296 | 296 |
| 297 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) | 297 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
| 298 return false; | 298 return false; |
| 299 | 299 |
| 300 const ComputedStyle& style = m_box.styleRef(); | 300 const ComputedStyle& style = m_box.styleRef(); |
| 301 | 301 |
| 302 if (m_box.contentBoxRect() != m_box.borderBoxRect()) |
| 303 m_box.m_rareStat.addReason(ReasonLBContentBoxDiff); |
| 304 if (m_box.layoutOverflowRect() != m_box.borderBoxRect()) |
| 305 m_box.m_rareStat.addReason(ReasonLBLayoutOverflowDiff); |
| 306 |
| 302 // Background and mask layers can depend on other boxes than border box. See | 307 // Background and mask layers can depend on other boxes than border box. See |
| 303 // crbug.com/490533 | 308 // crbug.com/490533 |
| 304 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || | 309 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || |
| 305 style.maskLayers().thisOrNextLayersUseContentBox()) && | 310 style.maskLayers().thisOrNextLayersUseContentBox()) && |
| 306 m_box.contentBoxRect().size() != m_box.size()) | 311 m_box.contentBoxRect().size() != m_box.size()) |
| 307 return true; | 312 return true; |
| 308 if ((backgroundGeometryDependsOnLayoutOverflowRect() || | 313 if ((backgroundGeometryDependsOnLayoutOverflowRect() || |
| 309 backgroundPaintsOntoScrollingContentsLayer()) && | 314 backgroundPaintsOntoScrollingContentsLayer()) && |
| 310 m_box.layoutOverflowRect() != m_box.borderBoxRect()) | 315 m_box.layoutOverflowRect() != m_box.borderBoxRect()) |
| 311 return true; | 316 return true; |
| 312 | 317 |
| 313 return false; | 318 return false; |
| 314 } | 319 } |
| 315 | 320 |
| 316 void BoxPaintInvalidator::savePreviousBoxGeometriesIfNeeded() { | 321 void BoxPaintInvalidator::savePreviousBoxGeometriesIfNeeded() { |
| 317 m_box.getMutableForPainting().savePreviousSize(); | 322 m_box.getMutableForPainting().savePreviousSize(); |
| 318 | 323 |
| 319 if (needsToSavePreviousContentBoxSizeOrLayoutOverflowRect()) { | 324 if (needsToSavePreviousContentBoxSizeOrLayoutOverflowRect()) { |
| 320 m_box.getMutableForPainting() | 325 m_box.getMutableForPainting() |
| 321 .savePreviousContentBoxSizeAndLayoutOverflowRect(); | 326 .savePreviousContentBoxSizeAndLayoutOverflowRect(); |
| 322 } else { | 327 } else { |
| 323 m_box.getMutableForPainting() | 328 m_box.getMutableForPainting() |
| 324 .clearPreviousContentBoxSizeAndLayoutOverflowRect(); | 329 .clearPreviousContentBoxSizeAndLayoutOverflowRect(); |
| 325 } | 330 } |
| 326 } | 331 } |
| 327 | 332 |
| 328 } // namespace blink | 333 } // namespace blink |
| OLD | NEW |