LibWeb: Implement rotation transform functions from css-transforms-2

This commit is contained in:
Luke Wilde 2022-10-01 01:57:13 +01:00 committed by Andreas Kling
parent ddfe18783b
commit 0fdd924db2
Notes: sideshowbarker 2024-07-17 08:43:11 +09:00
2 changed files with 18 additions and 0 deletions

View file

@ -23,6 +23,15 @@
"rotate": {
"parameters": "<angle>"
},
"rotateX": {
"parameters": "<angle>"
},
"rotateY": {
"parameters": "<angle>"
},
"rotateZ": {
"parameters": "<angle>"
},
"skew": {
"parameters": "<angle>{1,2}"
},

View file

@ -251,7 +251,16 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
0, 0, 1, 0,
0, 0, 0, 1);
break;
case CSS::TransformFunction::RotateX:
if (count == 1)
return Gfx::rotation_matrix({ 1.0f, 0.0f, 0.0f }, value(0));
break;
case CSS::TransformFunction::RotateY:
if (count == 1)
return Gfx::rotation_matrix({ 0.0f, 1.0f, 0.0f }, value(0));
break;
case CSS::TransformFunction::Rotate:
case CSS::TransformFunction::RotateZ:
if (count == 1)
return Gfx::rotation_matrix({ 0.0f, 0.0f, 1.0f }, value(0));
break;