mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 07:22:21 +00:00
LibWeb: Support relative lengths in calc
color values
Gains us ~40 WPT tests.
This commit is contained in:
parent
62d138ebf7
commit
9ab7c5d08d
Notes:
github-actions[bot]
2025-07-04 12:20:09 +00:00
Author: https://github.com/Calme1709
Commit: 9ab7c5d08d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5284
Reviewed-by: https://github.com/AtkinsSJ ✅
17 changed files with 169 additions and 74 deletions
|
@ -937,11 +937,20 @@ String CanvasRenderingContext2D::shadow_color() const
|
|||
void CanvasRenderingContext2D::set_shadow_color(String color)
|
||||
{
|
||||
// 1. Let context be this's canvas attribute's value, if that is an element; otherwise null.
|
||||
auto& context = canvas_element();
|
||||
|
||||
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
|
||||
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), color, CSS::PropertyID::Color);
|
||||
if (style_value && style_value->has_color()) {
|
||||
auto parsedValue = style_value->to_color(OptionalNone(), {});
|
||||
Optional<Layout::NodeWithStyle const&> layout_node;
|
||||
CSS::CalculationResolutionContext resolution_context;
|
||||
|
||||
if (auto node = context.layout_node()) {
|
||||
layout_node = *node;
|
||||
resolution_context.length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*node);
|
||||
}
|
||||
|
||||
auto parsedValue = style_value->to_color(layout_node, resolution_context);
|
||||
|
||||
// 4. Set this's shadow color to parsedValue.
|
||||
drawing_state().shadow_color = parsedValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue