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

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

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 years, 9 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 37e609a2abd27fb80c88f674a7313668d31b4d0d..b396ee793cd5619b1f07cef3b95adafdf0645802 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidator.h
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.h
@@ -5,28 +5,24 @@
#ifndef PaintInvalidator_h
#define PaintInvalidator_h
+#include "core/layout/LayoutObject.h"
+#include "core/paint/PaintPropertyTreeBuilder.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/paint/GeometryMapper.h"
#include "wtf/Vector.h"
namespace blink {
-class FrameView;
-class LayoutBoxModelObject;
-class LayoutObject;
-class PaintLayer;
-struct PaintPropertyTreeBuilderContext;
-
struct PaintInvalidatorContext {
PaintInvalidatorContext(
- const PaintPropertyTreeBuilderContext& treeBuilderContext,
+ const PaintPropertyTreeBuilderContext* treeBuilderContext,
GeometryMapper& geometryMapper)
: parentContext(nullptr),
m_treeBuilderContext(treeBuilderContext),
m_geometryMapper(geometryMapper) {}
PaintInvalidatorContext(
- const PaintPropertyTreeBuilderContext& treeBuilderContext,
+ const PaintPropertyTreeBuilderContext* treeBuilderContext,
const PaintInvalidatorContext& parentContext)
: parentContext(&parentContext),
forcedSubtreeInvalidationFlags(
@@ -43,14 +39,27 @@ struct PaintInvalidatorContext {
virtual void mapLocalRectToVisualRectInBacking(const LayoutObject&,
LayoutRect&) const;
+ bool needsVisualRectUpdate(const LayoutObject& object) const {
+ if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ return true;
+#if DCHECK_IS_ON()
+ if (m_forceVisualRectUpdateForChecking)
+ return true;
+#endif
+ return object.needsPaintOffsetAndVisualRectUpdate() ||
+ (forcedSubtreeInvalidationFlags &
+ PaintInvalidatorContext::ForcedSubtreeVisualRectUpdate);
+ }
+
const PaintInvalidatorContext* parentContext;
enum ForcedSubtreeInvalidationFlag {
ForcedSubtreeInvalidationChecking = 1 << 0,
- ForcedSubtreeInvalidationRectUpdate = 1 << 1,
+ ForcedSubtreeVisualRectUpdate = 1 << 1,
ForcedSubtreeFullInvalidation = 1 << 2,
ForcedSubtreeFullInvalidationForStackedContents = 1 << 3,
ForcedSubtreeSVGResourceChange = 1 << 4,
+
// TODO(crbug.com/637313): This is temporary before we support filters in
// paint property tree.
ForcedSubtreeSlowPathRect = 1 << 5,
@@ -101,8 +110,13 @@ struct PaintInvalidatorContext {
private:
friend class PaintInvalidator;
- const PaintPropertyTreeBuilderContext& m_treeBuilderContext;
+ const PaintPropertyTreeBuilderContext* m_treeBuilderContext;
GeometryMapper& m_geometryMapper;
+
+#if DCHECK_IS_ON()
+ friend class FindVisualRectNeedingUpdateScopeBase;
+ mutable bool m_forceVisualRectUpdateForChecking = false;
+#endif
};
class PaintInvalidator {
@@ -131,6 +145,8 @@ class PaintInvalidator {
PaintInvalidatorContext&);
ALWAYS_INLINE void updatePaintInvalidationContainer(const LayoutObject&,
PaintInvalidatorContext&);
+ ALWAYS_INLINE void updateVisualRectIfNeeded(const LayoutObject&,
+ PaintInvalidatorContext&);
ALWAYS_INLINE void updateVisualRect(const LayoutObject&,
PaintInvalidatorContext&);

Powered by Google App Engine
This is Rietveld 408576698