| 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 6baebf02bfb5a7794626ffa4a5af5af5d5137593..f5e959cbef75649b67148fc4e777616208912649 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| @@ -305,31 +305,24 @@ void PaintPropertyTreeBuilder::updateTransformForNonRootSVG(
|
| }
|
| }
|
|
|
| -static CompositingReasons compositingReasonsForTransform(
|
| - const LayoutObject& object) {
|
| +static CompositingReasons compositingReasonsForTransform(const LayoutBox& box) {
|
| + const ComputedStyle& style = box.styleRef();
|
| CompositingReasons compositingReasons = CompositingReasonNone;
|
| - if (CompositingReasonFinder::requiresCompositingForTransform(object))
|
| + if (CompositingReasonFinder::requiresCompositingForTransform(box))
|
| compositingReasons |= CompositingReason3DTransform;
|
|
|
| - if (CompositingReasonFinder::requiresCompositingForTransformAnimation(
|
| - object.styleRef()))
|
| + if (CompositingReasonFinder::requiresCompositingForTransformAnimation(style))
|
| compositingReasons |= CompositingReasonActiveAnimation;
|
|
|
| - if (object.styleRef().hasWillChangeCompositingHint() &&
|
| - !object.styleRef().subtreeWillChangeContents())
|
| + if (style.hasWillChangeCompositingHint() &&
|
| + !style.subtreeWillChangeContents())
|
| compositingReasons |= CompositingReasonWillChangeCompositingHint;
|
|
|
| - if (object.isBoxModelObject()) {
|
| - const LayoutBoxModelObject* box = toLayoutBoxModelObject(&object);
|
| - if (box->hasLayer()) {
|
| - // TODO(chrishtr): move this to the descendant-dependent flags recursion
|
| - // PaintLayer::updateDescendantDependentFlags.
|
| - box->layer()->update3DTransformedDescendantStatus();
|
| -
|
| - if (box->layer()->has3DTransformedDescendant())
|
| - compositingReasons |= CompositingReason3DTransform;
|
| - }
|
| - }
|
| + if (box.hasLayer() &&
|
| + (style.hasPerspective() ||
|
| + style.usedTransformStyle3D() == TransformStyle3DPreserve3D) &&
|
| + box.layer()->has3DTransformedDescendant())
|
| + compositingReasons |= CompositingReason3DTransform;
|
|
|
| return compositingReasons;
|
| }
|
| @@ -357,36 +350,44 @@ void PaintPropertyTreeBuilder::updateTransform(
|
| if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
|
| const ComputedStyle& style = object.styleRef();
|
|
|
| - CompositingReasons compositingReasons =
|
| - compositingReasonsForTransform(object);
|
| -
|
| // A transform node is allocated for transforms, preserves-3d and any
|
| // direct compositing reason. The latter is required because this is the
|
| // only way to represent compositing both an element and its stacking
|
| // descendants.
|
| - if (object.isBox() && (style.hasTransform() || style.preserves3D() ||
|
| - compositingReasons != CompositingReasonNone)) {
|
| + bool hasTransform = false;
|
| + if (object.isBox()) {
|
| auto& box = toLayoutBox(object);
|
| - TransformationMatrix matrix;
|
| - style.applyTransform(
|
| - matrix, box.size(), ComputedStyle::ExcludeTransformOrigin,
|
| - ComputedStyle::IncludeMotionPath,
|
| - ComputedStyle::IncludeIndependentTransformProperties);
|
| -
|
| - // TODO(trchen): transform-style should only be respected if a PaintLayer
|
| - // is created.
|
| - // If a node with transform-style: preserve-3d does not exist in an
|
| - // existing rendering context, it establishes a new one.
|
| - unsigned renderingContextID = context.current.renderingContextID;
|
| - if (style.preserves3D() && !renderingContextID)
|
| - renderingContextID = PtrHash<const LayoutObject>::hash(&object);
|
|
|
| - auto& properties = object.getMutableForPainting().ensurePaintProperties();
|
| - context.forceSubtreeUpdate |= properties.updateTransform(
|
| - context.current.transform, matrix, transformOrigin(box),
|
| - context.current.shouldFlattenInheritedTransform, renderingContextID,
|
| - compositingReasons);
|
| - } else {
|
| + CompositingReasons compositingReasons =
|
| + compositingReasonsForTransform(box);
|
| +
|
| + if (style.hasTransform() || style.preserves3D() ||
|
| + compositingReasons != CompositingReasonNone) {
|
| + TransformationMatrix matrix;
|
| + style.applyTransform(
|
| + matrix, box.size(), ComputedStyle::ExcludeTransformOrigin,
|
| + ComputedStyle::IncludeMotionPath,
|
| + ComputedStyle::IncludeIndependentTransformProperties);
|
| +
|
| + // TODO(trchen): transform-style should only be respected if a
|
| + // PaintLayer
|
| + // is created.
|
| + // If a node with transform-style: preserve-3d does not exist in an
|
| + // existing rendering context, it establishes a new one.
|
| + unsigned renderingContextID = context.current.renderingContextID;
|
| + if (style.preserves3D() && !renderingContextID)
|
| + renderingContextID = PtrHash<const LayoutObject>::hash(&object);
|
| +
|
| + auto& properties =
|
| + object.getMutableForPainting().ensurePaintProperties();
|
| + context.forceSubtreeUpdate |= properties.updateTransform(
|
| + context.current.transform, matrix, transformOrigin(box),
|
| + context.current.shouldFlattenInheritedTransform, renderingContextID,
|
| + compositingReasons);
|
| + hasTransform = true;
|
| + }
|
| + }
|
| + if (!hasTransform) {
|
| if (auto* properties = object.getMutableForPainting().paintProperties())
|
| context.forceSubtreeUpdate |= properties->clearTransform();
|
| }
|
|
|