mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Store GradientStyleValue color-stop positions as StyleValues
A few things fall out of this: - We no longer need to templatize our color-stop list types. - A bit more code is required to resolve gradient data. This results in a slightly different rendering for a couple of the test gradients, with a larger difference between macOS and Linux. I've expanded the fuzziness factor to cover for it.
This commit is contained in:
parent
71397c876c
commit
73fbaaba77
Notes:
github-actions[bot]
2025-12-01 11:10:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: 73fbaaba77
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 103 additions and 85 deletions
|
|
@ -16,4 +16,23 @@ GC::Ref<CSSStyleValue> AbstractImageStyleValue::reify(JS::Realm& realm, FlyStrin
|
|||
return CSSImageValue::create(realm, *this);
|
||||
}
|
||||
|
||||
void serialize_color_stop_list(StringBuilder& builder, Vector<ColorStopListElement> const& color_stop_list, SerializationMode mode)
|
||||
{
|
||||
bool first = true;
|
||||
for (auto const& element : color_stop_list) {
|
||||
if (!first)
|
||||
builder.append(", "sv);
|
||||
|
||||
if (element.transition_hint.has_value())
|
||||
builder.appendff("{}, "sv, element.transition_hint->value->to_string(mode));
|
||||
|
||||
builder.append(element.color_stop.color->to_string(mode));
|
||||
if (element.color_stop.position)
|
||||
builder.appendff(" {}"sv, element.color_stop.position->to_string(mode));
|
||||
if (element.color_stop.second_position)
|
||||
builder.appendff(" {}"sv, element.color_stop.second_position->to_string(mode));
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue