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 769ab719eb0..884a1355968 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn @@ -25,7 +25,6 @@ source_set("StyleValues") { "LinearGradientStyleValue.cpp", "MathDepthStyleValue.cpp", "NumberStyleValue.cpp", - "OverflowStyleValue.cpp", "PositionStyleValue.cpp", "RadialGradientStyleValue.cpp", "RectStyleValue.cpp", diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 2d56fffcd22..e1471d53898 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -102,7 +102,6 @@ set(SOURCES CSS/StyleValues/LinearGradientStyleValue.cpp CSS/StyleValues/MathDepthStyleValue.cpp CSS/StyleValues/NumberStyleValue.cpp - CSS/StyleValues/OverflowStyleValue.cpp CSS/StyleValues/PositionStyleValue.cpp CSS/StyleValues/RadialGradientStyleValue.cpp CSS/StyleValues/RectStyleValue.cpp diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 6044e4d4418..0cef7885f19 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -4549,7 +4548,9 @@ RefPtr Parser::parse_overflow_value(Vector const& co auto maybe_value = parse_css_value_for_property(PropertyID::Overflow, tokens); if (!maybe_value) return nullptr; - return OverflowStyleValue::create(*maybe_value, *maybe_value); + return ShorthandStyleValue::create(PropertyID::Overflow, + { PropertyID::OverflowX, PropertyID::OverflowY }, + { *maybe_value, *maybe_value }); } if (component_values.size() == 2) { @@ -4557,7 +4558,9 @@ RefPtr Parser::parse_overflow_value(Vector const& co auto maybe_y_value = parse_css_value_for_property(PropertyID::OverflowY, tokens); if (!maybe_x_value || !maybe_y_value) return nullptr; - return OverflowStyleValue::create(maybe_x_value.release_nonnull(), maybe_y_value.release_nonnull()); + return ShorthandStyleValue::create(PropertyID::Overflow, + { PropertyID::OverflowX, PropertyID::OverflowY }, + { maybe_x_value.release_nonnull(), maybe_y_value.release_nonnull() }); } return nullptr; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 4bb630d1fa3..184ac14fcd6 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -468,13 +467,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope } if (property_id == CSS::PropertyID::Overflow) { - if (value.is_overflow()) { - auto const& overflow = value.as_overflow(); - set_longhand_property(CSS::PropertyID::OverflowX, overflow.overflow_x()); - set_longhand_property(CSS::PropertyID::OverflowY, overflow.overflow_y()); - return; - } - set_longhand_property(CSS::PropertyID::OverflowX, value); set_longhand_property(CSS::PropertyID::OverflowY, value); return; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index e0d863a5abb..39b370b2df4 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -38,7 +38,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 8b4e2d28804..8ad3d80fc92 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -110,7 +110,6 @@ using StyleValueVector = Vector>; __ENUMERATE_STYLE_VALUE_TYPE(LinearGradient, linear_gradient) \ __ENUMERATE_STYLE_VALUE_TYPE(MathDepth, math_depth) \ __ENUMERATE_STYLE_VALUE_TYPE(Number, number) \ - __ENUMERATE_STYLE_VALUE_TYPE(Overflow, overflow) \ __ENUMERATE_STYLE_VALUE_TYPE(Percentage, percentage) \ __ENUMERATE_STYLE_VALUE_TYPE(Position, position) \ __ENUMERATE_STYLE_VALUE_TYPE(RadialGradient, radial_gradient) \ diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.cpp deleted file mode 100644 index 4630f7f8cad..00000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.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 "OverflowStyleValue.h" - -namespace Web::CSS { - -String OverflowStyleValue::to_string() const -{ - return MUST(String::formatted("{} {}", m_properties.overflow_x->to_string(), m_properties.overflow_y->to_string())); -} - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h deleted file mode 100644 index dc744816aa9..00000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h +++ /dev/null @@ -1,45 +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 OverflowStyleValue final : public StyleValueWithDefaultOperators { -public: - static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr overflow_x, ValueComparingNonnullRefPtr overflow_y) - { - return adopt_ref(*new (nothrow) OverflowStyleValue(move(overflow_x), move(overflow_y))); - } - virtual ~OverflowStyleValue() override = default; - - ValueComparingNonnullRefPtr overflow_x() const { return m_properties.overflow_x; } - ValueComparingNonnullRefPtr overflow_y() const { return m_properties.overflow_y; } - - virtual String to_string() const override; - - bool properties_equal(OverflowStyleValue const& other) const { return m_properties == other.m_properties; } - -private: - OverflowStyleValue(ValueComparingNonnullRefPtr overflow_x, ValueComparingNonnullRefPtr overflow_y) - : StyleValueWithDefaultOperators(Type::Overflow) - , m_properties { .overflow_x = move(overflow_x), .overflow_y = move(overflow_y) } - { - } - - struct Properties { - ValueComparingNonnullRefPtr overflow_x; - ValueComparingNonnullRefPtr overflow_y; - bool operator==(Properties const&) const = default; - } m_properties; -}; - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp index e8e8b90d0e4..5b886250d91 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp @@ -161,6 +161,8 @@ String ShorthandStyleValue::to_string() const } case PropertyID::ListStyle: return MUST(String::formatted("{} {} {}", longhand(PropertyID::ListStylePosition)->to_string(), longhand(PropertyID::ListStyleImage)->to_string(), longhand(PropertyID::ListStyleType)->to_string())); + case PropertyID::Overflow: + return MUST(String::formatted("{} {}", longhand(PropertyID::OverflowX)->to_string(), longhand(PropertyID::OverflowY)->to_string())); case PropertyID::PlaceContent: { auto align_content = longhand(PropertyID::AlignContent)->to_string(); auto justify_content = longhand(PropertyID::JustifyContent)->to_string(); diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index aa884a564bc..8c655e8c7a0 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -134,7 +134,6 @@ class MediaQueryList; class MediaQueryListEvent; class Number; class NumberStyleValue; -class OverflowStyleValue; class Percentage; class PercentageOrCalculated; class PercentageStyleValue; diff --git a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp index 7463eb82af2..616b376caf2 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include