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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // can safely exit here. | 110 // can safely exit here. |
111 if (layoutView.usesCompositing() && | 111 if (layoutView.usesCompositing() && |
112 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 112 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
113 return reason; | 113 return reason; |
114 } | 114 } |
115 | 115 |
116 const ComputedStyle& style = m_box.styleRef(); | 116 const ComputedStyle& style = m_box.styleRef(); |
117 | 117 |
118 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || | 118 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || |
119 style.maskLayers().thisOrNextLayersUseContentBox() || | 119 style.maskLayers().thisOrNextLayersUseContentBox() || |
120 style.boxSizing() == BoxSizingBorderBox) && | 120 style.boxSizing() == EBoxSizing::kBorderBox) && |
121 previousContentBoxRect() != m_box.contentBoxRect()) | 121 previousContentBoxRect() != m_box.contentBoxRect()) |
122 return PaintInvalidationContentBoxChange; | 122 return PaintInvalidationContentBoxChange; |
123 | 123 |
124 LayoutSize oldBorderBoxSize = previousBorderBoxSize(); | 124 LayoutSize oldBorderBoxSize = previousBorderBoxSize(); |
125 LayoutSize newBorderBoxSize = m_box.size(); | 125 LayoutSize newBorderBoxSize = m_box.size(); |
126 bool borderBoxChanged = oldBorderBoxSize != newBorderBoxSize; | 126 bool borderBoxChanged = oldBorderBoxSize != newBorderBoxSize; |
127 if (!borderBoxChanged && m_context.oldVisualRect == m_context.newVisualRect) | 127 if (!borderBoxChanged && m_context.oldVisualRect == m_context.newVisualRect) |
128 return PaintInvalidationNone; | 128 return PaintInvalidationNone; |
129 | 129 |
130 // If either border box changed or bounds changed, and old or new border box | 130 // If either border box changed or bounds changed, and old or new border box |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 if (paintInvalidationSize.isEmpty()) | 315 if (paintInvalidationSize.isEmpty()) |
316 return false; | 316 return false; |
317 | 317 |
318 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) | 318 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
319 return false; | 319 return false; |
320 | 320 |
321 const ComputedStyle& style = m_box.styleRef(); | 321 const ComputedStyle& style = m_box.styleRef(); |
322 | 322 |
323 // If we use border-box sizing we need to track changes in the size of the | 323 // If we use border-box sizing we need to track changes in the size of the |
324 // content box. | 324 // content box. |
325 if (style.boxSizing() == BoxSizingBorderBox) | 325 if (style.boxSizing() == EBoxSizing::kBorderBox) |
326 return true; | 326 return true; |
327 | 327 |
328 // No need to save old border box size if we can use size of the old paint | 328 // No need to save old border box size if we can use size of the old paint |
329 // rect as the old border box size in the next invalidation. | 329 // rect as the old border box size in the next invalidation. |
330 if (paintInvalidationSize != m_box.size()) | 330 if (paintInvalidationSize != m_box.size()) |
331 return true; | 331 return true; |
332 | 332 |
333 // Background and mask layers can depend on other boxes than border box. See | 333 // Background and mask layers can depend on other boxes than border box. See |
334 // crbug.com/490533 | 334 // crbug.com/490533 |
335 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || | 335 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { | 380 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { |
381 DCHECK(m_box.hasPreviousBoxGeometries() == | 381 DCHECK(m_box.hasPreviousBoxGeometries() == |
382 previousBoxGeometriesMap().contains(&m_box)); | 382 previousBoxGeometriesMap().contains(&m_box)); |
383 return m_box.hasPreviousBoxGeometries() | 383 return m_box.hasPreviousBoxGeometries() |
384 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect | 384 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect |
385 : LayoutRect(); | 385 : LayoutRect(); |
386 } | 386 } |
387 | 387 |
388 } // namespace blink | 388 } // namespace blink |
OLD | NEW |