diff --git a/components/style/cbindgen.toml b/components/style/cbindgen.toml index 098022cf13d..84bf2eb4301 100644 --- a/components/style/cbindgen.toml +++ b/components/style/cbindgen.toml @@ -40,6 +40,7 @@ prefix = "Style" include = [ "Appearance", "BreakBetween", + "BreakWithin", "ComputedFontStretchRange", "ComputedFontStyleDescriptor", "ComputedFontWeightRange", diff --git a/components/style/properties/data.py b/components/style/properties/data.py index c0be33177f2..22d5337fe67 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -292,6 +292,7 @@ class Longhand(object): "AlignSelf", "Appearance", "BreakBetween", + "BreakWithin", "BackgroundRepeat", "BorderImageRepeat", "BorderStyle", diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 15d4c40773b..f0b8cef22ac 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1397,6 +1397,7 @@ impl Clone for ${style_struct.gecko_struct_name} { # Types used with predefined_type()-defined properties that we can auto-generate. predefined_types = { "BreakBetween": impl_simple, + "BreakWithin": impl_simple, "Color": impl_color, "ColorOrAuto": impl_color, "GreaterThanOrEqualToOneNumber": impl_simple, diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index da0e919f784..f83b7928dc9 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -457,12 +457,13 @@ ${helpers.predefined_type( animation_value_type="discrete", )} -${helpers.single_keyword( +${helpers.predefined_type( "page-break-inside", - "auto avoid", - products="gecko", + "BreakWithin", + "computed::BreakWithin::Auto", gecko_ffi_name="mBreakInside", - gecko_constant_prefix="NS_STYLE_PAGE_BREAK", + needs_context=False, + products="gecko", spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-inside", animation_value_type="discrete", )} diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index dd168b72b39..1af0efff85c 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -11,7 +11,7 @@ use crate::values::generics::box_::Perspective as GenericPerspective; use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign; use crate::values::specified::box_ as specified; -pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween}; +pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin}; pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox}; pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType}; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 3f3b29189ab..cae5519f2e7 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -42,7 +42,7 @@ pub use self::border::{BorderCornerRadius, BorderRadius, BorderSpacing}; 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, Clear, Float}; +pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; pub use self::box_::{Display, TransitionProperty}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange}; diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 8d0c9f38be9..5229f839eaf 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -1315,3 +1315,26 @@ pub enum BreakBetween { Left, Right, } + +/// A kind of break within a box. +/// +/// https://drafts.csswg.org/css-break/#break-within +#[allow(missing_docs)] +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, + ToComputedValue, +)] +#[repr(u8)] +pub enum BreakWithin { + Auto, + Avoid, +} diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 6fa8dbb4101..0a1c323481e 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}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; -pub use self::box_::{Appearance, BreakBetween, Clear, Float}; +pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor};