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

LibWeb: Add to_px() helpers to CSS::Size and CSS::PercentageOr<T>

Old pattern:

    foo.resolved(node, reference_value).to_px(node)

New pattern:

    foo.to_px(node, reference_value)

Also, the reference value for to_px() is a CSSPixels, which means we
don't have to synthesize a CSS::Length just for this call.
This commit is contained in:
Andreas Kling 2023-05-06 16:33:06 +02:00
parent 3e62ab996d
commit cdf0d3e905
3 changed files with 12 additions and 0 deletions

View file

@ -47,6 +47,8 @@ public:
// FIXME: This is a stopgap API that will go away once all layout code is aware of CSS::Size.
CSS::Length resolved(Layout::Node const&, Length const& reference_value) const;
[[nodiscard]] CSSPixels to_px(Layout::Node const&, CSSPixels reference_value) const;
bool contains_percentage() const;
CalculatedStyleValue const& calculated() const