From bebf4363dbb7572f611713db57684794f44e5bf0 Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sat, 29 Apr 2023 17:59:07 +0200 Subject: LibWeb: Change name of GridTrackSizeListStyleValue Change the name of GridTrackSizeStyleValue to GridTrackSizeListStyleValue which is more accurate. --- Userland/Libraries/LibWeb/CMakeLists.txt | 2 +- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 16 ++++----- Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 2 +- .../LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp | 6 ++-- Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 2 +- Userland/Libraries/LibWeb/CSS/StyleValue.cpp | 6 ++-- Userland/Libraries/LibWeb/CSS/StyleValue.h | 4 +-- .../StyleValues/GridTrackSizeListStyleValue.cpp | 29 ++++++++++++++++ .../CSS/StyleValues/GridTrackSizeListStyleValue.h | 40 ++++++++++++++++++++++ .../CSS/StyleValues/GridTrackSizeStyleValue.cpp | 29 ---------------- .../CSS/StyleValues/GridTrackSizeStyleValue.h | 40 ---------------------- Userland/Libraries/LibWeb/Forward.h | 2 +- 12 files changed, 89 insertions(+), 89 deletions(-) create mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp create mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.cpp delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h (limited to 'Userland') diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index ae22ebcc08..df8c83d144 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -87,7 +87,7 @@ set(SOURCES CSS/StyleValues/GridTemplateAreaStyleValue.cpp CSS/StyleValues/GridTrackPlacementStyleValue.cpp CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp - CSS/StyleValues/GridTrackSizeStyleValue.cpp + CSS/StyleValues/GridTrackSizeListStyleValue.cpp CSS/StyleValues/IdentifierStyleValue.cpp CSS/StyleValues/ImageStyleValue.cpp CSS/StyleValues/LengthStyleValue.cpp diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 7266b3473e..4cd3326e2e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include @@ -6269,7 +6269,7 @@ Optional Parser::parse_track_sizing_function(ComponentVa } } -RefPtr Parser::parse_grid_track_sizes(Vector const& component_values) +RefPtr Parser::parse_grid_track_size_list(Vector const& component_values) { Vector track_list; Vector> line_names_list; @@ -6279,11 +6279,11 @@ RefPtr Parser::parse_grid_track_sizes(Vector const& auto token = tokens.next_token(); if (token.is_block()) { if (last_object_was_line_names) - return GridTrackSizeStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto(); last_object_was_line_names = true; Vector line_names; if (!token.block().is_square()) - return GridTrackSizeStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto(); TokenStream block_tokens { token.block().values() }; while (block_tokens.has_next_token()) { auto current_block_token = block_tokens.next_token(); @@ -6298,7 +6298,7 @@ RefPtr Parser::parse_grid_track_sizes(Vector const& last_object_was_line_names = false; auto track_sizing_function = parse_track_sizing_function(token); if (!track_sizing_function.has_value()) - return GridTrackSizeStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto(); // FIXME: Handle multiple repeat values (should combine them here, or remove // any other ones if the first one is auto-fill, etc.) track_list.append(track_sizing_function.value()); @@ -6306,7 +6306,7 @@ RefPtr Parser::parse_grid_track_sizes(Vector const& } while (line_names_list.size() <= track_list.size()) line_names_list.append({}); - return GridTrackSizeStyleValue::create(CSS::GridTrackSizeList(track_list, line_names_list)); + return GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList(track_list, line_names_list)); } RefPtr Parser::parse_grid_track_placement(Vector const& component_values) @@ -6709,11 +6709,11 @@ Parser::ParseErrorOr> Parser::parse_css_value(Property return parsed_value.release_nonnull(); return ParseError::SyntaxError; case PropertyID::GridTemplateColumns: - if (auto parsed_value = parse_grid_track_sizes(component_values)) + if (auto parsed_value = parse_grid_track_size_list(component_values)) return parsed_value.release_nonnull(); return ParseError::SyntaxError; case PropertyID::GridTemplateRows: - if (auto parsed_value = parse_grid_track_sizes(component_values)) + if (auto parsed_value = parse_grid_track_size_list(component_values)) return parsed_value.release_nonnull(); return ParseError::SyntaxError; case PropertyID::ListStyle: diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index ac2fbd9f2e..d369b8f434 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -318,7 +318,7 @@ private: RefPtr parse_text_decoration_line_value(TokenStream&); RefPtr parse_transform_value(Vector const&); RefPtr parse_transform_origin_value(Vector const&); - RefPtr parse_grid_track_sizes(Vector const&); + RefPtr parse_grid_track_size_list(Vector const&); RefPtr parse_grid_track_placement(Vector const&); RefPtr parse_grid_track_placement_shorthand_value(Vector const&); RefPtr parse_grid_template_areas_value(Vector const&); diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 0422efd542..0dd3e3e7ec 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -485,9 +485,9 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(L case CSS::PropertyID::GridRowStart: return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_row_start()); case CSS::PropertyID::GridTemplateColumns: - return GridTrackSizeStyleValue::create(layout_node.computed_values().grid_template_columns()); + return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_columns()); case CSS::PropertyID::GridTemplateRows: - return GridTrackSizeStyleValue::create(layout_node.computed_values().grid_template_rows()); + return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_rows()); case CSS::PropertyID::Height: return style_value_for_size(layout_node.computed_values().height()); case CSS::PropertyID::ImageRendering: diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 9d121cb76c..41bd3e3f40 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index 22d1c32443..7d52033100 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -230,10 +230,10 @@ LengthStyleValue const& StyleValue::as_length() const return static_cast(*this); } -GridTrackSizeStyleValue const& StyleValue::as_grid_track_size_list() const +GridTrackSizeListStyleValue const& StyleValue::as_grid_track_size_list() const { VERIFY(is_grid_track_size_list()); - return static_cast(*this); + return static_cast(*this); } LinearGradientStyleValue const& StyleValue::as_linear_gradient() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index f71a0af5ae..b6b203e39b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -208,7 +208,7 @@ public: GridTemplateAreaStyleValue const& as_grid_template_area() const; GridTrackPlacementShorthandStyleValue const& as_grid_track_placement_shorthand() const; GridTrackPlacementStyleValue const& as_grid_track_placement() const; - GridTrackSizeStyleValue const& as_grid_track_size_list() const; + GridTrackSizeListStyleValue const& as_grid_track_size_list() const; IdentifierStyleValue const& as_identifier() const; ImageStyleValue const& as_image() const; InheritStyleValue const& as_inherit() const; @@ -255,7 +255,7 @@ public: GridTemplateAreaStyleValue& as_grid_template_area() { return const_cast(const_cast(*this).as_grid_template_area()); } GridTrackPlacementShorthandStyleValue& as_grid_track_placement_shorthand() { return const_cast(const_cast(*this).as_grid_track_placement_shorthand()); } GridTrackPlacementStyleValue& as_grid_track_placement() { return const_cast(const_cast(*this).as_grid_track_placement()); } - GridTrackSizeStyleValue& as_grid_track_size_list() { return const_cast(const_cast(*this).as_grid_track_size_list()); } + GridTrackSizeListStyleValue& as_grid_track_size_list() { return const_cast(const_cast(*this).as_grid_track_size_list()); } IdentifierStyleValue& as_identifier() { return const_cast(const_cast(*this).as_identifier()); } ImageStyleValue& as_image() { return const_cast(const_cast(*this).as_image()); } InheritStyleValue& as_inherit() { return const_cast(const_cast(*this).as_inherit()); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp new file mode 100644 index 0000000000..be0cd8962a --- /dev/null +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp @@ -0,0 +1,29 @@ +/* + * 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 "GridTrackSizeListStyleValue.h" + +namespace Web::CSS { + +ErrorOr GridTrackSizeListStyleValue::to_string() const +{ + return m_grid_track_size_list.to_string(); +} + +ValueComparingNonnullRefPtr GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) +{ + return adopt_ref(*new GridTrackSizeListStyleValue(grid_track_size_list)); +} + +ValueComparingNonnullRefPtr GridTrackSizeListStyleValue::make_auto() +{ + return adopt_ref(*new GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); +} + +} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h new file mode 100644 index 0000000000..26ac4c56a1 --- /dev/null +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h @@ -0,0 +1,40 @@ +/* + * 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 +#include + +namespace Web::CSS { + +class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators { +public: + static ValueComparingNonnullRefPtr create(CSS::GridTrackSizeList grid_track_size_list); + virtual ~GridTrackSizeListStyleValue() override = default; + + static ValueComparingNonnullRefPtr make_auto(); + + CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; } + + virtual ErrorOr to_string() const override; + + bool properties_equal(GridTrackSizeListStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; } + +private: + explicit GridTrackSizeListStyleValue(CSS::GridTrackSizeList grid_track_size_list) + : StyleValueWithDefaultOperators(Type::GridTrackSizeList) + , m_grid_track_size_list(grid_track_size_list) + { + } + + CSS::GridTrackSizeList m_grid_track_size_list; +}; + +} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.cpp deleted file mode 100644 index 53eec27e0b..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.cpp +++ /dev/null @@ -1,29 +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 "GridTrackSizeStyleValue.h" - -namespace Web::CSS { - -ErrorOr GridTrackSizeStyleValue::to_string() const -{ - return m_grid_track_size_list.to_string(); -} - -ValueComparingNonnullRefPtr GridTrackSizeStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) -{ - return adopt_ref(*new GridTrackSizeStyleValue(grid_track_size_list)); -} - -ValueComparingNonnullRefPtr GridTrackSizeStyleValue::make_auto() -{ - return adopt_ref(*new GridTrackSizeStyleValue(CSS::GridTrackSizeList())); -} - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h deleted file mode 100644 index f73a818878..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h +++ /dev/null @@ -1,40 +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 -#include - -namespace Web::CSS { - -class GridTrackSizeStyleValue final : public StyleValueWithDefaultOperators { -public: - static ValueComparingNonnullRefPtr create(CSS::GridTrackSizeList grid_track_size_list); - virtual ~GridTrackSizeStyleValue() override = default; - - static ValueComparingNonnullRefPtr make_auto(); - - CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; } - - virtual ErrorOr to_string() const override; - - bool properties_equal(GridTrackSizeStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; } - -private: - explicit GridTrackSizeStyleValue(CSS::GridTrackSizeList grid_track_size_list) - : StyleValueWithDefaultOperators(Type::GridTrackSizeList) - , m_grid_track_size_list(grid_track_size_list) - { - } - - CSS::GridTrackSizeList m_grid_track_size_list; -}; - -} diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index eb75da5b53..d7d92e5999 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -105,7 +105,7 @@ class GridTrackPlacement; class GridTrackPlacementShorthandStyleValue; class GridTrackPlacementStyleValue; class GridTrackSizeList; -class GridTrackSizeStyleValue; +class GridTrackSizeListStyleValue; class IdentifierStyleValue; class ImageStyleValue; class InheritStyleValue; -- cgit v1.2.3