| 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/paint/ObjectPaintInvalidator.h" | 9 #include "core/paint/ObjectPaintInvalidator.h" |
| 10 #include "core/paint/PaintInvalidator.h" | 10 #include "core/paint/PaintInvalidator.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 *m_context.paintInvalidationContainer, bottomDelta, | 105 *m_context.paintInvalidationContainer, bottomDelta, |
| 106 PaintInvalidationIncremental); | 106 PaintInvalidationIncremental); |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason() { | 110 PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason() { |
| 111 PaintInvalidationReason reason = | 111 PaintInvalidationReason reason = |
| 112 ObjectPaintInvalidatorWithContext(m_box, m_context) | 112 ObjectPaintInvalidatorWithContext(m_box, m_context) |
| 113 .computePaintInvalidationReason(); | 113 .computePaintInvalidationReason(); |
| 114 | 114 |
| 115 if (isImmediateFullPaintInvalidationReason(reason) || | 115 if (reason != PaintInvalidationIncremental) |
| 116 reason == PaintInvalidationNone) | |
| 117 return reason; | 116 return reason; |
| 118 | 117 |
| 119 if (m_box.mayNeedPaintInvalidationAnimatedBackgroundImage() && | |
| 120 !m_box.backgroundIsKnownToBeObscured()) | |
| 121 reason = PaintInvalidationDelayedFull; | |
| 122 | |
| 123 // If the current paint invalidation reason is PaintInvalidationDelayedFull, | |
| 124 // then this paint invalidation can delayed if the LayoutBox in question is | |
| 125 // not on-screen. The logic to decide whether this is appropriate exists at | |
| 126 // the site of the original paint invalidation that chose | |
| 127 // PaintInvalidationDelayedFull. | |
| 128 if (reason == PaintInvalidationDelayedFull) { | |
| 129 // Do regular full paint invalidation if the object is onscreen. | |
| 130 return m_box.intersectsVisibleViewport() ? PaintInvalidationFull | |
| 131 : PaintInvalidationDelayedFull; | |
| 132 } | |
| 133 | |
| 134 DCHECK(reason == PaintInvalidationIncremental); | |
| 135 | |
| 136 if (m_box.isLayoutView()) { | 118 if (m_box.isLayoutView()) { |
| 137 const LayoutView& layoutView = toLayoutView(m_box); | 119 const LayoutView& layoutView = toLayoutView(m_box); |
| 138 // In normal compositing mode, root background doesn't need to be | 120 // In normal compositing mode, root background doesn't need to be |
| 139 // invalidated for box changes, because the background always covers the | 121 // invalidated for box changes, because the background always covers the |
| 140 // whole document rect and clipping is done by | 122 // whole document rect and clipping is done by |
| 141 // compositor()->m_containerLayer. Also the scrollbars are always | 123 // compositor()->m_containerLayer. Also the scrollbars are always |
| 142 // composited. There are no other box decoration on the LayoutView thus we | 124 // composited. There are no other box decoration on the LayoutView thus we |
| 143 // can safely exit here. | 125 // can safely exit here. |
| 144 if (layoutView.usesCompositing() && | 126 if (layoutView.usesCompositing() && |
| 145 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 127 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 283 |
| 302 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { | 284 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { |
| 303 DCHECK(m_box.hasPreviousBoxGeometries() == | 285 DCHECK(m_box.hasPreviousBoxGeometries() == |
| 304 previousBoxGeometriesMap().contains(&m_box)); | 286 previousBoxGeometriesMap().contains(&m_box)); |
| 305 return m_box.hasPreviousBoxGeometries() | 287 return m_box.hasPreviousBoxGeometries() |
| 306 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect | 288 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect |
| 307 : LayoutRect(); | 289 : LayoutRect(); |
| 308 } | 290 } |
| 309 | 291 |
| 310 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |