Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: third_party/WebKit/Source/core/paint/PaintInvalidator.h

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c305541537a1550ac9706eac94860fe66522ac93 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidator.h
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.h
@@ -5,24 +5,67 @@
#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)
+ , forcedSubtreeInvalidationFlags(parentContext.forcedSubtreeInvalidationFlags)
+ , 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.

Powered by Google App Engine
This is Rietveld 408576698