diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2021-09-24 11:37:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-24 15:01:43 +0200 |
commit | 058d44dcae2241c9e5bb0e81268275eae7eb4714 (patch) | |
tree | 81abafef864d7f9a3296302035e41120e7aeabc1 /Userland/Libraries | |
parent | a83b620fa67dccc00e06800dd34718d560818809 (diff) | |
download | serenity-058d44dcae2241c9e5bb0e81268275eae7eb4714.zip |
LibWeb: Replace last couple of StyleValue casts with `as_foo()`
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Node.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index d9b59bf80d..7ecde84f51 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2095,7 +2095,7 @@ RefPtr<StyleValue> Parser::parse_flex_value(ParsingContext const& context, Vecto return nullptr; // Zero is a valid value for basis, but only if grow and shrink are already specified. - if (value->is_numeric() && static_cast<NumericStyleValue&>(*value).value() == 0) { + if (value->has_number() && value->to_number() == 0) { if (flex_grow && flex_shrink && !flex_basis) { flex_basis = LengthStyleValue::create(Length(0, Length::Type::Px)); continue; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 47bd8f4db6..5d0cc84f39 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -220,7 +220,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) auto bgimage = specified_style.property(CSS::PropertyID::BackgroundImage); if (bgimage.has_value() && bgimage.value()->is_image()) { - m_background_image = static_ptr_cast<CSS::ImageStyleValue>(bgimage.value()); + m_background_image = bgimage.value()->as_image(); } // FIXME: BorderXRadius properties are now BorderRadiusStyleValues, so make use of that. @@ -374,7 +374,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) // FIXME: Converting to pixels isn't really correct - values should be in "user units" // https://svgwg.org/svg2-draft/coords.html#TermUserUnits if (stroke_width.value()->is_numeric()) - computed_values.set_stroke_width(CSS::Length::make_px(static_cast<CSS::NumericStyleValue const&>(*stroke_width.value()).value())); + computed_values.set_stroke_width(CSS::Length::make_px(stroke_width.value()->to_number())); else computed_values.set_stroke_width(stroke_width.value()->to_length()); } |