style: Unbox a bunch of color properties.

This builds on https://github.com/servo/rust-cssparser/pull/118.
This commit is contained in:
Emilio Cobos Álvarez 2017-02-12 15:17:45 +01:00
parent e394334739
commit 0c102e2350
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
37 changed files with 185 additions and 195 deletions

View file

@ -231,15 +231,15 @@ mod shorthand_serialization {
fn border_color_should_serialize_correctly() {
let mut properties = Vec::new();
let red = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let red = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
let blue = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 0f32, green: 0f32, blue: 1f32, alpha: 1f32 }),
let blue = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(0, 0, 255, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::BorderTopColor(blue.clone()));
properties.push(PropertyDeclaration::BorderRightColor(red.clone()));
@ -281,10 +281,10 @@ mod shorthand_serialization {
let width = DeclaredValue::Value(BorderWidth::from_length(Length::from_px(4f32)));
let style = DeclaredValue::Value(BorderStyle::solid);
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::BorderTopWidth(width));
properties.push(PropertyDeclaration::BorderTopStyle(style));
@ -300,10 +300,10 @@ mod shorthand_serialization {
let width = DeclaredValue::Value(BorderWidth::from_length(Length::from_px(4f32)));
let style = DeclaredValue::Initial;
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::BorderTopWidth(width));
properties.push(PropertyDeclaration::BorderTopStyle(style));
@ -469,10 +469,10 @@ mod shorthand_serialization {
let width = DeclaredValue::Value(WidthContainer(Length::from_px(4f32)));
let style = DeclaredValue::Value(Either::Second(BorderStyle::solid));
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::OutlineWidth(width));
properties.push(PropertyDeclaration::OutlineStyle(style));
@ -504,10 +504,10 @@ mod shorthand_serialization {
let width = DeclaredValue::Value(WidthContainer(Length::from_px(4f32)));
let style = DeclaredValue::Initial;
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::OutlineWidth(width));
properties.push(PropertyDeclaration::OutlineStyle(style));
properties.push(PropertyDeclaration::OutlineColor(color));
@ -522,10 +522,10 @@ mod shorthand_serialization {
let width = DeclaredValue::Value(WidthContainer(Length::from_px(4f32)));
let style = DeclaredValue::Value(Either::First(Auto));
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
properties.push(PropertyDeclaration::OutlineWidth(width));
properties.push(PropertyDeclaration::OutlineStyle(style));
properties.push(PropertyDeclaration::OutlineColor(color));
@ -730,10 +730,10 @@ mod shorthand_serialization {
fn background_should_serialize_all_available_properties_when_specified() {
let mut properties = Vec::new();
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {
@ -790,10 +790,10 @@ mod shorthand_serialization {
fn background_should_combine_origin_and_clip_properties_when_equal() {
let mut properties = Vec::new();
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {
@ -849,10 +849,10 @@ mod shorthand_serialization {
fn background_should_always_print_color_and_url_and_repeat_and_attachment_and_position() {
let mut properties = Vec::new();
let color = DeclaredValue::Value(Box::new(CSSColor {
parsed: ComputedColor::RGBA(RGBA { red: 1f32, green: 0f32, blue: 0f32, alpha: 1f32 }),
let color = DeclaredValue::Value(CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
authored: None
}));
});
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {