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..33f073b480bac85f00f10a522955c37967765403 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 method is temporary to adapt PaintInvalidatorContext and the legacy PaintInvalidationState |
+ // 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. |