Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| index f48b8772ce4a0e0500b69506c1569b7940b483ce..611f9fd79712c005f92863e7d024d7627b2e2af5 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| @@ -310,6 +310,20 @@ static void updateOutOfFlowContext(const LayoutObject& object, bool createdNewTr |
| } |
| } |
| +PassOwnPtr<ObjectPaintProperties::PropertyTreeContext> cacheTreeContextIfNeeded(LayoutObject& object, const PaintPropertyTreeBuilderContext& context) |
|
pdr.
2016/02/04 00:06:45
I still don't really view this as a cache any more
trchen
2016/02/04 00:51:29
recordTreeContextIfNeeded that is.
|
| +{ |
| + // Note: Currently only layer painter makes use of the cache. This condition can be changed. |
| + if (!object.hasLayer()) |
| + return nullptr; |
| + |
| + OwnPtr<ObjectPaintProperties::PropertyTreeContext> contextCache = adoptPtr(new ObjectPaintProperties::PropertyTreeContext); |
| + contextCache->paintOffset = context.paintOffset; |
| + contextCache->properties.transform = context.currentTransform; |
| + contextCache->properties.clip = context.currentClip; |
| + contextCache->properties.effect = context.currentEffect; |
| + return contextCache.release(); |
| +} |
| + |
| void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTreeBuilderContext& context) |
| { |
| PaintPropertyTreeBuilderContext localContext(context); |
| @@ -318,6 +332,7 @@ void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre |
| RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = createPaintOffsetTranslationIfNeeded(object, localContext); |
| RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTransformIfNeeded(object, localContext); |
| RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object, localContext); |
| + OwnPtr<ObjectPaintProperties::PropertyTreeContext> newContextCache = cacheTreeContextIfNeeded(object, localContext); |
| RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowClipIfNeeded(object, localContext); |
| // TODO(trchen): Insert flattening transform here, as specified by |
| // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| @@ -325,14 +340,15 @@ void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre |
| RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = createScrollTranslationIfNeeded(object, localContext); |
| updateOutOfFlowContext(object, newTransformNodeForTransform, localContext); |
| - if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransform || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspective || newTransformNodeForScrollTranslation) { |
| + if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransform || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspective || newTransformNodeForScrollTranslation || newContextCache) { |
| OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProperties::create( |
| newTransformNodeForPaintOffsetTranslation.release(), |
| newTransformNodeForTransform.release(), |
| newEffectNode.release(), |
| newClipNodeForOverflowClip.release(), |
| newTransformNodeForPerspective.release(), |
| - newTransformNodeForScrollTranslation.release()); |
| + newTransformNodeForScrollTranslation.release(), |
| + newContextCache.release()); |
| object.setObjectPaintProperties(updatedPaintProperties.release()); |
| } else { |
| object.clearObjectPaintProperties(); |