mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
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.
This commit is contained in:
parent
330af1a769
commit
6c22f9bf3f
Notes:
sideshowbarker
2024-07-17 06:13:51 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/6c22f9bf3f Pull-request: https://github.com/SerenityOS/serenity/pull/15271 Reviewed-by: https://github.com/MacDue
1 changed files with 5 additions and 5 deletions
|
@ -3336,7 +3336,7 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
|
|||
// <top>, <right>, <bottom>, and <left> may either have a <length> 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<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> 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<int>(current_token.number_value())));
|
||||
|
@ -5458,7 +5458,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> 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<StyleValue> Parser::parse_grid_track_placement_shorthand_value(Vector<Com
|
|||
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 GridTrackPlacementShorthandStyleValue::create(CSS::GridTrackPlacement::make_auto());
|
||||
if (current_token.is(Token::Type::Number) && current_token.number().is_integer())
|
||||
return GridTrackPlacementShorthandStyleValue::create(CSS::GridTrackPlacement(current_token.number_value()));
|
||||
|
@ -5483,7 +5483,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement_shorthand_value(Vector<Com
|
|||
|
||||
auto calculate_grid_track_placement = [](auto& current_token, auto& tokens) -> 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();
|
||||
|
|
Loading…
Reference in a new issue