Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintInvalidator.h |
| diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.h b/third_party/WebKit/Source/core/paint/PaintInvalidator.h |
| index 3edca170fe6c0d2e738f5bc8fa67987095ac91e3..3300d3b2caa51a0a1818c438de2e349747b85886 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.h |
| +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.h |
| @@ -5,24 +5,66 @@ |
| #ifndef PaintInvalidator_h |
| #define PaintInvalidator_h |
| -#include "core/layout/PaintInvalidationState.h" |
| -#include "wtf/Optional.h" |
| +#include "platform/geometry/LayoutRect.h" |
| #include "wtf/Vector.h" |
| namespace blink { |
| class FrameView; |
| +class LayoutBoxModelObject; |
| class LayoutObject; |
| +class PaintLayer; |
| struct PaintPropertyTreeBuilderContext; |
| -// TODO(wangxianzhu): Move applicable PaintInvalidationState code into PaintInvalidator. |
| -using PaintInvalidatorContext = PaintInvalidationState; |
| +struct PaintInvalidatorContext { |
| + PaintInvalidatorContext(const PaintPropertyTreeBuilderContext& treeBuilderContext) |
| + : treeBuilderContext(treeBuilderContext) { } |
| + |
| + PaintInvalidatorContext(const PaintPropertyTreeBuilderContext& treeBuilderContext, const PaintInvalidatorContext& parentContext) |
| + : treeBuilderContext(treeBuilderContext) |
| + , paintInvalidationContainer(parentContext.paintInvalidationContainer) |
| + , paintInvalidationContainerForStackedContents(parentContext.paintInvalidationContainerForStackedContents) |
| + , paintingLayer(parentContext.paintingLayer) |
| + { } |
| + |
| + // This interface is temporary to adapt PaintInvalidatorContext and the legacy PaintInvalidationState |
|
chrishtr
2016/08/09 23:47:31
s/interface/method/
Xianzhu
2016/08/10 16:25:01
Done.
|
| + // for code shared by old code and new code. |
| + virtual void mapLocalRectToPaintInvalidationBacking(const LayoutObject&, LayoutRect&) const; |
| + |
| + const PaintPropertyTreeBuilderContext& treeBuilderContext; |
| + |
| + enum ForcedSubtreeInvalidationFlag { |
| + ForcedSubtreeInvalidationChecking = 1 << 0, |
| + ForcedSubtreeInvalidationRectUpdate = 1 << 1, |
| + ForcedSubtreeFullInvalidation = 1 << 2, |
| + ForcedSubtreeFullInvalidationForStackedContents = 1 << 3, |
| + }; |
| + unsigned forcedSubtreeInvalidationFlags = 0; |
| + |
| + // The following fields can be null only before PaintInvalidator::updateContext(). |
| + |
| + // The current paint invalidation container for normal flow objects. |
| + // It is the enclosing composited object. |
| + const LayoutBoxModelObject* paintInvalidationContainer = nullptr; |
| + |
| + // The current paint invalidation container for stacked contents (stacking contexts or positioned objects). |
| + // It is the nearest ancestor composited object which establishes a stacking context. |
| + // See Source/core/paint/README.md ### PaintInvalidationState for details on how stacked contents' |
| + // paint invalidation containers differ. |
| + const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = nullptr; |
| + |
| + PaintLayer* paintingLayer = nullptr; |
| + |
| + LayoutRect oldBounds; |
| + LayoutRect newBounds; |
| + LayoutPoint oldLocation; |
| + LayoutPoint newLocation; |
| +}; |
| class PaintInvalidator { |
| public: |
| - // TODO(wangxianzhu): Avoid Optional<> by using copy-and-update pattern for PaintInvalidatorContext. |
| - void invalidatePaintIfNeeded(FrameView&, const PaintPropertyTreeBuilderContext&, Optional<PaintInvalidatorContext>&); |
| - void invalidatePaintIfNeeded(const LayoutObject&, const PaintPropertyTreeBuilderContext&, const PaintInvalidatorContext&, Optional<PaintInvalidatorContext>&); |
| + void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); |
| + void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); |
| // Process objects needing paint invalidation on the next frame. |
| // See the definition of PaintInvalidationDelayedFull for more details. |