mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #15115 - Wafflespeanut:lop, r=emilio
Introduce the `NoCalcLength` <!-- Please describe your changes on the following line: --> I began this for making the `CalcLengthOrPercentage` represent `LengthOrPercentage` (instead of the enum we already have), but only later did I realize that it will make `LengthOrPercentageOrFoo` types fatty (which is the problem we're trying to avoid - #15061) and so, I dropped that attempt. Along the way, I introduced an internal type for `Length`, for representing all its non-calc variants (which are `Copy`). We could still have this type for the `LengthOrPercentageOrFoo` types which don't really need `Length` since they already have their own variants for calc. r? @Manishearth @emilio @SimonSapin or anyone interested --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15115) <!-- Reviewable:end -->
This commit is contained in:
commit
cd0a6b98f4
19 changed files with 305 additions and 230 deletions
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{Parser, SourcePosition};
|
||||
use euclid::size::TypedSize2D;
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -207,7 +206,7 @@ fn test_mq_default_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::All, css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(100))),
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::from_px(100.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -219,7 +218,7 @@ fn test_mq_default_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::All, css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(43))),
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::from_px(43.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -234,7 +233,7 @@ fn test_mq_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::Known(MediaType::Screen), css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(100))),
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::from_px(100.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -246,7 +245,7 @@ fn test_mq_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::Known(MediaType::Print), css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(43))),
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::from_px(43.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -258,7 +257,7 @@ fn test_mq_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::Known(MediaType::Print), css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Eq(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(43))),
|
||||
ExpressionKind::Width(Range::Eq(ref w)) => assert!(*w == specified::Length::from_px(43.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -270,7 +269,7 @@ fn test_mq_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::Unknown(Atom::from("fridge")), css.to_owned());
|
||||
assert!(q.expressions.len() == 1, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(52))),
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::from_px(52.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -295,11 +294,11 @@ fn test_mq_multiple_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::All, css.to_owned());
|
||||
assert!(q.expressions.len() == 2, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(100))),
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::from_px(100.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
match *q.expressions[1].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(200))),
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::from_px(200.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
@ -311,11 +310,11 @@ fn test_mq_multiple_expressions() {
|
|||
assert!(q.media_type == MediaQueryType::Known(MediaType::Screen), css.to_owned());
|
||||
assert!(q.expressions.len() == 2, css.to_owned());
|
||||
match *q.expressions[0].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(100))),
|
||||
ExpressionKind::Width(Range::Min(ref w)) => assert!(*w == specified::Length::from_px(100.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
match *q.expressions[1].kind_for_testing() {
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::Absolute(Au::from_px(200))),
|
||||
ExpressionKind::Width(Range::Max(ref w)) => assert!(*w == specified::Length::from_px(200.)),
|
||||
_ => panic!("wrong expression type"),
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
@ -19,15 +19,15 @@ fn property_declaration_block_should_serialize_correctly() {
|
|||
|
||||
let declarations = vec![
|
||||
(PropertyDeclaration::Width(
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(70f32)))),
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)))),
|
||||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::MinHeight(
|
||||
DeclaredValue::Value(LengthOrPercentage::Length(Length::from_px(20f32)))),
|
||||
DeclaredValue::Value(LengthOrPercentage::Length(NoCalcLength::from_px(20f32)))),
|
||||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::Height(
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(20f32)))),
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32)))),
|
||||
Importance::Important),
|
||||
|
||||
(PropertyDeclaration::Display(
|
||||
|
@ -113,7 +113,7 @@ mod shorthand_serialization {
|
|||
fn all_equal_properties_should_serialize_to_one_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let px_70 = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(70f32)));
|
||||
let px_70 = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)));
|
||||
properties.push(PropertyDeclaration::MarginTop(px_70.clone()));
|
||||
properties.push(PropertyDeclaration::MarginRight(px_70.clone()));
|
||||
properties.push(PropertyDeclaration::MarginBottom(px_70.clone()));
|
||||
|
@ -127,8 +127,8 @@ mod shorthand_serialization {
|
|||
fn equal_vertical_and_equal_horizontal_properties_should_serialize_to_two_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let vertical_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(5f32)));
|
||||
let vertical_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(5f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(vertical_px.clone()));
|
||||
properties.push(PropertyDeclaration::MarginRight(horizontal_px.clone()));
|
||||
|
@ -143,9 +143,9 @@ mod shorthand_serialization {
|
|||
fn different_vertical_and_equal_horizontal_properties_should_serialize_to_three_values() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(8f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(5f32)));
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(8f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(5f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(top_px));
|
||||
properties.push(PropertyDeclaration::MarginRight(horizontal_px.clone()));
|
||||
|
@ -160,10 +160,10 @@ mod shorthand_serialization {
|
|||
fn different_properties_should_serialize_to_four_values() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(8f32)));
|
||||
let right_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(12f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let left_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(14f32)));
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(8f32)));
|
||||
let right_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(12f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let left_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(14f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(top_px));
|
||||
properties.push(PropertyDeclaration::MarginRight(right_px));
|
||||
|
@ -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))),
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -738,8 +738,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -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))),
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -798,8 +798,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -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))),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -934,8 +934,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -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))),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -988,8 +988,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
@ -6,21 +6,21 @@ use app_units::Au;
|
|||
use style::properties::{DeclaredValue, PropertyDeclaration};
|
||||
use style::properties::longhands::border_top_width;
|
||||
use style::values::HasViewportPercentage;
|
||||
use style::values::specified::{Length, ViewportPercentageLength};
|
||||
use style::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
|
||||
|
||||
#[test]
|
||||
fn has_viewport_percentage_for_specified_value() {
|
||||
//TODO: test all specified value with a HasViewportPercentage impl
|
||||
let pvw = PropertyDeclaration::BorderTopWidth(
|
||||
DeclaredValue::Value(border_top_width::SpecifiedValue::from_length(
|
||||
Length::ViewportPercentage(ViewportPercentageLength::Vw(100.))
|
||||
Length::NoCalc(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.)))
|
||||
))
|
||||
);
|
||||
assert!(pvw.has_viewport_percentage());
|
||||
|
||||
let pabs = PropertyDeclaration::BorderTopWidth(
|
||||
DeclaredValue::Value(border_top_width::SpecifiedValue::from_length(
|
||||
Length::Absolute(Au(100))
|
||||
Length::NoCalc(NoCalcLength::Absolute(Au(100)))
|
||||
))
|
||||
);
|
||||
assert!(!pabs.has_viewport_percentage());
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
use app_units::Au;
|
||||
use cssparser::Parser;
|
||||
use style::values::HasViewportPercentage;
|
||||
use style::values::specified::{ViewportPercentageLength, Length};
|
||||
use style::values::specified::{ViewportPercentageLength, NoCalcLength};
|
||||
use style::values::specified::length::{CalcLengthOrPercentage, CalcUnit};
|
||||
|
||||
#[test]
|
||||
fn length_has_viewport_percentage() {
|
||||
let l = Length::ViewportPercentage(ViewportPercentageLength::Vw(100.));
|
||||
let l = NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.));
|
||||
assert!(l.has_viewport_percentage());
|
||||
let l = Length::Absolute(Au(100));
|
||||
let l = NoCalcLength::Absolute(Au(100));
|
||||
assert!(!l.has_viewport_percentage());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ use style::error_reporting::ParseErrorReporter;
|
|||
use style::media_queries::{Device, MediaType};
|
||||
use style::parser::{ParserContext, ParserContextExtraData};
|
||||
use style::stylesheets::{Stylesheet, Origin};
|
||||
use style::values::specified::Length::{self, ViewportPercentage};
|
||||
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
||||
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
|
||||
use style::values::specified::ViewportPercentageLength::Vw;
|
||||
use style::viewport::*;
|
||||
use style_traits::viewport::*;
|
||||
|
@ -80,7 +80,7 @@ macro_rules! assert_decl_len {
|
|||
|
||||
macro_rules! viewport_length {
|
||||
($value:expr, px) => {
|
||||
ViewportLength::Specified(LengthOrPercentageOrAuto::Length(Length::from_px($value)))
|
||||
ViewportLength::Specified(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px($value)))
|
||||
};
|
||||
($value:expr, vw) => {
|
||||
ViewportLength::Specified(LengthOrPercentageOrAuto::Length(ViewportPercentage(Vw($value))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue