mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/CSS: Absolutize GradientStyleValues
This lets us not care about non-absolute Length units when resolving gradient data, as they'll already have been converted to px. We can also use Angle::from_style_value() safely on absolutized angles, which reduces some boilerplate code.
This commit is contained in:
parent
fbe0567f90
commit
f81bb1bd8c
Notes:
github-actions[bot]
2025-12-01 11:09:51 +00:00
Author: https://github.com/AtkinsSJ
Commit: f81bb1bd8c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6894
Reviewed-by: https://github.com/Calme1709
Reviewed-by: https://github.com/gmta
10 changed files with 205 additions and 161 deletions
|
|
@ -16,6 +16,24 @@ GC::Ref<CSSStyleValue> AbstractImageStyleValue::reify(JS::Realm& realm, FlyStrin
|
|||
return CSSImageValue::create(realm, *this);
|
||||
}
|
||||
|
||||
ColorStopListElement ColorStopListElement::absolutized(ComputationContext const& context) const
|
||||
{
|
||||
auto absolutize_if_nonnull = [&context](RefPtr<StyleValue const> const& input) -> RefPtr<StyleValue const> {
|
||||
if (!input)
|
||||
return {};
|
||||
return input->absolutized(context);
|
||||
};
|
||||
|
||||
return {
|
||||
.transition_hint = transition_hint,
|
||||
.color_stop = {
|
||||
.color = absolutize_if_nonnull(color_stop.color),
|
||||
.position = absolutize_if_nonnull(color_stop.position),
|
||||
.second_position = absolutize_if_nonnull(color_stop.second_position),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
void serialize_color_stop_list(StringBuilder& builder, Vector<ColorStopListElement> const& color_stop_list, SerializationMode mode)
|
||||
{
|
||||
bool first = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue