Auto merge of #15518 - emilio:color, r=SimonSapin

style: Unbox a bunch of color properties.

This builds on https://github.com/servo/rust-cssparser/pull/118.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-14 11:43:16 -08:00 committed by GitHub
commit 357bf3b85a
37 changed files with 185 additions and 195 deletions

View file

@ -47,14 +47,14 @@ no_viewport_percentage!(i32); // For PropertyDeclaration::Order
#[allow(missing_docs)]
pub struct CSSColor {
pub parsed: cssparser::Color,
pub authored: Option<String>,
pub authored: Option<Box<str>>,
}
impl Parse for CSSColor {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
let start_position = input.position();
let authored = match input.next() {
Ok(Token::Ident(s)) => Some(s.into_owned()),
Ok(Token::Ident(s)) => Some(s.into_owned().into_boxed_str()),
_ => None,
};
input.reset(start_position);
@ -81,7 +81,7 @@ impl ToCss for CSSColor {
#[allow(missing_docs)]
pub struct CSSRGBA {
pub parsed: cssparser::RGBA,
pub authored: Option<String>,
pub authored: Option<Box<str>>,
}
no_viewport_percentage!(CSSRGBA);