1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:17:35 +00:00

LibWeb: Allow LengthPercentage to hold a calculated value

Most of the time, we cannot resolve a `calc()` expression until we go to
use it. Since any `<length-percentage>` can legally be a `calc
()`, let's store it in `LengthPercentage` rather than make every single
user care about this distinction.
This commit is contained in:
Sam Atkins 2022-01-27 14:38:59 +00:00 committed by Andreas Kling
parent f0fb84dfcb
commit ce0de4b2b4
11 changed files with 145 additions and 107 deletions

View file

@ -62,7 +62,7 @@ Optional<float> SVGGraphicsElement::stroke_width() const
// Resolved relative to the "Scaled viewport size": https://www.w3.org/TR/2017/WD-fill-stroke-3-20170413/#scaled-viewport-size
// FIXME: This isn't right, but it's something.
auto scaled_viewport_size = CSS::Length::make_px((client_width() + client_height()) * 0.5f);
return width->resolved(scaled_viewport_size).to_px(*layout_node());
return width->resolved(*layout_node(), scaled_viewport_size).to_px(*layout_node());
}
return {};
}