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 1fe986b013f..ced55fa34e8 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn @@ -17,7 +17,6 @@ source_set("StyleValues") { "EasingStyleValue.cpp", "EdgeStyleValue.cpp", "FilterValueListStyleValue.cpp", - "FlexFlowStyleValue.cpp", "FontStyleValue.cpp", "GridAreaShorthandStyleValue.cpp", "GridAutoFlowStyleValue.cpp", diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index ed014236da6..5fe2fb84deb 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -94,7 +94,6 @@ set(SOURCES CSS/StyleValues/EasingStyleValue.cpp CSS/StyleValues/EdgeStyleValue.cpp CSS/StyleValues/FilterValueListStyleValue.cpp - CSS/StyleValues/FlexFlowStyleValue.cpp CSS/StyleValues/FontStyleValue.cpp CSS/StyleValues/GridAreaShorthandStyleValue.cpp CSS/StyleValues/GridAutoFlowStyleValue.cpp diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 4d838566592..c874c1e1ffb 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -3973,7 +3972,9 @@ RefPtr Parser::parse_flex_flow_value(Vector const& c if (!flex_wrap) flex_wrap = property_initial_value(m_context.realm(), PropertyID::FlexWrap); - return FlexFlowStyleValue::create(flex_direction.release_nonnull(), flex_wrap.release_nonnull()); + return ShorthandStyleValue::create(PropertyID::FlexFlow, + { PropertyID::FlexDirection, PropertyID::FlexWrap }, + { flex_direction.release_nonnull(), flex_wrap.release_nonnull() }); } static bool is_generic_font_family(ValueID identifier) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index ba63c929898..adacced51ee 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -806,13 +805,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope } if (property_id == CSS::PropertyID::FlexFlow) { - if (value.is_flex_flow()) { - auto const& flex_flow = value.as_flex_flow(); - set_longhand_property(CSS::PropertyID::FlexDirection, flex_flow.flex_direction()); - set_longhand_property(CSS::PropertyID::FlexWrap, flex_flow.flex_wrap()); - return; - } - set_longhand_property(CSS::PropertyID::FlexDirection, value); set_longhand_property(CSS::PropertyID::FlexWrap, value); return; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index 4cd5532de7c..9cd891ccf1d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -27,7 +27,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 294032a9535..5fcb609bed5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -99,7 +99,6 @@ using StyleValueVector = Vector>; __ENUMERATE_STYLE_VALUE_TYPE(Easing, easing) \ __ENUMERATE_STYLE_VALUE_TYPE(Edge, edge) \ __ENUMERATE_STYLE_VALUE_TYPE(FilterValueList, filter_value_list) \ - __ENUMERATE_STYLE_VALUE_TYPE(FlexFlow, flex_flow) \ __ENUMERATE_STYLE_VALUE_TYPE(Font, font) \ __ENUMERATE_STYLE_VALUE_TYPE(Frequency, frequency) \ __ENUMERATE_STYLE_VALUE_TYPE(GridAreaShorthand, grid_area_shorthand) \ diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.cpp deleted file mode 100644 index 10751826ec9..00000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.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 "FlexFlowStyleValue.h" - -namespace Web::CSS { - -String FlexFlowStyleValue::to_string() const -{ - return MUST(String::formatted("{} {}", m_properties.flex_direction->to_string(), m_properties.flex_wrap->to_string())); -} - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h deleted file mode 100644 index 93d848d07f2..00000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.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 FlexFlowStyleValue final : public StyleValueWithDefaultOperators { -public: - static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr flex_direction, ValueComparingNonnullRefPtr flex_wrap) - { - return adopt_ref(*new (nothrow) FlexFlowStyleValue(move(flex_direction), move(flex_wrap))); - } - virtual ~FlexFlowStyleValue() override = default; - - ValueComparingNonnullRefPtr flex_direction() const { return m_properties.flex_direction; } - ValueComparingNonnullRefPtr flex_wrap() const { return m_properties.flex_wrap; } - - virtual String to_string() const override; - - bool properties_equal(FlexFlowStyleValue const& other) const { return m_properties == other.m_properties; } - -private: - FlexFlowStyleValue(ValueComparingNonnullRefPtr flex_direction, ValueComparingNonnullRefPtr flex_wrap) - : StyleValueWithDefaultOperators(Type::FlexFlow) - , m_properties { .flex_direction = move(flex_direction), .flex_wrap = move(flex_wrap) } - { - } - - struct Properties { - ValueComparingNonnullRefPtr flex_direction; - ValueComparingNonnullRefPtr flex_wrap; - 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 d715dac2e2e..8619c309743 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp @@ -37,6 +37,8 @@ String ShorthandStyleValue::to_string() const switch (m_properties.shorthand_property) { case PropertyID::Flex: return MUST(String::formatted("{} {} {}", longhand(PropertyID::FlexGrow)->to_string(), longhand(PropertyID::FlexShrink)->to_string(), longhand(PropertyID::FlexBasis)->to_string())); + case PropertyID::FlexFlow: + return MUST(String::formatted("{} {}", longhand(PropertyID::FlexDirection)->to_string(), longhand(PropertyID::FlexWrap)->to_string())); default: StringBuilder builder; auto first = true; diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 4e3e098ae7d..343dbf8a22d 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -104,7 +104,6 @@ class EdgeStyleValue; class ElementInlineCSSStyleDeclaration; class ExplicitGridTrack; class FilterValueListStyleValue; -class FlexFlowStyleValue; class FontFace; class FontStyleValue; class Frequency;