diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.cpp index cee9589a9e..3c429787c2 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2021, the SerenityOS developers. - * Copyright (c) 2021-2022, Sam Atkins + * Copyright (c) 2021-2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ @@ -24,20 +24,4 @@ DeclarationOrAtRule::DeclarationOrAtRule(Declaration declaration) DeclarationOrAtRule::~DeclarationOrAtRule() = default; -DeprecatedString DeclarationOrAtRule::to_deprecated_string() const -{ - StringBuilder builder; - switch (m_type) { - default: - case DeclarationType::At: - builder.append(m_at->to_deprecated_string()); - break; - case DeclarationType::Declaration: - builder.append(m_declaration->to_string().release_value_but_fixme_should_propagate_errors()); - break; - } - - return builder.to_deprecated_string(); -} - } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.h b/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.h index d0d6ced460..2a839fc767 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeclarationOrAtRule.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020-2021, the SerenityOS developers. + * Copyright (c) 2021-2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ @@ -37,8 +38,6 @@ public: return *m_declaration; } - DeprecatedString to_deprecated_string() const; - private: DeclarationType m_type; RefPtr m_at; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index ebcee80605..d3f852cfa8 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1518,7 +1518,7 @@ NonnullRefPtr Parser::consume_an_at_rule(TokenStream& tokens) // Create a new at-rule with its name set to the value of the current input token, its prelude initially set to an empty list, and its value initially set to nothing. // NOTE: We create the Rule fully initialized when we return it instead. - DeprecatedFlyString at_rule_name = ((Token)name_ident).at_keyword(); + auto at_rule_name = FlyString::from_utf8(((Token)name_ident).at_keyword()).release_value_but_fixme_should_propagate_errors(); Vector prelude; RefPtr block; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Rule.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Rule.cpp index 9e22b28459..55a07eeac4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Rule.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Rule.cpp @@ -1,16 +1,15 @@ /* * Copyright (c) 2020-2021, the SerenityOS developers. - * Copyright (c) 2021-2022, Sam Atkins + * Copyright (c) 2021-2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #include -#include namespace Web::CSS::Parser { -Rule::Rule(Rule::Type type, DeprecatedFlyString name, Vector prelude, RefPtr block) +Rule::Rule(Rule::Type type, FlyString name, Vector prelude, RefPtr block) : m_type(type) , m_at_rule_name(move(name)) , m_prelude(move(prelude)) @@ -20,23 +19,4 @@ Rule::Rule(Rule::Type type, DeprecatedFlyString name, Vector pre Rule::~Rule() = default; -DeprecatedString Rule::to_deprecated_string() const -{ - StringBuilder builder; - - if (is_at_rule()) { - builder.append('@'); - serialize_an_identifier(builder, m_at_rule_name); - } - - builder.join(' ', m_prelude); - - if (m_block) - builder.append(m_block->to_string().release_value_but_fixme_should_propagate_errors()); - else - builder.append(';'); - - return builder.to_deprecated_string(); -} - } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Rule.h b/Userland/Libraries/LibWeb/CSS/Parser/Rule.h index dfc9a7f895..60647a7b41 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Rule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Rule.h @@ -1,13 +1,13 @@ /* * Copyright (c) 2020-2021, the SerenityOS developers. - * Copyright (c) 2021, Sam Atkins + * Copyright (c) 2021-2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once -#include +#include #include #include #include @@ -22,7 +22,7 @@ public: Qualified, }; - static NonnullRefPtr make_at_rule(DeprecatedFlyString name, Vector prelude, RefPtr block) + static NonnullRefPtr make_at_rule(FlyString name, Vector prelude, RefPtr block) { return adopt_ref(*new Rule(Type::At, move(name), move(prelude), move(block))); } @@ -41,13 +41,11 @@ public: RefPtr block() const { return m_block; } StringView at_rule_name() const { return m_at_rule_name; } - DeprecatedString to_deprecated_string() const; - private: - Rule(Type, DeprecatedFlyString name, Vector prelude, RefPtr); + Rule(Type, FlyString name, Vector prelude, RefPtr); Type const m_type; - DeprecatedFlyString m_at_rule_name; + FlyString m_at_rule_name; Vector m_prelude; RefPtr m_block; };