From 48ef5c8e846cda216efe561da457ea534f5bdf99 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 23 Sep 2021 21:17:25 +0100 Subject: [PATCH] LibWeb: Use new StyleValue API in ComputedCSSStyleDeclaration Why manually cast things when a method can do it for you safely? --- .../LibWeb/CSS/ComputedCSSStyleDeclaration.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp index 33506df24f..fd708a6c4b 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp @@ -484,20 +484,20 @@ RefPtr ComputedCSSStyleDeclaration::style_value_for_property(Layout: auto maybe_bottom_right_radius = property(CSS::PropertyID::BorderBottomRightRadius); RefPtr top_left_radius, top_right_radius, bottom_left_radius, bottom_right_radius; if (maybe_top_left_radius.has_value()) { - VERIFY(maybe_top_left_radius.value().value->type() == StyleValue::Type::BorderRadius); - top_left_radius = *static_cast(maybe_top_left_radius.value().value.ptr()); + VERIFY(maybe_top_left_radius.value().value->is_border_radius()); + top_left_radius = maybe_top_left_radius.value().value->as_border_radius(); } if (maybe_top_right_radius.has_value()) { - VERIFY(maybe_top_right_radius.value().value->type() == StyleValue::Type::BorderRadius); - top_right_radius = *static_cast(maybe_top_right_radius.value().value.ptr()); + VERIFY(maybe_top_right_radius.value().value->is_border_radius()); + top_right_radius = maybe_top_right_radius.value().value->as_border_radius(); } if (maybe_bottom_left_radius.has_value()) { - VERIFY(maybe_bottom_left_radius.value().value->type() == StyleValue::Type::BorderRadius); - bottom_left_radius = *static_cast(maybe_bottom_left_radius.value().value.ptr()); + VERIFY(maybe_bottom_left_radius.value().value->is_border_radius()); + bottom_left_radius = maybe_bottom_left_radius.value().value->as_border_radius(); } if (maybe_bottom_right_radius.has_value()) { - VERIFY(maybe_bottom_right_radius.value().value->type() == StyleValue::Type::BorderRadius); - bottom_right_radius = *static_cast(maybe_bottom_right_radius.value().value.ptr()); + VERIFY(maybe_bottom_right_radius.value().value->is_border_radius()); + bottom_right_radius = maybe_bottom_right_radius.value().value->as_border_radius(); } return CombinedBorderRadiusStyleValue::create(top_left_radius.release_nonnull(), top_right_radius.release_nonnull(), bottom_right_radius.release_nonnull(), bottom_left_radius.release_nonnull());