From d9afc2d6f2b8a934e5202b5b22bfe6be7cd65542 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 18 Apr 2022 17:02:39 +0100 Subject: [PATCH] LibWeb: Rename CombinedBorderRadiusSV -> BorderRadiusShorthandSV --- .../CSS/ResolvedCSSStyleDeclaration.cpp | 2 +- Userland/Libraries/LibWeb/CSS/StyleValue.cpp | 2 +- Userland/Libraries/LibWeb/CSS/StyleValue.h | 64 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index d11bf4d9a2..35391d524c 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -281,7 +281,7 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: 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()); + return BorderRadiusShorthandStyleValue::create(top_left_radius.release_nonnull(), top_right_radius.release_nonnull(), bottom_right_radius.release_nonnull(), bottom_left_radius.release_nonnull()); } // FIXME: The two radius components are not yet stored, as we currently don't actually render them. case CSS::PropertyID::BorderBottomLeftRadius: diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index 5c6961ccd0..da91241b51 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -1004,7 +1004,7 @@ String ColorStyleValue::to_string() const return String::formatted("rgba({}, {}, {}, {})", m_color.red(), m_color.green(), m_color.blue(), (float)(m_color.alpha()) / 255.0f); } -String CombinedBorderRadiusStyleValue::to_string() const +String BorderRadiusShorthandStyleValue::to_string() const { return String::formatted("{} {} {} {} / {} {} {} {}", m_top_left->horizontal_radius().to_string(), m_top_right->horizontal_radius().to_string(), m_bottom_right->horizontal_radius().to_string(), m_bottom_left->horizontal_radius().to_string(), m_top_left->vertical_radius().to_string(), m_top_right->vertical_radius().to_string(), m_bottom_right->vertical_radius().to_string(), m_bottom_left->vertical_radius().to_string()); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 4909996fd5..e6f0dc9f8a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -84,9 +84,9 @@ public: BackgroundSize, Border, BorderRadius, + BorderRadiusShorthand, Calculated, Color, - CombinedBorderRadius, Content, Flex, FlexFlow, @@ -472,6 +472,37 @@ private: LengthPercentage m_vertical_radius; }; +class BorderRadiusShorthandStyleValue final : public StyleValue { +public: + static NonnullRefPtr create(NonnullRefPtr top_left, NonnullRefPtr top_right, NonnullRefPtr bottom_right, NonnullRefPtr bottom_left) + { + return adopt_ref(*new BorderRadiusShorthandStyleValue(top_left, top_right, bottom_right, bottom_left)); + } + virtual ~BorderRadiusShorthandStyleValue() override = default; + + NonnullRefPtr top_left() const { return m_top_left; } + NonnullRefPtr top_right() const { return m_top_right; } + NonnullRefPtr bottom_right() const { return m_bottom_right; } + NonnullRefPtr bottom_left() const { return m_bottom_left; } + + virtual String to_string() const override; + +private: + BorderRadiusShorthandStyleValue(NonnullRefPtr top_left, NonnullRefPtr top_right, NonnullRefPtr bottom_right, NonnullRefPtr bottom_left) + : StyleValue(Type::BorderRadiusShorthand) + , m_top_left(top_left) + , m_top_right(top_right) + , m_bottom_right(bottom_right) + , m_bottom_left(bottom_left) + { + } + + NonnullRefPtr m_top_left; + NonnullRefPtr m_top_right; + NonnullRefPtr m_bottom_right; + NonnullRefPtr m_bottom_left; +}; + class CalculatedStyleValue : public StyleValue { public: enum class ResolvedType { @@ -686,37 +717,6 @@ private: Color m_color; }; -class CombinedBorderRadiusStyleValue final : public StyleValue { -public: - static NonnullRefPtr create(NonnullRefPtr top_left, NonnullRefPtr top_right, NonnullRefPtr bottom_right, NonnullRefPtr bottom_left) - { - return adopt_ref(*new CombinedBorderRadiusStyleValue(top_left, top_right, bottom_right, bottom_left)); - } - virtual ~CombinedBorderRadiusStyleValue() override = default; - - NonnullRefPtr top_left() const { return m_top_left; } - NonnullRefPtr top_right() const { return m_top_right; } - NonnullRefPtr bottom_right() const { return m_bottom_right; } - NonnullRefPtr bottom_left() const { return m_bottom_left; } - - virtual String to_string() const override; - -private: - CombinedBorderRadiusStyleValue(NonnullRefPtr top_left, NonnullRefPtr top_right, NonnullRefPtr bottom_right, NonnullRefPtr bottom_left) - : StyleValue(Type::CombinedBorderRadius) - , m_top_left(top_left) - , m_top_right(top_right) - , m_bottom_right(bottom_right) - , m_bottom_left(bottom_left) - { - } - - NonnullRefPtr m_top_left; - NonnullRefPtr m_top_right; - NonnullRefPtr m_bottom_right; - NonnullRefPtr m_bottom_left; -}; - class ContentStyleValue final : public StyleValue { public: static NonnullRefPtr create(NonnullRefPtr content, RefPtr alt_text)