tor-browser

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

commit f3848878d436aab44ce78d60cac745b877293cfc
parent 716f7f4a5ac3d8cb4dbabdc72781fe49fbac9541
Author: Oriol Brufau <obrufau@igalia.com>
Date:   Tue,  7 Oct 2025 23:16:09 +0000

Bug 1992880 - Enable -webkit-fill-available for Servo. r=firefox-style-system-reviewers,emilio,layout-reviewers

Servo already had full support for the `stretch` sizing keyword, so
treating `-webkit-fill-available` as an alias is not a big deal.

Also, this fixes `collect_completion_keywords()` to check these prefs:
 - `layout.css.webkit-fill-available.enabled`
 - `layout.css.stretch-size-keyword.enabled`

Probably `layout.css.webkit-fill-available.all-size-properties.enabled`
should be checked too, but that woudl be tricky because `GenericSize` is
used for both the min and preferred sizing properties.

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

Diffstat:
Mlayout/inspector/tests/test_bug877690.html | 16++++++++++++----
Mservo/components/style/values/generics/length.rs | 32++++++++++++++++----------------
Mservo/components/style/values/specified/length.rs | 13-------------
3 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/layout/inspector/tests/test_bug877690.html b/layout/inspector/tests/test_bug877690.html @@ -158,7 +158,6 @@ function do_test() { var values = InspectorUtils.getCSSValuesForProperty(prop); var expected = [ "-moz-available", - "-webkit-fill-available", "auto", "fit-content", "inherit", @@ -167,10 +166,15 @@ function do_test() { "min-content", "revert", "revert-layer", - "stretch", "unset", ]; + if(SpecialPowers.getBoolPref("layout.css.stretch-size-keyword.enabled")) { + expected.push("stretch"); + } + if(SpecialPowers.getBoolPref("layout.css.webkit-fill-available.enabled")) { + expected.push("-webkit-fill-available"); + } if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) { expected.push("anchor-size"); } @@ -181,7 +185,6 @@ function do_test() { var values = InspectorUtils.getCSSValuesForProperty(prop); var expected = [ "-moz-available", - "-webkit-fill-available", "none", "fit-content", "inherit", @@ -190,10 +193,15 @@ function do_test() { "min-content", "revert", "revert-layer", - "stretch", "unset", ]; + if(SpecialPowers.getBoolPref("layout.css.stretch-size-keyword.enabled")) { + expected.push("stretch"); + } + if(SpecialPowers.getBoolPref("layout.css.webkit-fill-available.enabled")) { + expected.push("-webkit-fill-available"); + } if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) { expected.push("anchor-size"); } diff --git a/servo/components/style/values/generics/length.rs b/servo/components/style/values/generics/length.rs @@ -166,7 +166,6 @@ pub enum GenericSize<LengthPercent> { #[cfg(feature = "gecko")] #[animation(error)] MozAvailable, - #[cfg(feature = "gecko")] #[animation(error)] WebkitFillAvailable, #[animation(error)] @@ -184,14 +183,15 @@ where { fn collect_completion_keywords(f: style_traits::KeywordsCollectFn) { LengthPercent::collect_completion_keywords(f); - f(&["auto", "stretch", "fit-content"]); + f(&["auto", "fit-content", "max-content", "min-content"]); if cfg!(feature = "gecko") { - f(&[ - "max-content", - "min-content", - "-moz-available", - "-webkit-fill-available", - ]); + f(&["-moz-available"]); + } + if static_prefs::pref!("layout.css.stretch-size-keyword.enabled") { + f(&["stretch"]); + } + if static_prefs::pref!("layout.css.webkit-fill-available.enabled") { + f(&["-webkit-fill-available"]); } if static_prefs::pref!("layout.css.anchor-positioning.enabled") { f(&["anchor-size"]); @@ -245,7 +245,6 @@ pub enum GenericMaxSize<LengthPercent> { #[cfg(feature = "gecko")] #[animation(error)] MozAvailable, - #[cfg(feature = "gecko")] #[animation(error)] WebkitFillAvailable, #[animation(error)] @@ -263,14 +262,15 @@ where { fn collect_completion_keywords(f: style_traits::KeywordsCollectFn) { LP::collect_completion_keywords(f); - f(&["none", "stretch", "fit-content"]); + f(&["none", "fit-content", "max-content", "min-content"]); if cfg!(feature = "gecko") { - f(&[ - "max-content", - "min-content", - "-moz-available", - "-webkit-fill-available", - ]); + f(&["-moz-available"]); + } + if static_prefs::pref!("layout.css.stretch-size-keyword.enabled") { + f(&["stretch"]); + } + if static_prefs::pref!("layout.css.webkit-fill-available.enabled") { + f(&["-webkit-fill-available"]); } if static_prefs::pref!("layout.css.anchor-positioning.enabled") { f(&["anchor-size"]); diff --git a/servo/components/style/values/specified/length.rs b/servo/components/style/values/specified/length.rs @@ -2057,7 +2057,6 @@ macro_rules! parse_size_non_length { "fit-content" | "-moz-fit-content" => $size::FitContent, #[cfg(feature = "gecko")] "-moz-available" => $size::MozAvailable, - #[cfg(feature = "gecko")] "-webkit-fill-available" if $allow_webkit_fill_available => $size::WebkitFillAvailable, "stretch" if is_stretch_enabled() => $size::Stretch, $auto_or_none => $size::$auto_or_none_ident, @@ -2069,12 +2068,10 @@ macro_rules! parse_size_non_length { }}; } -#[cfg(feature = "gecko")] fn is_webkit_fill_available_enabled_in_width_and_height() -> bool { static_prefs::pref!("layout.css.webkit-fill-available.enabled") } -#[cfg(feature = "gecko")] fn is_webkit_fill_available_enabled_in_all_size_properties() -> bool { // For convenience at the callsites, we check both prefs here, // since both must be 'true' in order for the keyword to be @@ -2083,16 +2080,6 @@ fn is_webkit_fill_available_enabled_in_all_size_properties() -> bool { && static_prefs::pref!("layout.css.webkit-fill-available.all-size-properties.enabled") } -#[cfg(feature = "servo")] -fn is_webkit_fill_available_enabled_in_width_and_height() -> bool { - false -} - -#[cfg(feature = "servo")] -fn is_webkit_fill_available_enabled_in_all_size_properties() -> bool { - false -} - fn is_stretch_enabled() -> bool { static_prefs::pref!("layout.css.stretch-size-keyword.enabled") }