mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb/CSS: Merge ScaleStyleValue into TransformationStyleValue
The only ways this varies from the `scale()` function is with parsing and serialization. Parsing stays separate, and serialization is done by telling `TransformationStyleValue` which property it is, and overriding its normal `to_string()` code for properties other than `transform`.
This commit is contained in:
parent
bd5d1b092a
commit
ac15e626dd
Notes:
github-actions[bot]
2025-01-17 09:15:32 +00:00
Author: https://github.com/AtkinsSJ
Commit: ac15e626dd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3263
12 changed files with 52 additions and 132 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -31,7 +31,6 @@
|
|||
#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>
|
||||
|
@ -611,18 +610,12 @@ Optional<CSS::Transformation> ComputedProperties::translate() const
|
|||
return CSS::Transformation(CSS::TransformFunction::Translate, move(values));
|
||||
}
|
||||
|
||||
Optional<CSS::Transformation> ComputedProperties::scale() const
|
||||
Optional<Transformation> ComputedProperties::scale() const
|
||||
{
|
||||
auto const& value = property(CSS::PropertyID::Scale);
|
||||
if (!value.is_scale())
|
||||
auto const& value = property(PropertyID::Scale);
|
||||
if (!value.is_transformation())
|
||||
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));
|
||||
return value.as_transformation().to_transformation();
|
||||
}
|
||||
|
||||
static Optional<LengthPercentage> length_percentage_for_style_value(CSSStyleValue const& value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue