mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 23:29:52 +00:00
LibWeb: Support relative lengths in stop-color
calcs
This commit is contained in:
parent
db439d224a
commit
3b52b1139a
Notes:
github-actions[bot]
2025-08-04 10:30:24 +00:00
Author: https://github.com/Calme1709
Commit: 3b52b1139a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5517
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
7 changed files with 32 additions and 25 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue