Chromium Code Reviews| Index: Source/core/style/ComputedStyle.cpp |
| diff --git a/Source/core/style/ComputedStyle.cpp b/Source/core/style/ComputedStyle.cpp |
| index 5cc7e9a8c1ae9c40f2f265d82b3d3381305bafd1..29fba5724149c300315a33db76711964cbe1434e 100644 |
| --- a/Source/core/style/ComputedStyle.cpp |
| +++ b/Source/core/style/ComputedStyle.cpp |
| @@ -883,15 +883,17 @@ bool ComputedStyle::hasWillChangeCompositingHint() const |
| return false; |
| } |
| -inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, ComputedStyle::ApplyTransformOrigin applyOrigin, ComputedStyle::ApplyMotionPath applyMotionPath) |
| +bool ComputedStyle::requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath) const |
| { |
| + const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations(); |
| + |
| // transform-origin brackets the transform with translate operations. |
| // Optimize for the case where the only transform is a translation, since the transform-origin is irrelevant |
| // in that case. |
| - if (applyOrigin != ComputedStyle::IncludeTransformOrigin) |
| + if (applyOrigin != IncludeTransformOrigin) |
| return false; |
| - if (applyMotionPath == ComputedStyle::IncludeMotionPath) |
| + if (applyMotionPath == IncludeMotionPath) |
| return true; |
| unsigned size = transformOperations.size(); |
| @@ -905,20 +907,23 @@ inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& tra |
| return true; |
| } |
| + if (hasScaleProperty() || hasRotateProperty()) |
| + return true; |
| + |
| return false; |
| } |
| -void ComputedStyle::applyTransform(TransformationMatrix& transform, const LayoutSize& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath) const |
| +void ComputedStyle::applyTransform(TransformationMatrix& transform, const LayoutSize& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath, ApplyTransformProperty applyTransformProperty) const |
| { |
| - applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath); |
| + applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath, applyTransformProperty); |
| } |
| -void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath) const |
| +void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath, ApplyTransformProperty applyTransformProperty) const |
| { |
| if (!hasMotionPath()) |
| applyMotionPath = ExcludeMotionPath; |
| const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations(); |
| - bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin, applyMotionPath); |
| + bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionPath); |
| float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; |
| float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; |
| @@ -929,6 +934,23 @@ void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatR |
| transformOriginZ()); |
| } |
| + if (applyTransformProperty == IncludeTransformProperty) { |
|
dstockwell
2015/06/12 00:17:58
It's confusing that IncludeTransformProperty doesn
soonm
2015/06/12 01:54:12
Change to IncludeTransformL2
|
| + if (hasTranslateProperty()) { |
| + RefPtr<TransformOperation> translateOp = translate(); |
| + translateOp->apply(transform, boundingBox.size()); |
| + } |
| + |
| + if (hasRotateProperty()) { |
| + RefPtr<TransformOperation> rotateOp = rotate(); |
| + rotateOp->apply(transform, boundingBox.size()); |
| + } |
| + |
| + if (hasScaleProperty()) { |
| + RefPtr<TransformOperation> scaleOp = scale(); |
| + scaleOp->apply(transform, boundingBox.size()); |
| + } |
| + } |
| + |
| if (applyMotionPath == ComputedStyle::IncludeMotionPath) |
| applyMotionPathTransform(transform); |