tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 454f00f6426aee0378e10fde62a2ba59da88b15f
parent f88d481b81078d7e8ce07d099579c2449f3759a7
Author: ken7253 <ken7253@gmail.com>
Date:   Thu,  8 Jan 2026 14:56:43 +0000

Bug 1819853 - Fixed to ignore trailing whitespace in CSS custom properties. r=firefox-style-system-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D276373

Diffstat:
Mlayout/style/test/test_variable_serialization_specified.html | 9+++++----
Mservo/components/style/custom_properties.rs | 8+++++---
Mtesting/web-platform/meta/css/css-conditional/container-queries/at-container-style-serialization.html.ini | 3---
Mtesting/web-platform/meta/css/css-syntax/declarations-trim-whitespace.html.ini | 14--------------
Mtesting/web-platform/meta/css/css-variables/variable-cssText.html.ini | 6------
Mtesting/web-platform/meta/css/css-variables/variable-definition.html.ini | 36------------------------------------
6 files changed, 10 insertions(+), 66 deletions(-)

diff --git a/layout/style/test/test_variable_serialization_specified.html b/layout/style/test/test_variable_serialization_specified.html @@ -11,8 +11,6 @@ var values_with_unchanged_specified_value_serialization = [ "var(--a)", "var(--a)", - "var(--a) ", - "var( --a ) ", "var(--a, )", "var(--a,/**/a)", "1px var(--a)", @@ -33,9 +31,12 @@ var values_with_unchanged_specified_value_serialization = [ "var(--\\ffffff)", ]; -// Values that serialize differently, due to additional implied closing -// characters at EOF. var values_with_changed_specified_value_serialization = [ + // Values expected to be removed during the serialization process. + ["var(--a) ", "var(--a)"], + ["var( --a ) ", "var( --a )"], + // Values that serialize differently, due to additional implied closing + // characters at EOF. ["var(--a", "var(--a)"], ["var(--a , ", "var(--a , )"], ["var(--a, ", "var(--a, )"], diff --git a/servo/components/style/custom_properties.rs b/servo/components/style/custom_properties.rs @@ -598,8 +598,6 @@ impl VariableValue { input: &mut Parser<'i, 't>, url_data: &UrlExtraData, ) -> Result<Self, ParseError<'i>> { - input.skip_whitespace(); - let mut references = References::default(); let mut missing_closing_characters = String::new(); let start_position = input.position(); @@ -609,7 +607,10 @@ impl VariableValue { &mut references, &mut missing_closing_characters, )?; - let mut css = input.slice_from(start_position).to_owned(); + let mut css = input + .slice_from(start_position) + .trim_ascii_start() + .to_owned(); if !missing_closing_characters.is_empty() { // Unescaped backslash at EOF in a quoted string is ignored. if css.ends_with("\\") @@ -620,6 +621,7 @@ impl VariableValue { css.push_str(&missing_closing_characters); } + css.truncate(css.trim_ascii_end().len()); css.shrink_to_fit(); references.refs.shrink_to_fit(); diff --git a/testing/web-platform/meta/css/css-conditional/container-queries/at-container-style-serialization.html.ini b/testing/web-platform/meta/css/css-conditional/container-queries/at-container-style-serialization.html.ini @@ -3,6 +3,3 @@ if (os == "win") and not debug and (processor == "x86_64"): [OK, CRASH] [Unknown CSS property after 'or'] expected: FAIL - - [Original string number in custom property value] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-syntax/declarations-trim-whitespace.html.ini b/testing/web-platform/meta/css/css-syntax/declarations-trim-whitespace.html.ini @@ -1,20 +1,6 @@ [declarations-trim-whitespace.html] expected: if (os == "android") and fission: [TIMEOUT, OK] - [--foo-3:bar ;] - expected: FAIL - - [--foo-4: bar ;] - expected: FAIL - - [--foo-5: bar !important;] - expected: FAIL - - [--foo-6: bar !important ;] - expected: FAIL - - [--foo-9:bar (then ws until end of rule)] - expected: FAIL [--foo-2: bar;] expected: diff --git a/testing/web-platform/meta/css/css-variables/variable-cssText.html.ini b/testing/web-platform/meta/css/css-variables/variable-cssText.html.ini @@ -4,9 +4,3 @@ [target9] expected: if (os == "linux") and not debug: [PASS, FAIL] - - [target4] - expected: FAIL - - [target5] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-variables/variable-definition.html.ini b/testing/web-platform/meta/css/css-variables/variable-definition.html.ini @@ -76,42 +76,6 @@ expected: if (os == "linux") and not debug: [PASS, FAIL] - [ trailing white space (single space)] - expected: FAIL - - [ trailing white space (double space) 2] - expected: FAIL - - [!important] - expected: FAIL - - [!important (with space)] - expected: FAIL - - [ trailing white space (single space) (Computed Style)] - expected: FAIL - - [ trailing white space (double space) 2 (Computed Style)] - expected: FAIL - - [!important (Computed Style)] - expected: FAIL - - [!important (with space) (Computed Style)] - expected: FAIL - - [ trailing white space (single space) (Cascading)] - expected: FAIL - - [ trailing white space (double space) 2 (Cascading)] - expected: FAIL - - [!important (Cascading)] - expected: FAIL - - [!important (with space) (Cascading)] - expected: FAIL - [can overwrite with no value] expected: FAIL