diff --git a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp index d318e8d811..901cdb3396 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp @@ -30,7 +30,7 @@ void CSSSupportsRule::initialize(JS::Realm& realm) DeprecatedString CSSSupportsRule::condition_text() const { - return m_supports->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + return m_supports->to_string().to_deprecated_string(); } void CSSSupportsRule::set_condition_text(DeprecatedString text) diff --git a/Userland/Libraries/LibWeb/CSS/Supports.cpp b/Userland/Libraries/LibWeb/CSS/Supports.cpp index 15e129b981..b88228ce23 100644 --- a/Userland/Libraries/LibWeb/CSS/Supports.cpp +++ b/Userland/Libraries/LibWeb/CSS/Supports.cpp @@ -74,43 +74,43 @@ bool Supports::Feature::evaluate() const }); } -ErrorOr Supports::Declaration::to_string() const +String Supports::Declaration::to_string() const { - return String::formatted("({})", declaration); + return MUST(String::formatted("({})", declaration)); } -ErrorOr Supports::Selector::to_string() const +String Supports::Selector::to_string() const { - return String::formatted("selector({})", selector); + return MUST(String::formatted("selector({})", selector)); } -ErrorOr Supports::Feature::to_string() const +String Supports::Feature::to_string() const { return value.visit([](auto& it) { return it.to_string(); }); } -ErrorOr Supports::InParens::to_string() const +String Supports::InParens::to_string() const { return value.visit( - [](NonnullOwnPtr const& condition) -> ErrorOr { return String::formatted("({})", TRY(condition->to_string())); }, - [](Supports::Feature const& it) -> ErrorOr { return it.to_string(); }, - [](GeneralEnclosed const& it) -> ErrorOr { return it.to_string(); }); + [](NonnullOwnPtr const& condition) { return MUST(String::formatted("({})", condition->to_string())); }, + [](Supports::Feature const& it) { return it.to_string(); }, + [](GeneralEnclosed const& it) { return it.to_string(); }); } -ErrorOr Supports::Condition::to_string() const +String Supports::Condition::to_string() const { switch (type) { case Type::Not: - return String::formatted("not {}", TRY(children.first().to_string())); + return MUST(String::formatted("not {}", children.first().to_string())); case Type::And: - return String::join(" and "sv, children); + return MUST(String::join(" and "sv, children)); case Type::Or: - return String::join(" or "sv, children); + return MUST(String::join(" or "sv, children)); } VERIFY_NOT_REACHED(); } -ErrorOr Supports::to_string() const +String Supports::to_string() const { return m_condition->to_string(); } diff --git a/Userland/Libraries/LibWeb/CSS/Supports.h b/Userland/Libraries/LibWeb/CSS/Supports.h index 826b80a208..a531f88d47 100644 --- a/Userland/Libraries/LibWeb/CSS/Supports.h +++ b/Userland/Libraries/LibWeb/CSS/Supports.h @@ -25,20 +25,20 @@ public: String declaration; JS::Handle realm; bool evaluate() const; - ErrorOr to_string() const; + String to_string() const; }; struct Selector { String selector; JS::Handle realm; bool evaluate() const; - ErrorOr to_string() const; + String to_string() const; }; struct Feature { Variant value; bool evaluate() const; - ErrorOr to_string() const; + String to_string() const; }; struct Condition; @@ -46,7 +46,7 @@ public: Variant, Feature, GeneralEnclosed> value; bool evaluate() const; - ErrorOr to_string() const; + String to_string() const; }; struct Condition { @@ -59,7 +59,7 @@ public: Vector children; bool evaluate() const; - ErrorOr to_string() const; + String to_string() const; }; static NonnullRefPtr create(NonnullOwnPtr&& condition) @@ -68,7 +68,7 @@ public: } bool matches() const { return m_matches; } - ErrorOr to_string() const; + String to_string() const; private: Supports(NonnullOwnPtr&&); @@ -83,6 +83,6 @@ template<> struct AK::Formatter : AK::Formatter { ErrorOr format(FormatBuilder& builder, Web::CSS::Supports::InParens const& in_parens) { - return Formatter::format(builder, TRY(in_parens.to_string())); + return Formatter::format(builder, in_parens.to_string()); } };