diff --git a/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp index a0b1ed8ed40..6d07a58ca4d 100644 --- a/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp +++ b/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp @@ -919,13 +919,13 @@ Token Tokenizer::consume_string_token(u32 ending_code_point) // code point is used. // Initially create a with its value set to the empty string. - auto start_byte_offset = current_byte_offset(); + auto original_source_text_start_byte_offset_including_quotation_mark = current_byte_offset() - 1; auto token = create_new_token(Token::Type::String); StringBuilder builder; auto make_token = [&]() -> Token { token.m_value = builder.to_fly_string_without_validation(); - token.m_original_source_text = input_since(start_byte_offset); + token.m_original_source_text = input_since(original_source_text_start_byte_offset_including_quotation_mark); return token; }; @@ -950,7 +950,7 @@ Token Tokenizer::consume_string_token(u32 ending_code_point) // , and return it. reconsume_current_input_code_point(); auto bad_string_token = create_new_token(Token::Type::BadString); - bad_string_token.m_original_source_text = input_since(start_byte_offset); + bad_string_token.m_original_source_text = input_since(original_source_text_start_byte_offset_including_quotation_mark); return bad_string_token; } diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-url-var-serialization.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-url-var-serialization.txt new file mode 100644 index 00000000000..5733c4e292e --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-url-var-serialization.txt @@ -0,0 +1 @@ +style.getPropertyValue("--test-url") = url('https://ladybird.org/') diff --git a/Tests/LibWeb/Text/input/css/getComputedStyle-url-var-serialization.html b/Tests/LibWeb/Text/input/css/getComputedStyle-url-var-serialization.html new file mode 100644 index 00000000000..d1ce73a8b68 --- /dev/null +++ b/Tests/LibWeb/Text/input/css/getComputedStyle-url-var-serialization.html @@ -0,0 +1,13 @@ + + + +