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

Unified Diff: Source/core/paint/LayoutObjectDrawingRecorder.h

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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: Source/core/paint/LayoutObjectDrawingRecorder.h
diff --git a/Source/core/paint/LayoutObjectDrawingRecorder.h b/Source/core/paint/LayoutObjectDrawingRecorder.h
index 6438e65187fb662393470a266e728e3e07af29c8..7220e62bee4688a357e00617a478b452a9c9a8e8 100644
--- a/Source/core/paint/LayoutObjectDrawingRecorder.h
+++ b/Source/core/paint/LayoutObjectDrawingRecorder.h
@@ -7,6 +7,7 @@
#include "core/layout/LayoutObject.h"
#include "core/paint/PaintPhase.h"
+#include "platform/geometry/LayoutPoint.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/paint/DisplayItemCacheSkipper.h"
#include "platform/graphics/paint/DrawingRecorder.h"
@@ -19,28 +20,40 @@ class GraphicsContext;
// Convenience wrapper of DrawingRecorder for LayoutObject painters.
class LayoutObjectDrawingRecorder final {
public:
- static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType)
+ static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutPoint& paintOffset)
{
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && paintOffset != layoutObject.cachedPaintOffset())
+ return false;
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull)
return false;
return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject, displayItemType);
}
- static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase)
+ static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const LayoutPoint& paintOffset)
{
- return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase));
+ return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), paintOffset);
}
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip)
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset)
{
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ if (paintOffset != layoutObject.cachedPaintOffset()) {
+ ASSERT(!context.displayItemList()->paintOffsetWasInvalidated(layoutObject.displayItemClient()));
+ layoutObject.updateCachedPaintOffset(paintOffset);
+ context.displayItemList()->invalidatePaintOffset(layoutObject.displayItemClient());
+ } else {
+ ASSERT(!context.displayItemList()->paintOffsetWasInvalidated(layoutObject.displayItemClient()) || !context.displayItemList()->clientCacheIsValid(layoutObject.displayItemClient()));
+ }
+ }
+
// We may paint a delayed-invalidation object before it's actually invalidated.
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull)
m_cacheSkipper.emplace(context);
m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip);
}
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip)
- : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { }
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOffset)
+ : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip, paintOffset) { }
#if ENABLE(ASSERT)
void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationCheckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); }

Powered by Google App Engine
This is Rietveld 408576698