Bug 779395 - Add support for skew transforms to compositor-driven animations r=dbaron

This commit is contained in:
David Zbarsky 2013-05-21 18:22:44 +08:00
parent 39660769e8
commit c0eb3c766a
3 changed files with 24 additions and 4 deletions

View File

@ -284,14 +284,21 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
{
float x = aFunctions[i].get_SkewX().x();
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skewx, resultTail);
arr->Item(1).SetFloatValue(x, eCSSUnit_Number);
arr->Item(1).SetFloatValue(x, eCSSUnit_Radian);
break;
}
case TransformFunction::TSkewY:
{
float y = aFunctions[i].get_SkewY().y();
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skewy, resultTail);
arr->Item(1).SetFloatValue(y, eCSSUnit_Number);
arr->Item(1).SetFloatValue(y, eCSSUnit_Radian);
break;
}
case TransformFunction::TSkew:
{
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_skew, resultTail);
arr->Item(1).SetFloatValue(aFunctions[i].get_Skew().x(), eCSSUnit_Radian);
arr->Item(2).SetFloatValue(aFunctions[i].get_Skew().y(), eCSSUnit_Radian);
break;
}
case TransformFunction::TTransformMatrix:

View File

@ -100,6 +100,7 @@ struct Scale {
float y;
float z;
};
struct Skew { float x; float y; };
struct SkewX { float x; };
struct SkewY { float y; };
struct TransformMatrix { gfx3DMatrix value; };
@ -117,6 +118,7 @@ union TransformFunction {
Rotation;
Rotation3D;
Scale;
Skew;
SkewX;
SkewY;
Translation;

View File

@ -201,16 +201,27 @@ static void AddTransformFunctions(nsCSSValueList* aList,
}
case eCSSKeyword_skewx:
{
double x = array->Item(1).GetFloatValue();
double x = array->Item(1).GetAngleValueInRadians();
aFunctions.AppendElement(SkewX(x));
break;
}
case eCSSKeyword_skewy:
{
double y = array->Item(1).GetFloatValue();
double y = array->Item(1).GetAngleValueInRadians();
aFunctions.AppendElement(SkewY(y));
break;
}
case eCSSKeyword_skew:
{
double x = array->Item(1).GetAngleValueInRadians();
// skew(x) is shorthand for skew(x, 0)
double y = 0;
if (array->Count() == 3) {
y = array->Item(2).GetAngleValueInRadians();
}
aFunctions.AppendElement(Skew(x, y));
break;
}
case eCSSKeyword_matrix:
{
gfx3DMatrix matrix;