| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // invalidated for box changes, because the background always covers the | 150 // invalidated for box changes, because the background always covers the |
| 151 // whole document rect and clipping is done by | 151 // whole document rect and clipping is done by |
| 152 // compositor()->m_containerLayer. Also the scrollbars are always | 152 // compositor()->m_containerLayer. Also the scrollbars are always |
| 153 // composited. There are no other box decoration on the LayoutView thus we | 153 // composited. There are no other box decoration on the LayoutView thus we |
| 154 // can safely exit here. | 154 // can safely exit here. |
| 155 if (layoutView.usesCompositing() && | 155 if (layoutView.usesCompositing() && |
| 156 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 156 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 157 return reason; | 157 return reason; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // If the transform is not identity or translation, incremental invalidation | |
| 161 // is not applicable because the difference between oldBounds and newBounds | |
| 162 // doesn't cover all area needing invalidation. | |
| 163 // FIXME: Should also consider ancestor transforms since | |
| 164 // paintInvalidationContainer. crbug.com/426111. | |
| 165 if (reason == PaintInvalidationIncremental && | 160 if (reason == PaintInvalidationIncremental && |
| 166 m_context.oldBounds != m_context.newBounds && | 161 m_context.oldBounds != m_context.newBounds) { |
| 167 m_context.paintInvalidationContainer != m_box && m_box.hasLayer() && | 162 if (m_context.newBoundsCoversExtraPixels || |
| 168 m_box.layer()->transform() && | 163 m_context.oldBoundsCoversExtraPixels) { |
| 169 !m_box.layer()->transform()->isIdentityOrTranslation()) | 164 // Incremental invalidation is not applicable because the difference |
| 170 return PaintInvalidationBoundsChange; | 165 // between oldBounds and newBounds may not cover all changed pixels along |
| 166 // the edges. |
| 167 return PaintInvalidationBoundsChange; |
| 168 } |
| 169 |
| 170 // If the transform is not identity or translation, incremental invalidation |
| 171 // is not applicable because the difference between oldBounds and newBounds |
| 172 // doesn't cover all area needing invalidation. |
| 173 // TODO(crbug.com/426111): Should also consider ancestor transforms |
| 174 // since paintInvalidationContainer. Combine this logic into the above |
| 175 // boundsCoversExtraPixels logic. |
| 176 if (m_context.paintInvalidationContainer != m_box && m_box.hasLayer() && |
| 177 m_box.layer()->transform() && |
| 178 !m_box.layer()->transform()->isIdentityOrTranslation()) |
| 179 return PaintInvalidationBoundsChange; |
| 180 } |
| 171 | 181 |
| 172 const ComputedStyle& style = m_box.styleRef(); | 182 const ComputedStyle& style = m_box.styleRef(); |
| 173 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || | 183 if (style.backgroundLayers().thisOrNextLayersUseContentBox() || |
| 174 style.maskLayers().thisOrNextLayersUseContentBox() || | 184 style.maskLayers().thisOrNextLayersUseContentBox() || |
| 175 style.boxSizing() == BoxSizingBorderBox) { | 185 style.boxSizing() == BoxSizingBorderBox) { |
| 176 if (previousBoxSizesMap().get(&m_box).contentBoxRect != | 186 if (previousBoxSizesMap().get(&m_box).contentBoxRect != |
| 177 m_box.contentBoxRect()) | 187 m_box.contentBoxRect()) |
| 178 return PaintInvalidationContentBoxChange; | 188 return PaintInvalidationContentBoxChange; |
| 179 } | 189 } |
| 180 | 190 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 auto it = previousBoxSizesMap().find(&m_box); | 317 auto it = previousBoxSizesMap().find(&m_box); |
| 308 if (it != previousBoxSizesMap().end()) | 318 if (it != previousBoxSizesMap().end()) |
| 309 return it->value.borderBoxSize; | 319 return it->value.borderBoxSize; |
| 310 | 320 |
| 311 // We didn't save the old border box size because it was the same as the size | 321 // We didn't save the old border box size because it was the same as the size |
| 312 // of oldBounds. | 322 // of oldBounds. |
| 313 return previousBoundsSize; | 323 return previousBoundsSize; |
| 314 } | 324 } |
| 315 | 325 |
| 316 } // namespace blink | 326 } // namespace blink |
| OLD | NEW |