style: Add internal overflow-clip-box-block/-inline properties and make overflow-clip-box a shorthand.

Bug: 1422839
Reviewed-by: emilio
This commit is contained in:
Mats Palmgren 2017-12-05 18:20:21 +01:00 committed by Emilio Cobos Álvarez
parent b56d7b8070
commit cdf7ae51b6
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 52 additions and 1 deletions

View file

@ -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)")}

View file

@ -58,6 +58,48 @@
}
</%helpers:shorthand>
<%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<Longhands, ParseError<'i>> {
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<W>(&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)
}
}
}
</%helpers:shorthand>
macro_rules! try_parse_one {
($input: expr, $var: ident, $prop_module: ident) => {
if $var.is_none() {