Chromium Code Reviews| Index: Source/core/paint/LayoutObjectDrawingRecorder.h |
| diff --git a/Source/core/paint/LayoutObjectDrawingRecorder.h b/Source/core/paint/LayoutObjectDrawingRecorder.h |
| index b0da6bb6a3d838da9605d842919c131470ba19d6..2fe4597df4339e362c3aa5645d913c7a725b36f2 100644 |
| --- a/Source/core/paint/LayoutObjectDrawingRecorder.h |
| +++ b/Source/core/paint/LayoutObjectDrawingRecorder.h |
| @@ -6,7 +6,6 @@ |
| #define LayoutObjectDrawingRecorder_h |
| #include "core/layout/LayoutObject.h" |
| -#include "core/layout/line/InlineBox.h" |
| #include "core/paint/PaintPhase.h" |
| #include "platform/geometry/LayoutPoint.h" |
| #include "platform/geometry/LayoutRect.h" |
| @@ -25,8 +24,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.paintOffsetChanged(paintOffset)) |
| return false; |
| if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull) |
| return false; |
| @@ -38,19 +36,6 @@ public: |
| return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), paintOffset); |
| } |
| - 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)) |
| - return false; |
| - return DrawingRecorder::useCachedDrawingIfPossible(context, inlineBox, displayItemType); |
| - } |
| - |
| - static bool useCachedDrawingIfPossible(GraphicsContext& context, const InlineBox& inlineBox, PaintPhase phase, const LayoutPoint& paintOffset) |
| - { |
| - return useCachedDrawingIfPossible(context, inlineBox, DisplayItem::paintPhaseToDrawingType(phase), paintOffset); |
| - } |
| - |
| LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset) |
| { |
| updatePaintOffsetIfNeeded(context.displayItemList(), layoutObject, paintOffset); |
| @@ -72,38 +57,22 @@ public: |
| LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffset) |
| : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
| - LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset) |
| - { |
| - updatePaintOffsetIfNeeded(context.displayItemList(), inlineBox, paintOffset); |
| - m_drawingRecorder.emplace(context, inlineBox, displayItemType, clip); |
| - } |
| - |
| - LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, DisplayItem::Type displayItemType, const LayoutRect& clip, const LayoutPoint& paintOffset) |
| - : LayoutObjectDrawingRecorder(context, inlineBox, displayItemType, FloatRect(clip), paintOffset) { } |
| - |
| - LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOffset) |
| - : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
| - |
| - LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffset) |
| - : LayoutObjectDrawingRecorder(context, inlineBox, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip), paintOffset) { } |
| - |
| #if ENABLE(ASSERT) |
| void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationCheckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } |
| #endif |
| private: |
| - static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, const DisplayItemClientWrapper& client, const LayoutPoint& paintOffset) |
| + static void updatePaintOffsetIfNeeded(DisplayItemList* displayItemList, const LayoutObject& layoutObject, const LayoutPoint& paintOffset) |
|
pdr.
2015/09/23 19:55:47
WDYT about changing this LayoutObject to be non-co
Xianzhu
2015/09/23 21:39:44
I think making LayoutObject const for painters can
|
| { |
| 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); |
| - displayItemList->invalidatePaintOffset(client); |
| - } else { |
| - ASSERT(!displayItemList->paintOffsetWasInvalidated(client.displayItemClient()) || !displayItemList->clientCacheIsValid(client.displayItemClient())); |
| - } |
| + if (layoutObject.paintOffsetChanged(paintOffset)) |
| + displayItemList->invalidatePaintOffset(layoutObject); |
| + else |
| + ASSERT(!displayItemList->paintOffsetWasInvalidated(layoutObject.displayItemClient()) || !displayItemList->clientCacheIsValid(layoutObject.displayItemClient())); |
| + |
| + layoutObject.setPreviousPaintOffset(paintOffset); |
| } |
| Optional<DisplayItemCacheSkipper> m_cacheSkipper; |