Use BorderSideWidth for outline-width

This commit is contained in:
Anthony Ramine 2017-05-31 21:09:01 +02:00
parent 2c7fbb4b4c
commit 7da94d0880
13 changed files with 137 additions and 186 deletions

View file

@ -9,7 +9,7 @@ use style::properties::longhands::outline_color::computed_value::T as ComputedCo
use style::properties::parse_property_declaration_list;
use style::values::{RGBA, Auto};
use style::values::CustomIdent;
use style::values::specified::{BorderStyle, BorderWidth, CSSColor, Length, LengthOrPercentage};
use style::values::specified::{BorderStyle, BorderSideWidth, CSSColor, Length, LengthOrPercentage};
use style::values::specified::{LengthOrPercentageOrAuto, LengthOrPercentageOrAutoOrContent};
use style::values::specified::{NoCalcLength, PositionComponent};
use style::values::specified::position::Y;
@ -221,8 +221,8 @@ mod shorthand_serialization {
properties.push(PropertyDeclaration::BorderBottomStyle(solid.clone()));
properties.push(PropertyDeclaration::BorderLeftStyle(solid.clone()));
let px_30 = BorderWidth::from_length(Length::from_px(30f32));
let px_10 = BorderWidth::from_length(Length::from_px(10f32));
let px_30 = BorderSideWidth::Length(Length::from_px(30f32));
let px_10 = BorderSideWidth::Length(Length::from_px(10f32));
properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone()));
@ -255,7 +255,7 @@ mod shorthand_serialization {
properties.push(PropertyDeclaration::BorderBottomStyle(solid.clone()));
properties.push(PropertyDeclaration::BorderLeftStyle(solid.clone()));
let px_30 = BorderWidth::from_length(Length::from_px(30f32));
let px_30 = BorderSideWidth::Length(Length::from_px(30f32));
properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone()));
@ -295,11 +295,11 @@ mod shorthand_serialization {
fn border_width_should_serialize_correctly() {
let mut properties = Vec::new();
let top_px = BorderWidth::from_length(Length::from_px(10f32));
let bottom_px = BorderWidth::from_length(Length::from_px(10f32));
let top_px = BorderSideWidth::Length(Length::from_px(10f32));
let bottom_px = BorderSideWidth::Length(Length::from_px(10f32));
let right_px = BorderWidth::from_length(Length::from_px(15f32));
let left_px = BorderWidth::from_length(Length::from_px(15f32));
let right_px = BorderSideWidth::Length(Length::from_px(15f32));
let left_px = BorderSideWidth::Length(Length::from_px(15f32));
properties.push(PropertyDeclaration::BorderTopWidth(top_px));
properties.push(PropertyDeclaration::BorderRightWidth(right_px));
@ -314,10 +314,10 @@ mod shorthand_serialization {
fn border_width_with_keywords_should_serialize_correctly() {
let mut properties = Vec::new();
let top_px = BorderWidth::Thin;
let right_px = BorderWidth::Medium;
let bottom_px = BorderWidth::Thick;
let left_px = BorderWidth::from_length(Length::from_px(15f32));
let top_px = BorderSideWidth::Thin;
let right_px = BorderSideWidth::Medium;
let bottom_px = BorderSideWidth::Thick;
let left_px = BorderSideWidth::Length(Length::from_px(15f32));
properties.push(PropertyDeclaration::BorderTopWidth(top_px));
properties.push(PropertyDeclaration::BorderRightWidth(right_px));
@ -403,7 +403,7 @@ mod shorthand_serialization {
fn directional_border_should_show_all_properties_when_values_are_set() {
let mut properties = Vec::new();
let width = BorderWidth::from_length(Length::from_px(4f32));
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = BorderStyle::solid;
let color = CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
@ -418,8 +418,8 @@ mod shorthand_serialization {
assert_eq!(serialization, "border-top: 4px solid rgb(255, 0, 0);");
}
fn get_border_property_values() -> (BorderWidth, BorderStyle, CSSColor) {
(BorderWidth::from_length(Length::from_px(4f32)),
fn get_border_property_values() -> (BorderSideWidth, BorderStyle, CSSColor) {
(BorderSideWidth::Length(Length::from_px(4f32)),
BorderStyle::solid,
CSSColor::currentcolor())
}
@ -523,7 +523,6 @@ mod shorthand_serialization {
}
mod outline {
use style::properties::longhands::outline_width::SpecifiedValue as WidthContainer;
use style::values::Either;
use super::*;
@ -531,7 +530,7 @@ mod shorthand_serialization {
fn outline_should_show_all_properties_when_set() {
let mut properties = Vec::new();
let width = WidthContainer(Length::from_px(4f32));
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = Either::Second(BorderStyle::solid);
let color = CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),
@ -550,7 +549,7 @@ mod shorthand_serialization {
fn outline_should_serialize_correctly_when_style_is_auto() {
let mut properties = Vec::new();
let width = WidthContainer(Length::from_px(4f32));
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = Either::First(Auto);
let color = CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)),