Rename CommaSeparated to OneOrMoreCommaSeparated, reflecting its behavior.

This commit is contained in:
Simon Sapin 2017-02-03 13:15:53 +01:00
parent 4701850f37
commit 9ec8418d8c
4 changed files with 9 additions and 9 deletions

View file

@ -15,7 +15,7 @@ use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use parser::{ParserContext, log_css_error, Parse}; use parser::{ParserContext, log_css_error, Parse};
use std::fmt; use std::fmt;
use std::iter; use std::iter;
use style_traits::{ToCss, CommaSeparated}; use style_traits::{ToCss, OneOrMoreCommaSeparated};
use values::specified::url::SpecifiedUrl; use values::specified::url::SpecifiedUrl;
/// A source for a font-face rule. /// A source for a font-face rule.
@ -46,7 +46,7 @@ impl ToCss for Source {
} }
} }
impl CommaSeparated for Source {} impl OneOrMoreCommaSeparated for Source {}
/// A `UrlSource` represents a font-face source that has been specified with a /// A `UrlSource` represents a font-face source that has been specified with a
/// `url()` function. /// `url()` function.
@ -323,7 +323,7 @@ pub mod unicode_range {
use cssparser::{Parser, Token}; use cssparser::{Parser, Token};
use parser::{ParserContext, Parse}; use parser::{ParserContext, Parse};
use std::fmt; use std::fmt;
use style_traits::{ToCss, CommaSeparated}; use style_traits::{ToCss, OneOrMoreCommaSeparated};
/// Maximum value of the end of a range /// Maximum value of the end of a range
pub const MAX: u32 = ::std::char::MAX as u32; pub const MAX: u32 = ::std::char::MAX as u32;
@ -338,7 +338,7 @@ pub mod unicode_range {
pub end: u32, pub end: u32,
} }
impl CommaSeparated for Range {} impl OneOrMoreCommaSeparated for Range {}
impl Parse for Range { impl Parse for Range {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {

View file

@ -11,7 +11,7 @@ use error_reporting::ParseErrorReporter;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI}; use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use style_traits::CommaSeparated; use style_traits::OneOrMoreCommaSeparated;
use stylesheets::{MemoryHoleReporter, Origin}; use stylesheets::{MemoryHoleReporter, Origin};
/// Extra data that the style backend may need to parse stylesheets. /// Extra data that the style backend may need to parse stylesheets.
@ -104,7 +104,7 @@ pub trait Parse : Sized {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()>; fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()>;
} }
impl<T> Parse for Vec<T> where T: Parse + CommaSeparated { impl<T> Parse for Vec<T> where T: Parse + OneOrMoreCommaSeparated {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
input.parse_comma_separated(|input| T::parse(context, input)) input.parse_comma_separated(|input| T::parse(context, input))
} }

View file

@ -59,4 +59,4 @@ pub mod cursor;
pub mod values; pub mod values;
pub mod viewport; pub mod viewport;
pub use values::{ToCss, CommaSeparated}; pub use values::{ToCss, OneOrMoreCommaSeparated};

View file

@ -25,9 +25,9 @@ pub trait ToCss {
} }
/// Marker trait to automatically implement ToCss for Vec<T>. /// Marker trait to automatically implement ToCss for Vec<T>.
pub trait CommaSeparated {} pub trait OneOrMoreCommaSeparated {}
impl<T> ToCss for Vec<T> where T: ToCss + CommaSeparated { impl<T> ToCss for Vec<T> where T: ToCss + OneOrMoreCommaSeparated {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let mut iter = self.iter(); let mut iter = self.iter();
iter.next().unwrap().to_css(dest)?; iter.next().unwrap().to_css(dest)?;