From fb3351402941efe6ff56f2bbdaa601ce8717471e Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Wed, 9 Aug 2023 19:59:54 +0100 Subject: [PATCH] LibWeb: Support skew{X,Y} in stacking context transforms https://drafts.csswg.org/css-transforms/#SkewDefined --- .../LibWeb/Painting/StackingContext.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index fadb8e655d..5246428eb2 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -341,6 +341,32 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati if (count == 1) return Gfx::rotation_matrix({ 0.0f, 0.0f, 1.0f }, value(0)); break; + case CSS::TransformFunction::Skew: + if (count == 1) + return Gfx::FloatMatrix4x4(1, tanf(value(0)), 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + if (count == 2) + return Gfx::FloatMatrix4x4(1, tanf(value(0)), 0, 0, + tanf(value(1)), 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + break; + case CSS::TransformFunction::SkewX: + if (count == 1) + return Gfx::FloatMatrix4x4(1, tanf(value(0)), 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + break; + case CSS::TransformFunction::SkewY: + if (count == 1) + return Gfx::FloatMatrix4x4(1, 0, 0, 0, + tanf(value(0)), 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + break; default: dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", MUST(CSS::TransformationStyleValue::create(transformation.function, {}))->to_string()); }