diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 838c07d9a48b..4da02c832b50 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -373,9 +373,18 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box", spec="Internal, not web-exposed, \ may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")} -${helpers.single_keyword("overflow-clip-box", "padding-box content-box", +${helpers.single_keyword("overflow-clip-box-block", "padding-box content-box", products="gecko", animation_value_type="discrete", enabled_in="ua", gecko_pref="layout.css.overflow-clip-box.enabled", + gecko_constant_prefix="NS_STYLE_OVERFLOW_CLIP_BOX", + flags="APPLIES_TO_PLACEHOLDER", + spec="Internal, not web-exposed, \ + may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")} + +${helpers.single_keyword("overflow-clip-box-inline", "padding-box content-box", + products="gecko", animation_value_type="discrete", enabled_in="ua", + gecko_pref="layout.css.overflow-clip-box.enabled", + gecko_constant_prefix="NS_STYLE_OVERFLOW_CLIP_BOX", flags="APPLIES_TO_PLACEHOLDER", spec="Internal, not web-exposed, \ may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")} diff --git a/components/style/properties/shorthand/box.mako.rs b/components/style/properties/shorthand/box.mako.rs index 67b14878c12e..43fa29849fa3 100644 --- a/components/style/properties/shorthand/box.mako.rs +++ b/components/style/properties/shorthand/box.mako.rs @@ -58,6 +58,48 @@ } +<%helpers:shorthand name="overflow-clip-box" sub_properties="overflow-clip-box-block overflow-clip-box-inline" + enabled_in="ua" gecko_pref="layout.css.overflow-clip-box.enabled" + spec="Internal, not web-exposed, may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)" + products="gecko"> + use properties::longhands::{overflow_clip_box_block, overflow_clip_box_inline}; + + pub fn to_inline_value(block_value: overflow_clip_box_block::SpecifiedValue) + -> overflow_clip_box_inline::SpecifiedValue { + match block_value { + overflow_clip_box_block::SpecifiedValue::padding_box => + overflow_clip_box_inline::SpecifiedValue::padding_box, + overflow_clip_box_block::SpecifiedValue::content_box => + overflow_clip_box_inline::SpecifiedValue::content_box + } + } + + pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) + -> Result> { + let block_value = overflow_clip_box_block::parse(context, input)?; + let inline_value = input.try(|input| overflow_clip_box_inline::parse(context, input)).unwrap_or( + to_inline_value(block_value)); + + Ok(expanded! { + overflow_clip_box_block: block_value, + overflow_clip_box_inline: inline_value, + }) + } + + impl<'a> ToCss for LonghandsToSerialize<'a> { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + if to_inline_value(*self.overflow_clip_box_block) == *self.overflow_clip_box_inline { + self.overflow_clip_box_block.to_css(dest) + } else { + self.overflow_clip_box_block.to_css(dest)?; + dest.write_str(" ")?; + self.overflow_clip_box_inline.to_css(dest) + } + } + } + + + macro_rules! try_parse_one { ($input: expr, $var: ident, $prop_module: ident) => { if $var.is_none() {