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

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

Issue 2033183002: [SPv2] Paint invalidation in PreWalkTreeWalk, plumbed on PaintInvalidationState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@RootFrame
Patch Set: Created 4 years, 6 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.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2edd221a78cf73e4479d4c830b7fc0a2887f04d5
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/paint/PaintInvalidator.h"
+
+#include "core/frame/FrameView.h"
+#include "core/layout/LayoutObject.h"
+
+namespace blink {
+
+void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, const PaintPropertyTreeBuilderContext& treeContext, Optional<PaintInvalidatorContext>& paintInvalidatorContext)
+{
+ paintInvalidatorContext.emplace(*frameView.layoutView(), m_pendingDelayedPaintInvalidations);
+ frameView.invalidatePaintIfNeeded(*paintInvalidatorContext);
+}
+
+void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& layoutObject, const PaintPropertyTreeBuilderContext& treeContext, const PaintInvalidatorContext& parentPaintInvalidatorContext, Optional<PaintInvalidatorContext>& paintInvalidatorContext)
+{
+ if (!layoutObject.shouldCheckForPaintInvalidation(parentPaintInvalidatorContext))
+ return;
+
+ paintInvalidatorContext.emplace(parentPaintInvalidatorContext, layoutObject);
+
+ if (layoutObject.mayNeedPaintInvalidationSubtree())
+ paintInvalidatorContext->setForceSubtreeInvalidationCheckingWithinContainer();
+
+ PaintInvalidationReason reason = layoutObject.getMutableForPainting().invalidatePaintIfNeeded(*paintInvalidatorContext);
+ layoutObject.getMutableForPainting().clearPaintInvalidationFlags(*paintInvalidatorContext);
+
+ paintInvalidatorContext->updateForChildren(reason);
+}
+
+void PaintInvalidator::processPendingDelayedPaintInvalidations()
+{
+ for (auto target : m_pendingDelayedPaintInvalidations)
+ target->getMutableForPainting().setShouldDoDelayedFullPaintInvalidation();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698