Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| index 935bc431515c0bc859e42937d60581a679ff7a8a..b5d384729952a10d74bfebd69be31aa47dbfee87 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| @@ -1344,7 +1344,7 @@ void ComputedStyle::applyTransform( |
| } |
| if (applyMotionPath == ComputedStyle::IncludeMotionPath) |
| - applyMotionPathTransform(originX, originY, result); |
| + applyMotionPathTransform(originX, originY, boundingBox, result); |
| const Vector<RefPtr<TransformOperation>>& transformOperations = |
| transform().operations(); |
| @@ -1360,11 +1360,11 @@ void ComputedStyle::applyTransform( |
| void ComputedStyle::applyMotionPathTransform( |
| float originX, |
| float originY, |
| + const FloatRect& boundingBox, |
| TransformationMatrix& transform) const { |
| const StyleMotionData& motionData = |
| m_rareNonInheritedData->m_transform->m_motion; |
| - // TODO(ericwilligers): crbug.com/638055 Apply offset-position and |
| - // offset-anchor. |
| + // TODO(ericwilligers): crbug.com/638055 Apply offset-position. |
| if (!motionData.m_path) { |
| return; |
| } |
| @@ -1387,8 +1387,24 @@ void ComputedStyle::applyMotionPathTransform( |
| if (motionData.m_rotation.type == OffsetRotationFixed) |
| angle = 0; |
| - transform.translate(point.x() - originX, point.y() - originY); |
| + float originShiftX = 0; |
| + float originShiftY = 0; |
| + if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { |
| + const LengthPoint& anchor = offsetAnchor(); |
| + originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) - |
| + floatValueForLength(transformOriginX(), boundingBox.width()); |
| + originShiftY = |
| + floatValueForLength(anchor.y(), boundingBox.height()) - |
| + floatValueForLength(transformOriginY(), boundingBox.height()); |
|
alancutter (OOO until 2018)
2016/11/01 05:45:34
Needs a test for non-zero percentages.
Eric Willigers
2016/11/01 06:34:40
Done. combine-independent-anchor-transform.html (c
|
| + } |
| + |
| + transform.translate(point.x() - originX + originShiftX, |
| + point.y() - originY + originShiftY); |
| transform.rotate(angle + motionData.m_rotation.angle); |
| + |
| + if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { |
| + transform.translate(-originShiftX, -originShiftY); |
| + } |
| } |
| void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { |