LibWeb: Support individual scale CSS property

This commit is contained in:
Andreas Kling
2024-11-22 18:07:16 +01:00
committed by Andreas Kling
parent 66a821e731
commit 9a7c9286c4
21 changed files with 234 additions and 55 deletions

View File

@@ -29,6 +29,7 @@
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
#include <LibWeb/CSS/StyleValues/RotationStyleValue.h>
#include <LibWeb/CSS/StyleValues/ScaleStyleValue.h>
#include <LibWeb/CSS/StyleValues/ScrollbarGutterStyleValue.h>
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
@@ -614,6 +615,20 @@ Optional<CSS::Transformation> StyleProperties::translate() const
return CSS::Transformation(CSS::TransformFunction::Translate, move(values));
}
Optional<CSS::Transformation> StyleProperties::scale() const
{
auto const& value = property(CSS::PropertyID::Scale);
if (!value.is_scale())
return {};
auto const& scale = value.as_scale();
Vector<TransformValue> values;
values.append(scale.x());
values.append(scale.y());
return CSS::Transformation(CSS::TransformFunction::Scale, move(values));
}
static Optional<LengthPercentage> length_percentage_for_style_value(CSSStyleValue const& value)
{
if (value.is_length())