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

LibWeb: Rename CombinedBorderRadiusSV -> BorderRadiusShorthandSV

This commit is contained in:
Sam Atkins 2022-04-18 17:02:39 +01:00 committed by Andreas Kling
parent e1cd36559d
commit d9afc2d6f2
3 changed files with 34 additions and 34 deletions

View file

@ -281,7 +281,7 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
bottom_right_radius = maybe_bottom_right_radius.value().value->as_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()); 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. // FIXME: The two radius components are not yet stored, as we currently don't actually render them.
case CSS::PropertyID::BorderBottomLeftRadius: case CSS::PropertyID::BorderBottomLeftRadius:

View file

@ -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); 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()); 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());
} }

View file

@ -84,9 +84,9 @@ public:
BackgroundSize, BackgroundSize,
Border, Border,
BorderRadius, BorderRadius,
BorderRadiusShorthand,
Calculated, Calculated,
Color, Color,
CombinedBorderRadius,
Content, Content,
Flex, Flex,
FlexFlow, FlexFlow,
@ -472,6 +472,37 @@ private:
LengthPercentage m_vertical_radius; LengthPercentage m_vertical_radius;
}; };
class BorderRadiusShorthandStyleValue final : public StyleValue {
public:
static NonnullRefPtr<BorderRadiusShorthandStyleValue> create(NonnullRefPtr<BorderRadiusStyleValue> top_left, NonnullRefPtr<BorderRadiusStyleValue> top_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_left)
{
return adopt_ref(*new BorderRadiusShorthandStyleValue(top_left, top_right, bottom_right, bottom_left));
}
virtual ~BorderRadiusShorthandStyleValue() override = default;
NonnullRefPtr<BorderRadiusStyleValue> top_left() const { return m_top_left; }
NonnullRefPtr<BorderRadiusStyleValue> top_right() const { return m_top_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_right() const { return m_bottom_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_left() const { return m_bottom_left; }
virtual String to_string() const override;
private:
BorderRadiusShorthandStyleValue(NonnullRefPtr<BorderRadiusStyleValue> top_left, NonnullRefPtr<BorderRadiusStyleValue> top_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_right, NonnullRefPtr<BorderRadiusStyleValue> 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<BorderRadiusStyleValue> m_top_left;
NonnullRefPtr<BorderRadiusStyleValue> m_top_right;
NonnullRefPtr<BorderRadiusStyleValue> m_bottom_right;
NonnullRefPtr<BorderRadiusStyleValue> m_bottom_left;
};
class CalculatedStyleValue : public StyleValue { class CalculatedStyleValue : public StyleValue {
public: public:
enum class ResolvedType { enum class ResolvedType {
@ -686,37 +717,6 @@ private:
Color m_color; Color m_color;
}; };
class CombinedBorderRadiusStyleValue final : public StyleValue {
public:
static NonnullRefPtr<CombinedBorderRadiusStyleValue> create(NonnullRefPtr<BorderRadiusStyleValue> top_left, NonnullRefPtr<BorderRadiusStyleValue> top_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_left)
{
return adopt_ref(*new CombinedBorderRadiusStyleValue(top_left, top_right, bottom_right, bottom_left));
}
virtual ~CombinedBorderRadiusStyleValue() override = default;
NonnullRefPtr<BorderRadiusStyleValue> top_left() const { return m_top_left; }
NonnullRefPtr<BorderRadiusStyleValue> top_right() const { return m_top_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_right() const { return m_bottom_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_left() const { return m_bottom_left; }
virtual String to_string() const override;
private:
CombinedBorderRadiusStyleValue(NonnullRefPtr<BorderRadiusStyleValue> top_left, NonnullRefPtr<BorderRadiusStyleValue> top_right, NonnullRefPtr<BorderRadiusStyleValue> bottom_right, NonnullRefPtr<BorderRadiusStyleValue> 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<BorderRadiusStyleValue> m_top_left;
NonnullRefPtr<BorderRadiusStyleValue> m_top_right;
NonnullRefPtr<BorderRadiusStyleValue> m_bottom_right;
NonnullRefPtr<BorderRadiusStyleValue> m_bottom_left;
};
class ContentStyleValue final : public StyleValue { class ContentStyleValue final : public StyleValue {
public: public:
static NonnullRefPtr<ContentStyleValue> create(NonnullRefPtr<StyleValueList> content, RefPtr<StyleValueList> alt_text) static NonnullRefPtr<ContentStyleValue> create(NonnullRefPtr<StyleValueList> content, RefPtr<StyleValueList> alt_text)