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

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

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup Created 5 years, 6 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
Index: Source/core/style/ComputedStyle.cpp
diff --git a/Source/core/style/ComputedStyle.cpp b/Source/core/style/ComputedStyle.cpp
index 5cc7e9a8c1ae9c40f2f265d82b3d3381305bafd1..a9f0f36822a83f4a16af3002969a1fd4027b4c89 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();
alancutter (OOO until 2018) 2015/06/17 07:38:33 This can just call transform().
soonm 2015/06/17 23:56:53 Done.
+
// 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,20 @@ inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& tra
return true;
}
- return false;
+ return hasScale() || hasRotate();
}
-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, ApplyTransformL2 applyTransformL2) const
{
- applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath);
+ applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath, applyTransformL2);
}
-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, ApplyTransformL2 applyTransformL2) const
{
if (!hasMotionPath())
applyMotionPath = ExcludeMotionPath;
const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
alancutter (OOO until 2018) 2015/06/17 07:38:33 This can just call transform() and be moved down t
soonm 2015/06/17 23:56:53 Done.
- 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 +931,17 @@ void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatR
transformOriginZ());
}
+ if (applyTransformL2 == IncludeTransformL2) {
+ if (hasTranslate())
+ translate()->apply(transform, boundingBox.size());
+
+ if (hasRotate())
+ rotate()->apply(transform, boundingBox.size());
+
+ if (hasScale())
+ scale()->apply(transform, boundingBox.size());
+ }
+
if (applyMotionPath == ComputedStyle::IncludeMotionPath)
applyMotionPathTransform(transform);

Powered by Google App Engine
This is Rietveld 408576698