commit 07721ce260c71d0a5d99564b0e0d376d7ee8e2be
parent 4e67436c44ad073c265d105fa94beb78dfd23f47
Author: Oriol Brufau <obrufau@igalia.com>
Date: Tue, 7 Oct 2025 12:23:19 +0000
Bug 1992880 - Enable -webkit-fill-available for Servo. r=firefox-style-system-reviewers,emilio
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:
2 files changed, 16 insertions(+), 29 deletions(-)
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")
}