mirror of
https://github.com/servo/servo.git
synced 2025-08-14 18:05:36 +01:00
Auto merge of #17036 - servo:derive-all-the-things, r=emilio
Use values::generics::rect::Rect some more <!-- 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/17036) <!-- Reviewable:end -->
This commit is contained in:
commit
7275f65981
18 changed files with 253 additions and 410 deletions
|
@ -13,7 +13,10 @@ macro_rules! assert_roundtrip_basicshape {
|
|||
($fun:expr, $input:expr, $output:expr) => {
|
||||
assert_roundtrip_with_context!($fun, $input, $output);
|
||||
assert_roundtrip_with_context!(BasicShape::parse, $input, $output);
|
||||
}
|
||||
};
|
||||
($fun:expr, $input:expr) => {
|
||||
assert_roundtrip_basicshape!($fun, $input, $input);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! assert_border_radius_values {
|
||||
|
@ -35,20 +38,12 @@ macro_rules! assert_border_radius_values {
|
|||
|
||||
#[test]
|
||||
fn test_inset() {
|
||||
// these are actually wrong, we should be serializing to the minimum possible result
|
||||
// the advantage of being wrong is that the roundtrip test actually suffices
|
||||
// for testing the intermediate state
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px)", "inset(10px 10px 10px 10px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px 20%)", "inset(10px 20% 10px 20%)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px 20%)");
|
||||
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px round 10px)",
|
||||
"inset(10px 10px 10px 10px round 10px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px round 10px 20px 30px 40px)",
|
||||
"inset(10px 10px 10px 10px round 10px 20px 30px 40px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px 10px 10px 10px round 10px 20px 30px 40px \
|
||||
/ 1px 2px 3px 4px)",
|
||||
"inset(10px 10px 10px 10px round 10px 20px 30px 40px \
|
||||
/ 1px 2px 3px 4px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px round 10px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px round 10px 20px 30px 40px)");
|
||||
assert_roundtrip_basicshape!(InsetRect::parse, "inset(10px round 10px 20px 30px 40px / 1px 2px 3px 4px)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -806,6 +806,7 @@ mod shorthand_serialization {
|
|||
use style::properties::longhands::mask_repeat as repeat;
|
||||
use style::properties::longhands::mask_size as size;
|
||||
use style::values::Either;
|
||||
use style::values::generics::background::BackgroundSize;
|
||||
use style::values::generics::image::Image;
|
||||
use super::*;
|
||||
|
||||
|
@ -852,13 +853,12 @@ mod shorthand_serialization {
|
|||
)
|
||||
);
|
||||
|
||||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
let size = single_vec_variant_value!(
|
||||
size,
|
||||
BackgroundSize::Explicit {
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32)),
|
||||
}
|
||||
);
|
||||
|
||||
let repeat = single_vec_keyword_value!(repeat, RepeatX);
|
||||
|
@ -903,13 +903,12 @@ mod shorthand_serialization {
|
|||
PositionComponent::Length(LengthOrPercentage::Length(NoCalcLength::from_px(4f32)))
|
||||
);
|
||||
|
||||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
let size = single_vec_variant_value!(
|
||||
size,
|
||||
BackgroundSize::Explicit {
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32)),
|
||||
}
|
||||
);
|
||||
|
||||
let repeat = single_vec_keyword_value!(repeat, RepeatX);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue