diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index c205137c613..56aff6a5271 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -734,7 +734,7 @@ NonnullRefPtr Parser::consume_a_function(TokenStream& toke tokens.reconsume_current_input_token(); auto value = consume_a_component_value(tokens); - function->m_values.append(value.token().m_value.to_string()); + function->m_values.append(value); } return function; @@ -1059,8 +1059,13 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) auto url_token = rule->prelude().first(); if (url_token.is_function()) { auto& function = url_token.function(); - if (function.name().equals_ignoring_case("url"sv) && !function.values().is_empty()) - url = url_token.function().values().first(); + if (function.name().equals_ignoring_case("url"sv) && !function.values().is_empty()) { + auto& argument_token = url_token.function().values().first(); + if (argument_token.is(Token::Type::String)) + url = argument_token.token().string(); + else + dbgln("First argument to url() was not a string: '{}'", argument_token.to_debug_string()); + } } if (url_token.is(Token::Type::String)) @@ -1307,8 +1312,11 @@ RefPtr Parser::parse_css_value(PropertyID property_id, TokenStream const& values() const { return m_values; } + Vector const& values() const { return m_values; } // FIXME: This method is a temporary hack while much of the parser still expects a string, rather than tokens. String values_as_string() const { - StringBuilder builder; - for (auto& value : m_values) - builder.append(value); - return builder.to_string(); + return ""; } String to_string() const; private: String m_name; - Vector m_values; + Vector m_values; }; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp index 35fe9d4cfaa..0c1bb289d39 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp @@ -175,7 +175,7 @@ String StyleFunctionRule::to_string() const builder.append(m_name); builder.append("("); - append_raw(builder, ", ", m_values); + append_with_to_string(builder, ", ", m_values); builder.append(")"); return builder.to_string();