Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Unified Diff: Source/core/style/ComputedStyle.cpp

Issue 1220793011: CSS Motion Path: Centre transform-origin on the path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/ComputedStyle.cpp
diff --git a/Source/core/style/ComputedStyle.cpp b/Source/core/style/ComputedStyle.cpp
index 62db59fdfab9b0b4e2ccfefcf45d06a3883bd2ca..7297085c526e2418972a207719d5a947d21eca59 100644
--- a/Source/core/style/ComputedStyle.cpp
+++ b/Source/core/style/ComputedStyle.cpp
@@ -927,10 +927,15 @@ void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0;
float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
+ float originX = 0;
+ float originY = 0;
+ float originZ = 0;
+
if (applyTransformOrigin) {
- result.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
- floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
- transformOriginZ());
+ originX = floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX;
+ originY = floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY;
+ originZ = transformOriginZ();
+ result.translate3d(originX, originY, originZ);
}
if (applyIndependentTransformProperties == IncludeIndependentTransformProperties) {
@@ -945,7 +950,7 @@ void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
}
if (applyMotionPath == ComputedStyle::IncludeMotionPath)
- applyMotionPathTransform(result);
+ applyMotionPathTransform(originX, originY, result);
const Vector<RefPtr<TransformOperation>>& transformOperations = transform().operations();
unsigned size = transformOperations.size();
@@ -953,13 +958,11 @@ void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
transformOperations[i]->apply(result, boundingBox.size());
if (applyTransformOrigin) {
- result.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
- -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
- -transformOriginZ());
+ result.translate3d(-originX, -originY, -originZ);
}
}
-void ComputedStyle::applyMotionPathTransform(TransformationMatrix& transform) const
+void ComputedStyle::applyMotionPathTransform(float originX, float originY, TransformationMatrix& transform) const
{
const StyleMotionData& motionData = rareNonInheritedData->m_transform->m_motion;
ASSERT(motionData.m_path && motionData.m_path->isPathStyleMotionPath());
@@ -982,7 +985,7 @@ void ComputedStyle::applyMotionPathTransform(TransformationMatrix& transform) co
if (motionData.m_rotationType == MotionRotationFixed)
angle = 0;
- transform.translate(point.x(), point.y());
+ transform.translate(point.x() - originX, point.y() - originY);
transform.rotate(angle + motionData.m_rotation);
}
« no previous file with comments | « Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698