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

Unified Diff: Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp

Issue 22900008: Make vw/vh units to work in css transforms. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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/platform/graphics/chromium/AnimationTranslationUtil.cpp
diff --git a/Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp b/Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp
index 58768f960a18cf1af7f24786f2d8d57846974cac..e0f938edb03b138341ded8f6fb2e19bccfc4e606 100644
--- a/Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp
+++ b/Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp
@@ -56,7 +56,7 @@ using namespace WebKit;
namespace WebCore {
-PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOperations& transformOperations, const FloatSize& boxSize)
+PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOperations& transformOperations, const FloatSize& boxSize, RenderView* renderView)
{
// We need to do a deep copy the transformOperations may contain ref pointers to TransformOperation objects.
OwnPtr<WebTransformOperations> webTransformOperations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations());
@@ -80,7 +80,7 @@ PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera
case TransformOperation::Translate3D:
case TransformOperation::Translate: {
TranslateTransformOperation* transform = static_cast<TranslateTransformOperation*>(transformOperations.operations()[j].get());
- webTransformOperations->appendTranslate(floatValueForLength(transform->x(), boxSize.width()), floatValueForLength(transform->y(), boxSize.height()), floatValueForLength(transform->z(), 1));
+ webTransformOperations->appendTranslate(floatValueForLength(transform->x(), boxSize.width(), renderView), floatValueForLength(transform->y(), boxSize.height(), renderView), floatValueForLength(transform->z(), 1, renderView));
break;
}
case TransformOperation::RotateX:
@@ -117,7 +117,7 @@ PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera
}
case TransformOperation::Interpolated: {
TransformationMatrix m;
- transformOperations.operations()[j]->apply(m, boxSize);
+ transformOperations.operations()[j]->apply(m, boxSize, renderView);
webTransformOperations->appendMatrix(TransformSkMatrix44Conversions::convert(m));
break;
}
@@ -134,14 +134,14 @@ PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera
}
template <class Value, class Keyframe, class Curve>
-bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&)
+bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&, RenderView* renderView)
{
curve->add(Keyframe(keyTime, value->value()), timingFunctionType);
return true;
}
template <class Value, class Keyframe, class Curve>
-bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&)
+bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&, RenderView* renderView)
{
curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2);
return true;
@@ -157,14 +157,14 @@ bool isRotationType(TransformOperation::OperationType transformType)
}
template <>
-bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize)
+bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize, RenderView* renderView)
{
bool canBlend = !lastValue;
- OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize));
+ OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize, renderView));
if (!operations)
return false;
if (!canBlend) {
- OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize));
+ OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize, renderView));
if (!lastOperations)
return false;
canBlend = lastOperations->canBlendWith(*operations);
@@ -177,14 +177,14 @@ bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransf
}
template <>
-bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize)
+bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize, RenderView* renderView)
{
bool canBlend = !lastValue;
- OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize));
+ OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize, renderView));
if (!operations)
return false;
if (!canBlend) {
- OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize));
+ OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize, renderView));
if (!lastOperations)
return false;
canBlend = lastOperations->canBlendWith(*operations);
@@ -197,7 +197,7 @@ bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTr
}
template <class Value, class Keyframe, class Curve>
-PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const CSSAnimationData* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize)
+PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const CSSAnimationData* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize, RenderView* renderView)
{
bool alternate = false;
bool reverse = false;
@@ -259,9 +259,9 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
bool addedKeyframe = false;
if (isUsingCustomBezierTimingFunction)
- addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize);
+ addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize, renderView);
else
- addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize);
+ addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize, renderView);
if (!addedKeyframe)
return nullptr;
}
@@ -278,18 +278,18 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
return webAnimation.release();
}
-PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& values, const CSSAnimationData* animation, int animationId, double timeOffset, const FloatSize& boxSize)
+PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& values, const CSSAnimationData* animation, int animationId, double timeOffset, const FloatSize& boxSize, RenderView* renderView)
{
if (values.property() == AnimatedPropertyWebkitTransform) {
OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createTransformAnimationCurve());
- return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize));
+ return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize), renderView);
}
if (values.property() == AnimatedPropertyOpacity) {
OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
- return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyOpacity, FloatSize());
+ return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyOpacity, FloatSize(), renderView);
}
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698