mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Allow calculated values in transform
This commit is contained in:
parent
e23d31ae83
commit
344f37986f
Notes:
sideshowbarker
2024-07-16 20:31:50 +09:00
Author: https://github.com/stelar7 Commit: https://github.com/SerenityOS/serenity/commit/344f37986f Pull-request: https://github.com/SerenityOS/serenity/pull/19169
@ -400,7 +400,20 @@ Vector<CSS::Transformation> StyleProperties::transformations() const
|
||||
transformation.function = transformation_style_value.transform_function();
|
||||
Vector<TransformValue> values;
|
||||
for (auto& transformation_value : transformation_style_value.values()) {
|
||||
if (transformation_value->is_length()) {
|
||||
if (transformation_value->is_calculated()) {
|
||||
auto& calculated = transformation_value->as_calculated();
|
||||
if (calculated.resolves_to_length()) {
|
||||
dbgln("FIXME: Unable to resolve length with no layout node! {}", calculated.to_string());
|
||||
} else if (calculated.resolves_to_percentage()) {
|
||||
values.append({ calculated.resolve_percentage().value() });
|
||||
} else if (calculated.resolves_to_number()) {
|
||||
values.append({ calculated.resolve_number().value() });
|
||||
} else if (calculated.resolves_to_angle()) {
|
||||
values.append({ calculated.resolve_angle().value() });
|
||||
} else {
|
||||
dbgln("FIXME: Unsupported calc value in transform! {}", calculated.to_string());
|
||||
}
|
||||
} else if (transformation_value->is_length()) {
|
||||
values.append({ transformation_value->as_length().length() });
|
||||
} else if (transformation_value->is_percentage()) {
|
||||
values.append({ transformation_value->as_percentage().percentage() });
|
||||
@ -409,7 +422,7 @@ Vector<CSS::Transformation> StyleProperties::transformations() const
|
||||
} else if (transformation_value->is_angle()) {
|
||||
values.append({ transformation_value->as_angle().angle() });
|
||||
} else {
|
||||
dbgln("FIXME: Unsupported value in transform!");
|
||||
dbgln("FIXME: Unsupported value in transform! {}", transformation_value->to_string());
|
||||
}
|
||||
}
|
||||
transformation.values = move(values);
|
||||
|
@ -745,7 +745,7 @@ Optional<Time> CalculatedStyleValue::resolve_time_percentage(Time const& percent
|
||||
});
|
||||
}
|
||||
|
||||
Optional<float> CalculatedStyleValue::resolve_number()
|
||||
Optional<float> CalculatedStyleValue::resolve_number() const
|
||||
{
|
||||
auto result = m_calculation->resolve(nullptr, {});
|
||||
if (result.value().has<Number>())
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
|
||||
bool resolves_to_integer() const { return m_resolved_type == ResolvedType::Integer; }
|
||||
bool resolves_to_number() const { return resolves_to_integer() || m_resolved_type == ResolvedType::Number; }
|
||||
Optional<float> resolve_number();
|
||||
Optional<float> resolve_number() const;
|
||||
Optional<i64> resolve_integer();
|
||||
|
||||
bool contains_percentage() const;
|
||||
|
Loading…
Reference in New Issue
Block a user