| 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/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
| 9 #include "core/paint/PaintLayer.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, const Paint
PropertyTreeBuilderContext& treeContext, Optional<PaintInvalidatorContext>& pain
tInvalidatorContext) | 13 void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, const Paint
PropertyTreeBuilderContext& treeContext, Optional<PaintInvalidatorContext>& pain
tInvalidatorContext) |
| 13 { | 14 { |
| 14 paintInvalidatorContext.emplace(*frameView.layoutView(), m_pendingDelayedPai
ntInvalidations); | 15 paintInvalidatorContext.emplace(*frameView.layoutView(), m_pendingDelayedPai
ntInvalidations); |
| 15 frameView.invalidatePaintIfNeeded(*paintInvalidatorContext); | 16 frameView.invalidatePaintIfNeeded(*paintInvalidatorContext); |
| 16 } | 17 } |
| 17 | 18 |
| 18 void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& layoutObject,
const PaintPropertyTreeBuilderContext& treeContext, const PaintInvalidatorConte
xt& parentPaintInvalidatorContext, Optional<PaintInvalidatorContext>& paintInval
idatorContext) | 19 void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& layoutObject,
const PaintPropertyTreeBuilderContext& treeContext, const PaintInvalidatorConte
xt& parentPaintInvalidatorContext, Optional<PaintInvalidatorContext>& paintInval
idatorContext) |
| 19 { | 20 { |
| 20 if (!layoutObject.shouldCheckForPaintInvalidation(parentPaintInvalidatorCont
ext)) | 21 if (!layoutObject.shouldCheckForPaintInvalidation(parentPaintInvalidatorCont
ext)) |
| 21 return; | 22 return; |
| 22 | 23 |
| 23 paintInvalidatorContext.emplace(parentPaintInvalidatorContext, layoutObject)
; | 24 paintInvalidatorContext.emplace(parentPaintInvalidatorContext, layoutObject)
; |
| 24 | 25 |
| 25 if (layoutObject.mayNeedPaintInvalidationSubtree()) | 26 if (layoutObject.mayNeedPaintInvalidationSubtree()) |
| 26 paintInvalidatorContext->setForceSubtreeInvalidationCheckingWithinContai
ner(); | 27 paintInvalidatorContext->setForceSubtreeInvalidationCheckingWithinContai
ner(); |
| 27 | 28 |
| 28 PaintInvalidationReason reason = layoutObject.getMutableForPainting().invali
datePaintIfNeeded(*paintInvalidatorContext); | 29 PaintInvalidationReason reason = layoutObject.getMutableForPainting().invali
datePaintIfNeeded(*paintInvalidatorContext); |
| 29 layoutObject.getMutableForPainting().clearPaintInvalidationFlags(*paintInval
idatorContext); | 30 paintInvalidatorContext->updateForChildren(reason); |
| 31 } |
| 30 | 32 |
| 31 paintInvalidatorContext->updateForChildren(reason); | 33 void PaintInvalidator::didWalkSubtrees(const PaintInvalidatorContext& context) |
| 34 { |
| 35 context.currentObject().getMutableForPainting().clearPaintInvalidationFlags(
context); |
| 32 } | 36 } |
| 33 | 37 |
| 34 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 38 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 35 { | 39 { |
| 36 for (auto target : m_pendingDelayedPaintInvalidations) | 40 for (auto target : m_pendingDelayedPaintInvalidations) |
| 37 target->getMutableForPainting().setShouldDoDelayedFullPaintInvalidation(
); | 41 target->getMutableForPainting().setShouldDoDelayedFullPaintInvalidation(
); |
| 38 } | 42 } |
| 39 | 43 |
| 40 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |