Skip to content

Commit

Permalink
Enable overflow:clip for Servo
Browse files Browse the repository at this point in the history
  • Loading branch information
longvatrong111 committed Jan 21, 2025
1 parent dfed17b commit f54c445
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions style/properties/longhands/box.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion style/properties/longhands/margin.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)}
Expand Down
2 changes: 1 addition & 1 deletion style/properties/shorthands/box.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
19 changes: 15 additions & 4 deletions style/values/specified/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,6 @@ pub enum OverflowAnchor {
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
Expand All @@ -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<Self, ParseError<'i>> {
Ok(try_match_ident_ignore_ascii_case! { input,
"padding-box" => Self::PaddingBox,
"content-box" => Self::ContentBox,
"border-box" => Self::BorderBox,
"" => Self::PaddingBox,
})
}
}

#[derive(
Expand Down Expand Up @@ -1813,7 +1827,6 @@ pub enum Overflow {
Hidden,
Scroll,
Auto,
#[cfg(feature = "gecko")]
Clip,
}

Expand All @@ -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") => {
Expand All @@ -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,
}
}
Expand Down

0 comments on commit f54c445

Please sign in to comment.