mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/CSS: Handle whitespace properly for scrollbar properties
Imported a WPT test that regressed without these changes.
This commit is contained in:
parent
60a46b86e4
commit
971c0d0126
Notes:
github-actions[bot]
2025-11-03 11:26:40 +00:00
Author: https://github.com/AtkinsSJ
Commit: 971c0d0126
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6646
Reviewed-by: https://github.com/tcl3
4 changed files with 39 additions and 9 deletions
|
|
@ -5145,35 +5145,39 @@ RefPtr<StyleValue const> Parser::parse_scrollbar_color_value(TokenStream<Compone
|
|||
RefPtr<StyleValue const> Parser::parse_scrollbar_gutter_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
// auto | stable && both-edges?
|
||||
tokens.discard_whitespace();
|
||||
if (!tokens.has_next_token())
|
||||
return nullptr;
|
||||
|
||||
auto transaction = tokens.begin_transaction();
|
||||
|
||||
auto parse_stable = [&]() -> Optional<bool> {
|
||||
auto transaction = tokens.begin_transaction();
|
||||
auto stable_transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
auto const& token = tokens.consume_a_token();
|
||||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto const& ident = token.token().ident();
|
||||
if (ident.equals_ignoring_ascii_case("auto"sv)) {
|
||||
transaction.commit();
|
||||
stable_transaction.commit();
|
||||
return false;
|
||||
} else if (ident.equals_ignoring_ascii_case("stable"sv)) {
|
||||
transaction.commit();
|
||||
}
|
||||
if (ident.equals_ignoring_ascii_case("stable"sv)) {
|
||||
stable_transaction.commit();
|
||||
return true;
|
||||
}
|
||||
return {};
|
||||
};
|
||||
|
||||
auto parse_both_edges = [&]() -> Optional<bool> {
|
||||
auto transaction = tokens.begin_transaction();
|
||||
auto edges_transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
auto const& token = tokens.consume_a_token();
|
||||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto const& ident = token.token().ident();
|
||||
if (ident.equals_ignoring_ascii_case("both-edges"sv)) {
|
||||
transaction.commit();
|
||||
edges_transaction.commit();
|
||||
return true;
|
||||
}
|
||||
return {};
|
||||
|
|
@ -5190,6 +5194,7 @@ RefPtr<StyleValue const> Parser::parse_scrollbar_gutter_value(TokenStream<Compon
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
tokens.discard_whitespace();
|
||||
if (tokens.has_next_token())
|
||||
return nullptr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue