style: Should not serialize default radius of circle.

Should not serialize default shape-outside circle() function radius.

The ToCss impl of Circle and Ellipse turn out to be identical in specified and computed value, thus move them to generics.

Differential Revision: https://phabricator.services.mozilla.com/D35183
This commit is contained in:
violet 2019-06-18 11:54:41 +00:00 committed by Emilio Cobos Álvarez
parent c7c1fed95c
commit e1e82dbe5f
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
3 changed files with 43 additions and 71 deletions

View file

@ -378,6 +378,48 @@ where
}
}
impl<H, V, NonNegativeLengthPercentage> ToCss for Circle<H, V, NonNegativeLengthPercentage>
where
GenericPosition<H, V>: ToCss,
NonNegativeLengthPercentage: ToCss + PartialEq,
{
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
dest.write_str("circle(")?;
if self.radius != Default::default() {
self.radius.to_css(dest)?;
dest.write_str(" ")?;
}
dest.write_str("at ")?;
self.position.to_css(dest)?;
dest.write_str(")")
}
}
impl<H, V, NonNegativeLengthPercentage> ToCss for Ellipse<H, V, NonNegativeLengthPercentage>
where
GenericPosition<H, V>: ToCss,
NonNegativeLengthPercentage: ToCss + PartialEq,
{
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
dest.write_str("ellipse(")?;
if self.semiaxis_x != Default::default() || self.semiaxis_y != Default::default() {
self.semiaxis_x.to_css(dest)?;
dest.write_str(" ")?;
self.semiaxis_y.to_css(dest)?;
dest.write_str(" ")?;
}
dest.write_str("at ")?;
self.position.to_css(dest)?;
dest.write_str(")")
}
}
impl<L> Default for ShapeRadius<L> {
#[inline]
fn default() -> Self {