Index: Source/core/paint/LayoutObjectDrawingRecorder.h |
diff --git a/Source/core/paint/LayoutObjectDrawingRecorder.h b/Source/core/paint/LayoutObjectDrawingRecorder.h |
index b0da6bb6a3d838da9605d842919c131470ba19d6..3634a315b60bc444316a9e4a566a94c6c5056dae 100644 |
--- a/Source/core/paint/LayoutObjectDrawingRecorder.h |
+++ b/Source/core/paint/LayoutObjectDrawingRecorder.h |
@@ -25,8 +25,7 @@ class LayoutObjectDrawingRecorder final { |
public: |
static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutPoint& paintOffset) |
{ |
- // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList. |
- if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !context.displayItemList()->paintOffsetIsUnchanged(layoutObject.displayItemClient(), paintOffset)) |
+ if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && layoutObject.previousPaintOffset() != paintOffset) |
return false; |
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull) |
return false; |
@@ -40,8 +39,7 @@ public: |
static bool useCachedDrawingIfPossible(GraphicsContext& context, const InlineBox& inlineBox, DisplayItem::Type displayItemType, const LayoutPoint& paintOffset) |
{ |
- // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList. |
- if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !context.displayItemList()->paintOffsetIsUnchanged(inlineBox.displayItemClient(), paintOffset)) |
+ if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && inlineBox.layoutObject().previousPaintOffset() != paintOffset) |
return false; |
return DrawingRecorder::useCachedDrawingIfPossible(context, inlineBox, displayItemType); |
} |
@@ -53,7 +51,7 @@ public: |
LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset) |
{ |
- updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject, paintOffset); |
+ updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject, layoutObject, paintOffset); |
// We may paint a delayed-invalidation object before it's actually invalidated. |
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull) |
m_cacheSkipper.emplace(context); |
@@ -74,7 +72,7 @@ public: |
LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset) |
{ |
- updatePaintOffsetIfNeeded(context.displayItemList(), inlineBox, paintOffset); |
+ updatePaintOffsetIfNeeded(context.displayItemList(), inlineBox.layoutObject(), inlineBox, paintOffset); |
m_drawingRecorder.emplace(context, inlineBox, displayItemType, clip); |
} |
@@ -92,14 +90,13 @@ public: |
#endif |
private: |
- static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, const DisplayItemClientWrapper& client, const LayoutPoint& paintOffset) |
+ static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, const LayoutObject& layoutObject, const DisplayItemClientWrapper& client, const LayoutPoint& paintOffset) |
{ |
if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()) |
return; |
- // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList. |
- if (!displayItemList->paintOffsetIsUnchanged(client.displayItemClient(), paintOffset)) { |
- displayItemList->recordPaintOffset(client.displayItemClient(), paintOffset); |
+ if (layoutObject.previousPaintOffset() != paintOffset) { |
+ layoutObject.setPreviousPaintOffset(paintOffset); |
displayItemList->invalidatePaintOffset(client); |
} else { |
ASSERT(!displayItemList->paintOffsetWasInvalidated(client.displayItemClient()) || !displayItemList->clientCacheIsValid(client.displayItemClient())); |