mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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.
This commit is contained in:
parent
e41b7d06b4
commit
26179b3660
6 changed files with 64 additions and 14 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue