From fe499681d9bf32ed3cc0535250c8da2221061548 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 20 Sep 2023 12:52:54 +0100 Subject: [PATCH] LibWeb: Actually remove FontStyleValue Whoops! --- .../Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 +- .../LibWeb/CSS/StyleValues/FontStyleValue.cpp | 19 ------ .../LibWeb/CSS/StyleValues/FontStyleValue.h | 60 ------------------- 3 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.cpp delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index b2bcc5075c..3ec4ec4fbe 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -4112,7 +4112,7 @@ RefPtr Parser::parse_font_value(Vector const& compon } // Since normal is the default value for all the properties that can have it, we don't have to actually - // set anything to normal here. It'll be set when we create the FontStyleValue below. + // set anything to normal here. It'll be set when we create the ShorthandStyleValue below. // We just need to make sure we were not given more normals than will fit. int unset_value_count = (font_style ? 0 : 1) + (font_weight ? 0 : 1) + (font_variant ? 0 : 1) + (font_stretch ? 0 : 1); if (unset_value_count < normal_count) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.cpp deleted file mode 100644 index 937460a368..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.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 "FontStyleValue.h" - -namespace Web::CSS { - -String FontStyleValue::to_string() const -{ - return MUST(String::formatted("{} {} {} / {} {}", m_properties.font_style->to_string(), m_properties.font_weight->to_string(), m_properties.font_size->to_string(), m_properties.line_height->to_string(), m_properties.font_families->to_string())); -} - -} diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h deleted file mode 100644 index 75411f4b72..0000000000 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h +++ /dev/null @@ -1,60 +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 FontStyleValue final : public StyleValueWithDefaultOperators { -public: - static ValueComparingNonnullRefPtr create( - ValueComparingNonnullRefPtr font_stretch, - ValueComparingNonnullRefPtr font_style, - ValueComparingNonnullRefPtr font_weight, - ValueComparingNonnullRefPtr font_size, - ValueComparingNonnullRefPtr line_height, - ValueComparingNonnullRefPtr font_families) - { - return adopt_ref(*new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families))); - } - virtual ~FontStyleValue() override = default; - - ValueComparingNonnullRefPtr font_stretch() const { return m_properties.font_stretch; } - ValueComparingNonnullRefPtr font_style() const { return m_properties.font_style; } - ValueComparingNonnullRefPtr font_weight() const { return m_properties.font_weight; } - ValueComparingNonnullRefPtr font_size() const { return m_properties.font_size; } - ValueComparingNonnullRefPtr line_height() const { return m_properties.line_height; } - ValueComparingNonnullRefPtr font_families() const { return m_properties.font_families; } - - virtual String to_string() const override; - - bool properties_equal(FontStyleValue const& other) const { return m_properties == other.m_properties; } - -private: - FontStyleValue(ValueComparingNonnullRefPtr font_stretch, ValueComparingNonnullRefPtr font_style, ValueComparingNonnullRefPtr font_weight, ValueComparingNonnullRefPtr font_size, ValueComparingNonnullRefPtr line_height, ValueComparingNonnullRefPtr font_families) - : StyleValueWithDefaultOperators(Type::Font) - , m_properties { .font_stretch = move(font_stretch), .font_style = move(font_style), .font_weight = move(font_weight), .font_size = move(font_size), .line_height = move(line_height), .font_families = move(font_families) } - { - } - - struct Properties { - ValueComparingNonnullRefPtr font_stretch; - ValueComparingNonnullRefPtr font_style; - ValueComparingNonnullRefPtr font_weight; - ValueComparingNonnullRefPtr font_size; - ValueComparingNonnullRefPtr line_height; - ValueComparingNonnullRefPtr font_families; - // FIXME: Implement font-variant. - bool operator==(Properties const&) const = default; - } m_properties; -}; - -}