From bbb59614fa528da3bd484cc2c834f6be2e8e9fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 28 May 2018 16:00:00 +0200 Subject: [PATCH] Fix Servo build. --- components/layout/construct.rs | 5 +++-- components/layout/display_list/background.rs | 21 ++++++++++---------- components/layout/display_list/builder.rs | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 0adde8d7255..efa3ccd176a 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1533,8 +1533,9 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal(arr: &[T], index: usize) -> &T { /// For a given area and an image compute how big the /// image should be displayed on the background. fn compute_background_image_size( - bg_size: BackgroundSize, + bg_size: ComputedBackgroundSize, bounds_size: Size2D, intrinsic_size: Option>, ) -> Size2D { @@ -99,9 +100,9 @@ fn compute_background_image_size( None => match bg_size { BackgroundSize::Cover | BackgroundSize::Contain => bounds_size, BackgroundSize::Explicit { width, height } => Size2D::new( - MaybeAuto::from_style(width, bounds_size.width) + MaybeAuto::from_style(width.0, bounds_size.width) .specified_or_default(bounds_size.width), - MaybeAuto::from_style(height, bounds_size.height) + MaybeAuto::from_style(height.0, bounds_size.height) .specified_or_default(bounds_size.height), ), }, @@ -123,29 +124,29 @@ fn compute_background_image_size( ( BackgroundSize::Explicit { width, - height: LengthOrPercentageOrAuto::Auto, + height: NonNegative(LengthOrPercentageOrAuto::Auto), }, _, ) => { - let width = MaybeAuto::from_style(width, bounds_size.width) + let width = MaybeAuto::from_style(width.0, bounds_size.width) .specified_or_default(own_size.width); Size2D::new(width, width.scale_by(image_aspect_ratio.recip())) }, ( BackgroundSize::Explicit { - width: LengthOrPercentageOrAuto::Auto, + width: NonNegative(LengthOrPercentageOrAuto::Auto), height, }, _, ) => { - let height = MaybeAuto::from_style(height, bounds_size.height) + let height = MaybeAuto::from_style(height.0, bounds_size.height) .specified_or_default(own_size.height); Size2D::new(height.scale_by(image_aspect_ratio), height) }, (BackgroundSize::Explicit { width, height }, _) => Size2D::new( - MaybeAuto::from_style(width, bounds_size.width) + MaybeAuto::from_style(width.0, bounds_size.width) .specified_or_default(own_size.width), - MaybeAuto::from_style(height, bounds_size.height) + MaybeAuto::from_style(height.0, bounds_size.height) .specified_or_default(own_size.height), ), } diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index b4f8d68282b..a3a40a98cc0 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -916,9 +916,9 @@ impl FragmentDisplayListBuilding for Fragment { get_cyclic(&style.get_background().background_size.0, i).clone(); let size = match background_size { BackgroundSize::Explicit { width, height } => Size2D::new( - MaybeAuto::from_style(width, bounding_box_size.width) + MaybeAuto::from_style(width.0, bounding_box_size.width) .specified_or_default(bounding_box_size.width), - MaybeAuto::from_style(height, bounding_box_size.height) + MaybeAuto::from_style(height.0, bounding_box_size.height) .specified_or_default(bounding_box_size.height), ), _ => bounding_box_size,