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 // composited. There are no other box decoration on the LayoutView thus we | 110 // composited. There are no other box decoration on the LayoutView thus we |
111 // can safely exit here. | 111 // can safely exit here. |
112 if (layoutView.usesCompositing() && | 112 if (layoutView.usesCompositing() && |
113 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 113 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
114 return reason; | 114 return reason; |
115 } | 115 } |
116 | 116 |
117 const ComputedStyle& style = m_box.styleRef(); | 117 const ComputedStyle& style = m_box.styleRef(); |
118 | 118 |
119 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || | 119 if ((style.backgroundLayers().thisOrNextLayersUseContentBox() || |
120 style.maskLayers().thisOrNextLayersUseContentBox() || | 120 style.maskLayers().thisOrNextLayersUseContentBox()) && |
121 style.boxSizing() == EBoxSizing::kBorderBox) && | |
122 previousContentBoxRect() != m_box.contentBoxRect()) | 121 previousContentBoxRect() != m_box.contentBoxRect()) |
123 return PaintInvalidationContentBoxChange; | 122 return PaintInvalidationContentBoxChange; |
124 | 123 |
125 LayoutSize oldBorderBoxSize = m_box.previousSize(); | 124 LayoutSize oldBorderBoxSize = m_box.previousSize(); |
126 LayoutSize newBorderBoxSize = m_box.size(); | 125 LayoutSize newBorderBoxSize = m_box.size(); |
127 bool borderBoxChanged = oldBorderBoxSize != newBorderBoxSize; | 126 bool borderBoxChanged = oldBorderBoxSize != newBorderBoxSize; |
128 if (!borderBoxChanged && m_context.oldVisualRect == m_context.newVisualRect) | 127 if (!borderBoxChanged && m_context.oldVisualRect == m_context.newVisualRect) |
129 return PaintInvalidationNone; | 128 return PaintInvalidationNone; |
130 | 129 |
131 // 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Don't save old box geometries if the paint rect is empty because we'll | 311 // Don't save old box geometries if the paint rect is empty because we'll |
313 // fully invalidate once the paint rect becomes non-empty. | 312 // fully invalidate once the paint rect becomes non-empty. |
314 if (m_context.newVisualRect.isEmpty()) | 313 if (m_context.newVisualRect.isEmpty()) |
315 return false; | 314 return false; |
316 | 315 |
317 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) | 316 if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
318 return false; | 317 return false; |
319 | 318 |
320 const ComputedStyle& style = m_box.styleRef(); | 319 const ComputedStyle& style = m_box.styleRef(); |
321 | 320 |
322 // If we use border-box sizing we need to track changes in the size of the | |
323 // content box. | |
324 if (style.boxSizing() == EBoxSizing::kBorderBox) | |
325 return true; | |
326 | |
327 // Background and mask layers can depend on other boxes than border box. See | 321 // Background and mask layers can depend on other boxes than border box. See |
328 // crbug.com/490533 | 322 // crbug.com/490533 |
329 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || | 323 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || |
330 style.maskLayers().thisOrNextLayersUseContentBox() || | 324 style.maskLayers().thisOrNextLayersUseContentBox() || |
331 backgroundGeometryDependsOnLayoutOverflowRect() || | 325 backgroundGeometryDependsOnLayoutOverflowRect() || |
332 backgroundPaintsOntoScrollingContentsLayer()) | 326 backgroundPaintsOntoScrollingContentsLayer()) |
333 return true; | 327 return true; |
334 | 328 |
335 return false; | 329 return false; |
336 } | 330 } |
(...skipping 27 matching lines...) Expand all Loading... |
364 | 358 |
365 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { | 359 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { |
366 DCHECK(m_box.hasPreviousBoxGeometries() == | 360 DCHECK(m_box.hasPreviousBoxGeometries() == |
367 previousBoxGeometriesMap().contains(&m_box)); | 361 previousBoxGeometriesMap().contains(&m_box)); |
368 return m_box.hasPreviousBoxGeometries() | 362 return m_box.hasPreviousBoxGeometries() |
369 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect | 363 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect |
370 : LayoutRect(LayoutPoint(), m_box.previousSize()); | 364 : LayoutRect(LayoutPoint(), m_box.previousSize()); |
371 } | 365 } |
372 | 366 |
373 } // namespace blink | 367 } // namespace blink |
OLD | NEW |