mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Let overflow parse two values.
Per https://github.com/w3c/csswg-drafts/issues/2484. Bug: 1453148 Reviewed-by: xidorn MozReview-Commit-ID: D7M3PhnTtD2
This commit is contained in:
parent
ec6f71e8fa
commit
061c87ad00
3 changed files with 15 additions and 45 deletions
|
@ -4,8 +4,11 @@
|
|||
|
||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||
|
||||
<%helpers:shorthand name="overflow" sub_properties="overflow-x overflow-y"
|
||||
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow">
|
||||
<%helpers:shorthand
|
||||
name="overflow"
|
||||
sub_properties="overflow-x overflow-y"
|
||||
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow"
|
||||
>
|
||||
use properties::longhands::overflow_x::parse as parse_overflow;
|
||||
% if product == "gecko":
|
||||
use properties::longhands::overflow_x::SpecifiedValue;
|
||||
|
@ -42,20 +45,23 @@
|
|||
return moz_kw_found
|
||||
}
|
||||
% endif
|
||||
let overflow = parse_overflow(context, input)?;
|
||||
let overflow_x = parse_overflow(context, input)?;
|
||||
let overflow_y =
|
||||
input.try(|i| parse_overflow(context, i)).unwrap_or(overflow_x);
|
||||
Ok(expanded! {
|
||||
overflow_x: overflow,
|
||||
overflow_y: overflow,
|
||||
overflow_x: overflow_x,
|
||||
overflow_y: overflow_y,
|
||||
})
|
||||
}
|
||||
|
||||
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
|
||||
if self.overflow_x == self.overflow_y {
|
||||
self.overflow_x.to_css(dest)
|
||||
} else {
|
||||
Ok(())
|
||||
self.overflow_x.to_css(dest)?;
|
||||
if self.overflow_x != self.overflow_y {
|
||||
dest.write_char(' ')?;
|
||||
self.overflow_y.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue