style: Drop the manually implementation of ToCSS for BasicShape::Polygon.

The implementation of ToCSS for Polygon has some rule, and we could use skip_if
to handle and serialization of fill-rule. However, we should derive ToCSS for
the pair of LengthOrPercentages, so define a new type for it.

Differential Revision: https://phabricator.services.mozilla.com/D4153
This commit is contained in:
Boris Chiou 2018-08-23 20:32:53 +00:00 committed by Emilio Cobos Álvarez
parent c587fa3586
commit e46daa09ea
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 27 additions and 37 deletions

View file

@ -14,7 +14,7 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use values::computed::Percentage;
use values::generics::basic_shape as generic;
use values::generics::basic_shape::{FillRule, GeometryBox, ShapeBox, ShapeSource};
use values::generics::basic_shape::{FillRule, GeometryBox, PolygonCoord, ShapeBox, ShapeSource};
use values::generics::rect::Rect;
use values::specified::LengthOrPercentage;
use values::specified::border::BorderRadius;
@ -381,7 +381,7 @@ impl Polygon {
.unwrap_or_default();
let buf = input.parse_comma_separated(|i| {
Ok((
Ok(PolygonCoord(
LengthOrPercentage::parse(context, i)?,
LengthOrPercentage::parse(context, i)?,
))