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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.h

Issue 1387923002: LayoutObject::invalidatePaintIfNeededForSynchronizedPainting() and plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 6df7725b82f4f6437a9d18bc57a405182e97228a..580a13496683ccf04a9d83ca88207a2a986e61a5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -1172,7 +1172,7 @@ public:
ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled());
return m_previousPositionFromPaintInvalidationBacking != uninitializedPaintOffset() && m_previousPositionFromPaintInvalidationBacking != newPaintOffset;
}
- void setPreviousPaintOffset(const LayoutPoint& paintOffset) const
+ void setPreviousPaintOffset(const LayoutPoint& paintOffset)
{
ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled());
m_previousPositionFromPaintInvalidationBacking = paintOffset;
@@ -1227,6 +1227,20 @@ public:
// Called before anonymousChild.setStyle(). Override to set custom styles for the child.
virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, ComputedStyle& style) const { }
+ // Painters can use const methods only, except for these explicitly declared methods.
+ class MutableForPainting {
+ public:
+ void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutObject.setPreviousPaintOffset(paintOffset); }
+ void invalidatePaintIfNeeded(const PaintInfo& paintInfo) { m_layoutObject.invalidatePaintIfNeededForSynchronizedPainting(paintInfo); }
+
+ private:
+ friend class LayoutObject;
+ MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) { }
+
+ LayoutObject& m_layoutObject;
+ };
+ MutableForPainting mutableForPainting() const { return MutableForPainting(*this); }
+
protected:
enum LayoutObjectType {
LayoutObjectBr,
@@ -1358,6 +1372,7 @@ protected:
virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childPaintInvalidationState);
virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationState&, const LayoutBoxModelObject& paintInvalidationContainer);
+ void invalidatePaintIfNeededForSynchronizedPainting(const PaintInfo&);
// When this object is invalidated for paint, this method is called to invalidate any DisplayItemClients
// owned by this object, including the object itself, LayoutText/LayoutInline line boxes, etc.,
@@ -1722,8 +1737,7 @@ private:
// This point does *not* account for composited scrolling. See adjustInvalidationRectForCompositedScrolling().
// For slimmingPaintOffsetCaching, this stores the previous paint offset.
// TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable slimmingPaintOffsetCaching.
- // TODO(wangxianzhu): Better mutation control for painting.
- mutable LayoutPoint m_previousPositionFromPaintInvalidationBacking;
+ LayoutPoint m_previousPositionFromPaintInvalidationBacking;
};
// FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit.
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698