| 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/PaintInvalidator.h" | 5 #include "core/paint/PaintInvalidator.h" |
| 6 | 6 |
| 7 #include "core/editing/FrameSelection.h" | 7 #include "core/editing/FrameSelection.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 return point; | 192 return point; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, | 195 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, |
| 196 PaintInvalidatorContext& context) { | 196 PaintInvalidatorContext& context) { |
| 197 if (object.hasLayer() && | 197 if (object.hasLayer() && |
| 198 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) { | 198 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) { |
| 199 context.paintingLayer = toLayoutBoxModelObject(object).layer(); | 199 context.paintingLayer = toLayoutBoxModelObject(object).layer(); |
| 200 } else if (object.isColumnSpanAll() || | 200 } else if (object.isColumnSpanAll() || |
| 201 (object.isFloating() && !object.parent()->isLayoutBlock())) { | 201 (object.isFloating() && |
| 202 !object.parent()->canContainFloatingObject(object))) { |
| 202 // See LayoutObject::paintingLayer() for the special-cases of floating under | 203 // See LayoutObject::paintingLayer() for the special-cases of floating under |
| 203 // inline and multicolumn. | 204 // inline and multicolumn. |
| 204 context.paintingLayer = object.paintingLayer(); | 205 context.paintingLayer = object.paintingLayer(); |
| 205 } | 206 } |
| 206 | 207 |
| 207 if (object.isLayoutBlockFlow() && toLayoutBlockFlow(object).containsFloats()) | 208 if (object.isLayoutBlockFlow() && toLayoutBlockFlow(object).containsFloats()) |
| 208 context.paintingLayer->setNeedsPaintPhaseFloat(); | 209 context.paintingLayer->setNeedsPaintPhaseFloat(); |
| 209 | 210 |
| 210 if (object == context.paintingLayer->layoutObject()) | 211 if (object == context.paintingLayer->layoutObject()) |
| 211 return; | 212 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 264 |
| 264 } // namespace | 265 } // namespace |
| 265 | 266 |
| 266 void PaintInvalidator::updateContext(const LayoutObject& object, | 267 void PaintInvalidator::updateContext(const LayoutObject& object, |
| 267 PaintInvalidatorContext& context) { | 268 PaintInvalidatorContext& context) { |
| 268 Optional<ScopedUndoFrameViewContentClipAndScroll> | 269 Optional<ScopedUndoFrameViewContentClipAndScroll> |
| 269 undoFrameViewContentClipAndScroll; | 270 undoFrameViewContentClipAndScroll; |
| 270 | 271 |
| 271 if (object.isPaintInvalidationContainer()) { | 272 if (object.isPaintInvalidationContainer()) { |
| 272 context.paintInvalidationContainer = toLayoutBoxModelObject(&object); | 273 context.paintInvalidationContainer = toLayoutBoxModelObject(&object); |
| 273 if (object.styleRef().isStackingContext()) | 274 if (object.styleRef().isStackingContext()) { |
| 274 context.paintInvalidationContainerForStackedContents = | 275 context.paintInvalidationContainerForStackedContents = |
| 275 toLayoutBoxModelObject(&object); | 276 toLayoutBoxModelObject(&object); |
| 277 } |
| 276 } else if (object.isLayoutView()) { | 278 } else if (object.isLayoutView()) { |
| 277 // paintInvalidationContainerForStackedContents is only for stacked | 279 // paintInvalidationContainerForStackedContents is only for stacked |
| 278 // descendants in its own frame, because it doesn't establish stacking | 280 // descendants in its own frame, because it doesn't establish stacking |
| 279 // context for stacked contents in sub-frames. | 281 // context for stacked contents in sub-frames. |
| 280 // Contents stacked in the root stacking context in this frame should use | 282 // Contents stacked in the root stacking context in this frame should use |
| 281 // this frame's paintInvalidationContainer. | 283 // this frame's paintInvalidationContainer. |
| 282 context.paintInvalidationContainerForStackedContents = | 284 context.paintInvalidationContainerForStackedContents = |
| 283 context.paintInvalidationContainer; | 285 context.paintInvalidationContainer; |
| 284 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 286 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 285 undoFrameViewContentClipAndScroll.emplace( | 287 undoFrameViewContentClipAndScroll.emplace( |
| 286 *toLayoutView(object).frameView(), context); | 288 *toLayoutView(object).frameView(), context); |
| 287 } else if (object.isFloating() && !object.parent()->isLayoutBlock()) { | 289 } |
| 288 // See LayoutObject::paintingLayer() for specialty of floating objects. | |
| 289 context.paintInvalidationContainer = | |
| 290 &object.containerForPaintInvalidation(); | |
| 291 } else if (object.styleRef().isStacked() && | 290 } else if (object.styleRef().isStacked() && |
| 292 // This is to exclude some objects (e.g. LayoutText) inheriting | 291 // This is to exclude some objects (e.g. LayoutText) inheriting |
| 293 // stacked style from parent but aren't actually stacked. | 292 // stacked style from parent but aren't actually stacked. |
| 294 object.hasLayer() && | 293 object.hasLayer() && |
| 295 context.paintInvalidationContainer != | 294 context.paintInvalidationContainer != |
| 296 context.paintInvalidationContainerForStackedContents) { | 295 context.paintInvalidationContainerForStackedContents) { |
| 297 // The current object is stacked, so we should use | 296 // The current object is stacked, so we should use |
| 298 // m_paintInvalidationContainerForStackedContents as its paint invalidation | 297 // m_paintInvalidationContainerForStackedContents as its paint invalidation |
| 299 // container on which the current object is painted. | 298 // container on which the current object is painted. |
| 300 context.paintInvalidationContainer = | 299 context.paintInvalidationContainer = |
| 301 context.paintInvalidationContainerForStackedContents; | 300 context.paintInvalidationContainerForStackedContents; |
| 302 if (context.forcedSubtreeInvalidationFlags & | 301 if (context.forcedSubtreeInvalidationFlags & |
| 303 PaintInvalidatorContext:: | 302 PaintInvalidatorContext:: |
| 304 ForcedSubtreeFullInvalidationForStackedContents) | 303 ForcedSubtreeFullInvalidationForStackedContents) { |
| 305 context.forcedSubtreeInvalidationFlags |= | 304 context.forcedSubtreeInvalidationFlags |= |
| 306 PaintInvalidatorContext::ForcedSubtreeFullInvalidation; | 305 PaintInvalidatorContext::ForcedSubtreeFullInvalidation; |
| 306 } |
| 307 } else if (object.isFloating() && |
| 308 !object.parent()->canContainFloatingObject(object)) { |
| 309 context.paintInvalidationContainer = |
| 310 &object.containerForPaintInvalidation(); |
| 307 } | 311 } |
| 308 | 312 |
| 309 if (object == context.paintInvalidationContainer) { | 313 if (object == context.paintInvalidationContainer) { |
| 310 // When we hit a new paint invalidation container, we don't need to | 314 // When we hit a new paint invalidation container, we don't need to |
| 311 // continue forcing a check for paint invalidation, since we're | 315 // continue forcing a check for paint invalidation, since we're |
| 312 // descending into a different invalidation container. (For instance if | 316 // descending into a different invalidation container. (For instance if |
| 313 // our parents were moved, the entire container will just move.) | 317 // our parents were moved, the entire container will just move.) |
| 314 if (object != context.paintInvalidationContainerForStackedContents) { | 318 if (object != context.paintInvalidationContainerForStackedContents) { |
| 315 // However, we need to keep the | 319 // However, we need to keep the |
| 316 // ForcedSubtreeFullInvalidationForStackedContents flag if the current | 320 // ForcedSubtreeFullInvalidationForStackedContents flag if the current |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; | 447 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; |
| 444 } | 448 } |
| 445 | 449 |
| 446 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 450 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 447 for (auto target : m_pendingDelayedPaintInvalidations) | 451 for (auto target : m_pendingDelayedPaintInvalidations) |
| 448 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 452 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 449 PaintInvalidationDelayedFull); | 453 PaintInvalidationDelayedFull); |
| 450 } | 454 } |
| 451 | 455 |
| 452 } // namespace blink | 456 } // namespace blink |
| OLD | NEW |