From 6c22f9bf3f6a7eb22e30d2af0d253372a65481c1 Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sat, 1 Oct 2022 12:56:09 +0200 Subject: [PATCH] LibWeb: Use ident instead of to_string in parser Use the ident() function instead of to_string() for parsing. Fix this up in the rect parser as well. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 4be1a50f678..287726e55e3 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -3336,7 +3336,7 @@ RefPtr Parser::parse_rect_value(ComponentValue const& component_valu // , , , and may either have a value or 'auto'. // Negative lengths are permitted. auto current_token = tokens.next_token().token(); - if (current_token.to_string() == "auto") { + if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto"sv)) { params.append(Length::make_auto()); } else { auto maybe_length = parse_length(current_token); @@ -5450,7 +5450,7 @@ RefPtr Parser::parse_grid_track_placement(Vector con auto current_token = tokens.next_token().token(); if (!tokens.has_next_token()) { - if (current_token.to_string() == "auto"sv) + if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto"sv)) return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement()); if (current_token.is(Token::Type::Number) && current_token.number().is_integer()) return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(static_cast(current_token.number_value()))); @@ -5458,7 +5458,7 @@ RefPtr Parser::parse_grid_track_placement(Vector con } auto has_span = false; - if (current_token.to_string() == "span"sv) { + if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("span"sv)) { has_span = true; tokens.skip_whitespace(); current_token = tokens.next_token().token(); @@ -5474,7 +5474,7 @@ RefPtr Parser::parse_grid_track_placement_shorthand_value(Vector Parser::parse_grid_track_placement_shorthand_value(Vector CSS::GridTrackPlacement { auto has_span = false; - if (current_token.to_string() == "span"sv) { + if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("span"sv)) { has_span = true; tokens.skip_whitespace(); current_token = tokens.next_token().token();