From f54c445dc4ccd1ce20016636dcb85981a82354eb Mon Sep 17 00:00:00 2001 From: batu_hoang Date: Wed, 15 Jan 2025 17:59:41 +0800 Subject: [PATCH] Enable overflow:clip for Servo --- style/properties/longhands/box.mako.rs | 4 ++-- style/properties/longhands/margin.mako.rs | 2 +- style/properties/shorthands/box.mako.rs | 2 +- style/values/specified/box.rs | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/style/properties/longhands/box.mako.rs b/style/properties/longhands/box.mako.rs index 920f7ea09..f072aa0e8 100644 --- a/style/properties/longhands/box.mako.rs +++ b/style/properties/longhands/box.mako.rs @@ -134,7 +134,7 @@ ${helpers.predefined_type( ${helpers.single_keyword( "-servo-overflow-clip-box", - "padding-box content-box", + "padding-box content-box border-box", engines="servo", animation_type="none", enabled_in="ua", @@ -148,7 +148,7 @@ ${helpers.single_keyword( "overflow-clip-box-" + direction, "OverflowClipBox", "computed::OverflowClipBox::PaddingBox", - engines="gecko", + engines="gecko servo", enabled_in="chrome", gecko_pref="layout.css.overflow-clip-box.enabled", animation_type="discrete", diff --git a/style/properties/longhands/margin.mako.rs b/style/properties/longhands/margin.mako.rs index 1b733859d..f063658ce 100644 --- a/style/properties/longhands/margin.mako.rs +++ b/style/properties/longhands/margin.mako.rs @@ -33,7 +33,7 @@ ${helpers.predefined_type( "Length", "computed::Length::zero()", parse_method="parse_non_negative", - engines="gecko", + engines="gecko servo", spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-clip-margin", affects="overflow", )} diff --git a/style/properties/shorthands/box.mako.rs b/style/properties/shorthands/box.mako.rs index 0a41b6b66..7c8c52a8d 100644 --- a/style/properties/shorthands/box.mako.rs +++ b/style/properties/shorthands/box.mako.rs @@ -16,7 +16,7 @@ ${helpers.two_properties_shorthand( "overflow-clip-box", "overflow-clip-box-block", "overflow-clip-box-inline", - engines="gecko", + engines="gecko servo", enabled_in="chrome", gecko_pref="layout.css.overflow-clip-box.enabled", spec="Internal, may be standardized in the future " diff --git a/style/values/specified/box.rs b/style/values/specified/box.rs index f227ad61d..25ee0d3f0 100644 --- a/style/values/specified/box.rs +++ b/style/values/specified/box.rs @@ -924,7 +924,6 @@ pub enum OverflowAnchor { Debug, Eq, MallocSizeOf, - Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, @@ -936,6 +935,21 @@ pub enum OverflowAnchor { pub enum OverflowClipBox { PaddingBox, ContentBox, + BorderBox, +} + +impl Parse for OverflowClipBox { + fn parse<'i, 't>( + _: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { + Ok(try_match_ident_ignore_ascii_case! { input, + "padding-box" => Self::PaddingBox, + "content-box" => Self::ContentBox, + "border-box" => Self::BorderBox, + "" => Self::PaddingBox, + }) + } } #[derive( @@ -1813,7 +1827,6 @@ pub enum Overflow { Hidden, Scroll, Auto, - #[cfg(feature = "gecko")] Clip, } @@ -1829,7 +1842,6 @@ impl Parse for Overflow { "hidden" => Self::Hidden, "scroll" => Self::Scroll, "auto" | "overlay" => Self::Auto, - #[cfg(feature = "gecko")] "clip" => Self::Clip, #[cfg(feature = "gecko")] "-moz-hidden-unscrollable" if static_prefs::pref!("layout.css.overflow-moz-hidden-unscrollable.enabled") => { @@ -1852,7 +1864,6 @@ impl Overflow { match *self { Self::Hidden | Self::Scroll | Self::Auto => *self, Self::Visible => Self::Auto, - #[cfg(feature = "gecko")] Self::Clip => Self::Hidden, } }