mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
c7c1fed95c
commit
e1e82dbe5f
3 changed files with 43 additions and 71 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue