diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn index 3e9f97d87f..c5d1f4f647 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn @@ -33,7 +33,6 @@ source_set("StyleValues") { "ShadowStyleValue.cpp", "ShorthandStyleValue.cpp", "StyleValueList.cpp", - "TextDecorationStyleValue.cpp", "TransformationStyleValue.cpp", "UnresolvedStyleValue.cpp", ] diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 6322e74021..a2d37589fa 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -110,7 +110,6 @@ set(SOURCES CSS/StyleValues/ShadowStyleValue.cpp CSS/StyleValues/ShorthandStyleValue.cpp CSS/StyleValues/StyleValueList.cpp - CSS/StyleValues/TextDecorationStyleValue.cpp CSS/StyleValues/TransformationStyleValue.cpp CSS/StyleValues/UnresolvedStyleValue.cpp CSS/Supports.cpp diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 5c393094c1..622b9bd801 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -70,7 +70,6 @@ #include #include #include -#include #include #include #include @@ -4722,7 +4721,9 @@ RefPtr Parser::parse_text_decoration_value(Vector co if (!decoration_color) decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor); - return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull()); + return ShorthandStyleValue::create(PropertyID::TextDecoration, + { PropertyID::TextDecorationLine, PropertyID::TextDecorationThickness, PropertyID::TextDecorationStyle, PropertyID::TextDecorationColor }, + { decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull() }); } RefPtr Parser::parse_text_decoration_line_value(TokenStream& tokens) diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 3bd222882b..79c01d7250 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -418,7 +417,9 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(L auto thickness = style_value_for_property(layout_node, PropertyID::TextDecorationThickness); auto style = style_value_for_property(layout_node, PropertyID::TextDecorationStyle); auto color = style_value_for_property(layout_node, PropertyID::TextDecorationColor); - return TextDecorationStyleValue::create(*line, *thickness, *style, *color); + return ShorthandStyleValue::create(PropertyID::TextDecoration, + { PropertyID::TextDecorationLine, PropertyID::TextDecorationThickness, PropertyID::TextDecorationStyle, PropertyID::TextDecorationColor }, + { line.release_nonnull(), thickness.release_nonnull(), style.release_nonnull(), color.release_nonnull() }); } case PropertyID::TextDecorationColor: return ColorStyleValue::create(layout_node.computed_values().text_decoration_color()); diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 356bec7b59..2abda1ca03 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -462,15 +461,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope }; if (property_id == CSS::PropertyID::TextDecoration) { - if (value.is_text_decoration()) { - auto const& text_decoration = value.as_text_decoration(); - set_longhand_property(CSS::PropertyID::TextDecorationLine, text_decoration.line()); - set_longhand_property(CSS::PropertyID::TextDecorationThickness, text_decoration.thickness()); - set_longhand_property(CSS::PropertyID::TextDecorationStyle, text_decoration.style()); - set_longhand_property(CSS::PropertyID::TextDecorationColor, text_decoration.color()); - return; - } - set_longhand_property(CSS::PropertyID::TextDecorationLine, value); set_longhand_property(CSS::PropertyID::TextDecorationThickness, value); set_longhand_property(CSS::PropertyID::TextDecorationStyle, value); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index f3a4e65080..18e8461f97 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index f951b8df87..886c9c1335 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -122,7 +122,6 @@ using StyleValueVector = Vector>; __ENUMERATE_STYLE_VALUE_TYPE(Shadow, shadow) \ __ENUMERATE_STYLE_VALUE_TYPE(Shorthand, shorthand) \ __ENUMERATE_STYLE_VALUE_TYPE(String, string) \ - __ENUMERATE_STYLE_VALUE_TYPE(TextDecoration, text_decoration) \ __ENUMERATE_STYLE_VALUE_TYPE(Time, time) \ __ENUMERATE_STYLE_VALUE_TYPE(Transformation, transformation) \ __ENUMERATE_STYLE_VALUE_TYPE(Unresolved, unresolved) \ diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp index 13db582c71..57d6632770 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp @@ -168,6 +168,8 @@ String ShorthandStyleValue::to_string() const return align_self; return MUST(String::formatted("{} {}", align_self, justify_self)); } + case PropertyID::TextDecoration: + return MUST(String::formatted("{} {} {} {}", longhand(PropertyID::TextDecorationLine)->to_string(), longhand(PropertyID::TextDecorationThickness)->to_string(), longhand(PropertyID::TextDecorationStyle)->to_string(), longhand(PropertyID::TextDecorationColor)->to_string())); default: StringBuilder builder; auto first = true; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.cpp deleted file mode 100644 index 143906f70d..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * Copyright (c) 2021, Tobias Christiansen - * Copyright (c) 2021-2023, Sam Atkins - * Copyright (c) 2022-2023, MacDue - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "TextDecorationStyleValue.h" - -namespace Web::CSS { - -String TextDecorationStyleValue::to_string() const -{ - return MUST(String::formatted("{} {} {} {}", m_properties.line->to_string(), m_properties.thickness->to_string(), m_properties.style->to_string(), m_properties.color->to_string())); -} - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h deleted file mode 100644 index a0bfcf1c77..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * Copyright (c) 2021, Tobias Christiansen - * Copyright (c) 2021-2023, Sam Atkins - * Copyright (c) 2022-2023, MacDue - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include - -namespace Web::CSS { - -class TextDecorationStyleValue final : public StyleValueWithDefaultOperators { -public: - static ValueComparingNonnullRefPtr create( - ValueComparingNonnullRefPtr line, - ValueComparingNonnullRefPtr thickness, - ValueComparingNonnullRefPtr style, - ValueComparingNonnullRefPtr color) - { - return adopt_ref(*new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color))); - } - virtual ~TextDecorationStyleValue() override = default; - - ValueComparingNonnullRefPtr line() const { return m_properties.line; } - ValueComparingNonnullRefPtr thickness() const { return m_properties.thickness; } - ValueComparingNonnullRefPtr style() const { return m_properties.style; } - ValueComparingNonnullRefPtr color() const { return m_properties.color; } - - virtual String to_string() const override; - - bool properties_equal(TextDecorationStyleValue const& other) const { return m_properties == other.m_properties; } - -private: - TextDecorationStyleValue( - ValueComparingNonnullRefPtr line, - ValueComparingNonnullRefPtr thickness, - ValueComparingNonnullRefPtr style, - ValueComparingNonnullRefPtr color) - : StyleValueWithDefaultOperators(Type::TextDecoration) - , m_properties { .line = move(line), .thickness = move(thickness), .style = move(style), .color = move(color) } - { - } - - struct Properties { - ValueComparingNonnullRefPtr line; - ValueComparingNonnullRefPtr thickness; - ValueComparingNonnullRefPtr style; - ValueComparingNonnullRefPtr color; - bool operator==(Properties const&) const = default; - } m_properties; -}; - -} diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 24c1714007..b5875c94e7 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -162,7 +162,6 @@ class StyleValue; class StyleValueList; class Supports; class SVGPaint; -class TextDecorationStyleValue; class Time; class TimeOrCalculated; class TimePercentage;