diff options
author | Jonathan Chan <jyc@eqv.io> | 2017-06-19 15:35:58 -0700 |
---|---|---|
committer | Jonathan Chan <jyc@eqv.io> | 2017-06-19 16:09:37 -0700 |
commit | 26179b3660f9583ec6859d8e49e676861546d4ec (patch) | |
tree | eb1a864afff5441775f03844f67cd76ffda4527c /components/style/parser.rs | |
parent | e41b7d06b473544755902be2c1334a7622c84940 (diff) | |
download | servo-26179b3660f9583ec6859d8e49e676861546d4ec.tar.gz servo-26179b3660f9583ec6859d8e49e676861546d4ec.zip |
style: Have OneOrMoreSeparated replace OneOrMoreCommaSeparated.
A future patch series has some values that should be separated by spaces. This
allows us to re-use the code for serialization, but the types do get a little
clunky. The separator is now indicated with an associated type.
Diffstat (limited to 'components/style/parser.rs')
-rw-r--r-- | components/style/parser.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/style/parser.rs b/components/style/parser.rs index 0145c128eca..86e7b6d4199 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -7,7 +7,7 @@ use context::QuirksMode; use cssparser::{Parser, SourcePosition, UnicodeRange}; use error_reporting::{ParseErrorReporter, ContextualParseError}; -use style_traits::{OneOrMoreCommaSeparated, ParseError, ParsingMode}; +use style_traits::{OneOrMoreSeparated, IsCommaSeparator, ParseError, ParsingMode}; #[cfg(feature = "gecko")] use style_traits::{PARSING_MODE_DEFAULT, PARSING_MODE_ALLOW_UNITLESS_LENGTH, PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES}; use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces}; @@ -161,7 +161,9 @@ pub trait Parse : Sized { -> Result<Self, ParseError<'i>>; } -impl<T> Parse for Vec<T> where T: Parse + OneOrMoreCommaSeparated { +impl<T> Parse for Vec<T> where T: Parse + OneOrMoreSeparated, + <T as OneOrMoreSeparated>::S: IsCommaSeparator +{ fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { input.parse_comma_separated(|input| T::parse(context, input)) |