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); } |