mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb/CSS: Preserve original source text for ComponentValues
This requires a little bit of ad-hoc tracking of start/end Tokens for Function and SimpleBlock.
This commit is contained in:
parent
04939d68f0
commit
ea164124de
Notes:
github-actions[bot]
2024-10-16 12:23:48 +00:00
Author: https://github.com/AtkinsSJ
Commit: ea164124de
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1795
5 changed files with 41 additions and 7 deletions
|
@ -788,7 +788,8 @@ SimpleBlock Parser::consume_a_simple_block(TokenStream<T>& input)
|
|||
// ending token
|
||||
if (token.is(Token::Type::EndOfFile) || token.is(ending_token)) {
|
||||
// Discard a token from input. Return block.
|
||||
input.discard_a_token();
|
||||
// AD-HOC: Store the token instead as the "end token"
|
||||
block.end_token = input.consume_a_token();
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -811,9 +812,11 @@ Function Parser::consume_a_function(TokenStream<T>& input)
|
|||
|
||||
// Consume a token from input, and let function be a new function with its name equal the returned token’s value,
|
||||
// and a value set to an empty list.
|
||||
auto name_token = ((Token)input.consume_a_token());
|
||||
Function function {
|
||||
.name = ((Token)input.consume_a_token()).function(),
|
||||
.name = name_token.function(),
|
||||
.value = {},
|
||||
.name_token = name_token,
|
||||
};
|
||||
|
||||
// Process input:
|
||||
|
@ -824,7 +827,8 @@ Function Parser::consume_a_function(TokenStream<T>& input)
|
|||
// <)-token>
|
||||
if (token.is(Token::Type::EndOfFile) || token.is(Token::Type::CloseParen)) {
|
||||
// Discard a token from input. Return function.
|
||||
input.discard_a_token();
|
||||
// AD-HOC: Store the token instead as the "end token"
|
||||
function.end_token = input.consume_a_token();
|
||||
return function;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue