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

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

Issue 1363613002: Save previous paint offset in LayoutObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No union (many compilers don't allow constructors); Fix a typo perhaps caused by switching to combiā€¦ Created 5 years, 3 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: third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h
diff --git a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h
index b0da6bb6a3d838da9605d842919c131470ba19d6..800fe2bb2b71cc703a83c07701df7c80ac3aecbd 100644
--- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h
+++ b/third_party/WebKit/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)
{
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;

Powered by Google App Engine
This is Rietveld 408576698