Change LengthOrPercentage to make use of NoCalcLength

This commit is contained in:
Ravi Shankar 2017-01-23 15:04:41 +05:30
parent 377a23df50
commit 590c9579f0
10 changed files with 61 additions and 60 deletions

View file

@ -5,7 +5,7 @@
pub use std::sync::Arc;
pub use style::computed_values::display::T::inline_block;
pub use style::properties::{DeclaredValue, PropertyDeclaration, PropertyDeclarationBlock, Importance, PropertyId};
pub use style::values::specified::{BorderStyle, BorderWidth, CSSColor, Length};
pub use style::values::specified::{BorderStyle, BorderWidth, CSSColor, Length, NoCalcLength};
pub use style::values::specified::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrAutoOrContent};
pub use style::properties::longhands::outline_color::computed_value::T as ComputedColor;
pub use style::values::RGBA;
@ -23,7 +23,7 @@ fn property_declaration_block_should_serialize_correctly() {
Importance::Normal),
(PropertyDeclaration::MinHeight(
DeclaredValue::Value(LengthOrPercentage::Length(Length::from_px(20f32)))),
DeclaredValue::Value(LengthOrPercentage::Length(NoCalcLength::from_px(20f32)))),
Importance::Normal),
(PropertyDeclaration::Height(
@ -178,8 +178,8 @@ mod shorthand_serialization {
fn padding_should_serialize_correctly() {
let mut properties = Vec::new();
let px_10 = DeclaredValue::Value(LengthOrPercentage::Length(Length::from_px(10f32)));
let px_15 = DeclaredValue::Value(LengthOrPercentage::Length(Length::from_px(15f32)));
let px_10 = DeclaredValue::Value(LengthOrPercentage::Length(NoCalcLength::from_px(10f32)));
let px_15 = DeclaredValue::Value(LengthOrPercentage::Length(NoCalcLength::from_px(15f32)));
properties.push(PropertyDeclaration::PaddingTop(px_10.clone()));
properties.push(PropertyDeclaration::PaddingRight(px_15.clone()));
properties.push(PropertyDeclaration::PaddingBottom(px_10));
@ -637,7 +637,7 @@ mod shorthand_serialization {
let font_variant = DeclaredValue::Value(FontVariant::normal);
let font_weight = DeclaredValue::Value(FontWeight::Bolder);
let font_size = DeclaredValue::Value(FontSizeContainer(
LengthOrPercentage::Length(Length::from_px(4f32)))
LengthOrPercentage::Length(NoCalcLength::from_px(4f32)))
);
let font_stretch = DeclaredValue::Value(FontStretch::expanded);
let line_height = DeclaredValue::Value(LineHeight::Number(3f32));
@ -718,14 +718,14 @@ mod shorthand_serialization {
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(7f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(7f32))),
}
);
let position_y = single_vec_value_typedef!(position_y,
VerticalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(4f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(4f32))),
}
);
@ -778,14 +778,14 @@ mod shorthand_serialization {
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(7f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(7f32))),
}
);
let position_y = single_vec_value_typedef!(position_y,
VerticalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(4f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(4f32))),
}
);
@ -837,14 +837,14 @@ mod shorthand_serialization {
let position_x = single_vec_value_typedef!(position_x,
HorizontalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(0f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(0f32))),
}
);
let position_y = single_vec_value_typedef!(position_y,
VerticalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(0f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(0f32))),
}
);
@ -922,11 +922,11 @@ mod shorthand_serialization {
Position {
horizontal: HorizontalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(7f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(7f32))),
},
vertical: VerticalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(4f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(4f32))),
},
}
);
@ -976,11 +976,11 @@ mod shorthand_serialization {
Position {
horizontal: HorizontalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(7f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(7f32))),
},
vertical: VerticalPosition {
keyword: None,
position: Some(LengthOrPercentage::Length(Length::from_px(4f32))),
position: Some(LengthOrPercentage::Length(NoCalcLength::from_px(4f32))),
},
}
);