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

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

Issue 1340133003: Paint offset caching/change-detection for InlineBoxes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/LayoutObjectDrawingRecorder.h
diff --git a/Source/core/paint/LayoutObjectDrawingRecorder.h b/Source/core/paint/LayoutObjectDrawingRecorder.h
index d2d455598c7e7e8db597f4de936b8c6f1daa6fc2..7660ac4eebeb4bc0cb0c57763af65394c675c45a 100644
--- a/Source/core/paint/LayoutObjectDrawingRecorder.h
+++ b/Source/core/paint/LayoutObjectDrawingRecorder.h
@@ -6,6 +6,7 @@
#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"
@@ -37,6 +38,19 @@ 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::slimmingPaintV2Enabled() && !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)
{
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
@@ -67,6 +81,30 @@ 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)
pdr. 2015/09/14 21:27:42 Can we use "const DisplayItemClientWrapper&" to av
Xianzhu 2015/09/14 21:43:43 There is a difference between the LayoutObject ver
+ {
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList.
+ if (!context.displayItemList()->paintOffsetIsUnchanged(inlineBox.displayItemClient(), paintOffset)) {
+ context.displayItemList()->recordPaintOffset(inlineBox.displayItemClient(), paintOffset);
+ context.displayItemList()->invalidatePaintOffset(inlineBox.displayItemClient());
+ } else {
+ ASSERT(!context.displayItemList()->paintOffsetWasInvalidated(inlineBox.displayItemClient()) || !context.displayItemList()->clientCacheIsValid(inlineBox.displayItemClient()));
+ }
+ }
+
+ m_drawingRecorder.emplace(context, inlineBox, displayItemType, clip);
+ }
+
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const InlineBox& inlineBox, DisplayItem::Type displayItemType, const LayoutRect& clip, const LayoutPoint& paintOffset)
pdr. 2015/09/14 21:27:42 Lets not add these overloaded ctors unless they ar
Xianzhu 2015/09/14 21:43:43 3 of the 4 constructors are used by painters, and
+ : 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
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698