mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Support relative lengths in stop-color calcs
This commit is contained in:
Notes:
github-actions[bot]
2025-08-04 10:30:24 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3b52b1139a9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5517 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/gmta
@@ -1813,24 +1813,6 @@ MaskType ComputedProperties::mask_type() const
|
||||
return keyword_to_mask_type(value.to_keyword()).release_value();
|
||||
}
|
||||
|
||||
Color ComputedProperties::stop_color() const
|
||||
{
|
||||
NonnullRawPtr<CSSStyleValue const> value = property(PropertyID::StopColor);
|
||||
if (value->is_keyword()) {
|
||||
// Workaround lack of layout node to resolve current color.
|
||||
auto const& keyword = value->as_keyword();
|
||||
if (keyword.keyword() == Keyword::Currentcolor)
|
||||
value = property(PropertyID::Color);
|
||||
}
|
||||
if (value->has_color()) {
|
||||
// FIXME: This is used by the SVGStopElement, which does not participate in layout, so we can't pass a layout
|
||||
// node or CalculationResolutionContext. This means we don't support all valid colors (e.g. palette
|
||||
// colors, calculated values which depend on length resolution, etc)
|
||||
return value->to_color({}).value_or(Color::Black);
|
||||
}
|
||||
return Color::Black;
|
||||
}
|
||||
|
||||
void ComputedProperties::set_math_depth(int math_depth)
|
||||
{
|
||||
m_math_depth = math_depth;
|
||||
|
||||
Reference in New Issue
Block a user