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 5ba038079482d5cd8ec1b041cfdbb9787309baee..75b495126e9616b7337e18dfdad0ef03fec3090d 100644 |
--- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h |
+++ b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h |
@@ -6,11 +6,13 @@ |
#define LayoutObjectDrawingRecorder_h |
#include "core/layout/LayoutObject.h" |
+#include "core/paint/ObjectPaintProperties.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" |
+#include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
#include "wtf/Allocator.h" |
#include "wtf/Optional.h" |
@@ -28,6 +30,15 @@ public: |
return false; |
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull) |
return false; |
+ |
+ Optional<ScopedPaintChunkProperties> propertyScope; |
jbroman
2016/02/01 16:44:20
I'm not convinced LayoutObjectDrawingRecorder is t
|
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
+ // TODO(pdr): Refactor this so it is not called twice (again in useCachedDrawingIfPossible). |
+ bool willUseCachedDrawing = !context.paintController().clientCacheIsValid(layoutObject); |
+ if (willUseCachedDrawing) |
+ updatePropertyScope(propertyScope, context, layoutObject); |
+ } |
+ |
return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject, displayItemType); |
} |
@@ -38,6 +49,7 @@ public: |
LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset) |
{ |
+ updatePropertyScope(m_propertyScope, context, layoutObject); |
updatePaintOffsetIfNeeded(context.paintController(), layoutObject, paintOffset); |
// We may paint a delayed-invalidation object before it's actually invalidated. |
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull) |
@@ -63,6 +75,31 @@ public: |
void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationCheckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); } |
#endif |
+ static void updatePropertyScope(Optional<ScopedPaintChunkProperties>& scopedPaintChunkProperties, GraphicsContext& context, const LayoutObject& layoutObject) |
+ { |
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
+ return; |
+ |
+ // Only objects with properties and no layer need to update paint |
+ // properties, as PaintLayerPainter will handle all other cases. |
trchen
2016/02/02 01:34:48
This statement is not true. For example, a PaintLa
|
+ // (see: PaintLayerPainter::paintLayerContents). |
+ if (!layoutObject.objectPaintProperties() || layoutObject.hasLayer()) |
+ return; |
+ |
+ const ObjectPaintProperties& objectProperties = *layoutObject.objectPaintProperties(); |
+ PaintChunkProperties properties(context.paintController().currentPaintChunkProperties()); |
+ if (TransformPaintPropertyNode* transform = objectProperties.paintOffsetTranslation()) |
+ properties.transform = transform; |
+ if (TransformPaintPropertyNode* transform = objectProperties.transform()) |
+ properties.transform = transform; |
+ if (TransformPaintPropertyNode* transform = objectProperties.perspective()) |
+ properties.transform = transform; |
+ if (TransformPaintPropertyNode* transform = objectProperties.scrollTranslation()) |
+ properties.transform = transform; |
+ if (EffectPaintPropertyNode* effect = objectProperties.effect()) |
+ properties.effect = effect; |
+ scopedPaintChunkProperties.emplace(context.paintController(), properties); |
+ } |
private: |
static void updatePaintOffsetIfNeeded(PaintController& paintController, const LayoutObject& layoutObject, const LayoutPoint& paintOffset) |
{ |
@@ -77,6 +114,7 @@ private: |
layoutObject.mutableForPainting().setPreviousPaintOffset(paintOffset); |
} |
+ Optional<ScopedPaintChunkProperties> m_propertyScope; |
Optional<DisplayItemCacheSkipper> m_cacheSkipper; |
Optional<DrawingRecorder> m_drawingRecorder; |
}; |