diff --git a/components/style/cbindgen.toml b/components/style/cbindgen.toml index 27ad7bc80a1..f9635812ac4 100644 --- a/components/style/cbindgen.toml +++ b/components/style/cbindgen.toml @@ -63,6 +63,7 @@ include = [ "Float", "OverscrollBehavior", "ScrollSnapType", + "OverflowAnchor", "OverflowClipBox", "Resize", "Overflow", diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 4d980039d1e..fa4f55bc9e5 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -326,6 +326,7 @@ class Longhand(object): "Opacity", "OutlineStyle", "Overflow", + "OverflowAnchor", "OverflowClipBox", "OverflowWrap", "OverscrollBehavior", diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 40691d75e04..631a9878171 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1419,6 +1419,7 @@ impl Clone for ${style_struct.gecko_struct_name} { "Number": impl_simple, "Opacity": impl_simple, "OverflowWrap": impl_simple, + "OverflowAnchor": impl_simple, "Perspective": impl_style_coord, "Position": impl_position, "RGBAColor": impl_rgba_color, diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index 1818179a442..10e610a32af 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -125,6 +125,18 @@ ${helpers.predefined_type( servo_restyle_damage = "reflow", )} +${helpers.predefined_type( + "overflow-anchor", + "OverflowAnchor", + "computed::OverflowAnchor::Auto", + initial_specified_value="specified::OverflowAnchor::Auto", + products="gecko", + needs_context=False, + gecko_pref="layout.css.scroll-anchoring.enabled", + spec="https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api", + animation_value_type="discrete", +)} + <% transition_extra_prefixes = "moz:layout.css.prefixes.transitions webkit" %> ${helpers.predefined_type( diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 381ae7b364e..89935e2b4d4 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -13,7 +13,7 @@ use crate::values::specified::box_ as specified; pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin}; pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; -pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowClipBox}; +pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowAnchor, OverflowClipBox}; pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType}; pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange}; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index c389e1d1267..c727729b958 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -43,7 +43,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderImageSlice, BorderImageWidth}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain}; pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; -pub use self::box_::{Display, Overflow, TransitionProperty}; +pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor}; diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 30111170bc0..b94ec8a0f26 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -413,6 +413,26 @@ pub enum OverscrollBehavior { None, } +#[allow(missing_docs)] +#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] +#[repr(u8)] +pub enum OverflowAnchor { + Auto, + None, +} + #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 0d35d2b1d75..d2015f714b5 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -36,7 +36,7 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; -pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow}; +pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow, OverflowAnchor}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor};