Fix Servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-05-28 16:00:00 +02:00
parent f4cff20649
commit bbb59614fa
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 16 additions and 14 deletions

View file

@ -1533,8 +1533,9 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
let style = node.style(self.style_context()); let style = node.style(self.style_context());
// Bail out if this node has an ancestor with display: none. // Bail out if this node is display: none. The style system guarantees
if style.is_in_display_none_subtree() { // that we don't arrive here for children of those.
if style.get_box().display.is_none() {
self.set_flow_construction_result(node, ConstructionResult::None); self.set_flow_construction_result(node, ConstructionResult::None);
return; return;
} }

View file

@ -22,10 +22,11 @@ use style::computed_values::background_origin::single_value::T as BackgroundOrig
use style::computed_values::border_image_outset::T as BorderImageOutset; use style::computed_values::border_image_outset::T as BorderImageOutset;
use style::properties::style_structs::{self, Background}; use style::properties::style_structs::{self, Background};
use style::values::Either; use style::values::Either;
use style::values::computed::{Angle, GradientItem}; use style::values::computed::{Angle, GradientItem, BackgroundSize as ComputedBackgroundSize};
use style::values::computed::{LengthOrNumber, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::{LengthOrNumber, LengthOrPercentage, LengthOrPercentageOrAuto};
use style::values::computed::{NumberOrPercentage, Percentage, Position}; use style::values::computed::{NumberOrPercentage, Percentage, Position};
use style::values::computed::image::{EndingShape, LineDirection}; use style::values::computed::image::{EndingShape, LineDirection};
use style::values::generics::NonNegative;
use style::values::generics::background::BackgroundSize; use style::values::generics::background::BackgroundSize;
use style::values::generics::image::{Circle, Ellipse, ShapeExtent}; use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
use style::values::generics::image::EndingShape as GenericEndingShape; use style::values::generics::image::EndingShape as GenericEndingShape;
@ -91,7 +92,7 @@ pub fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
/// For a given area and an image compute how big the /// For a given area and an image compute how big the
/// image should be displayed on the background. /// image should be displayed on the background.
fn compute_background_image_size( fn compute_background_image_size(
bg_size: BackgroundSize<LengthOrPercentageOrAuto>, bg_size: ComputedBackgroundSize,
bounds_size: Size2D<Au>, bounds_size: Size2D<Au>,
intrinsic_size: Option<Size2D<Au>>, intrinsic_size: Option<Size2D<Au>>,
) -> Size2D<Au> { ) -> Size2D<Au> {
@ -99,9 +100,9 @@ fn compute_background_image_size(
None => match bg_size { None => match bg_size {
BackgroundSize::Cover | BackgroundSize::Contain => bounds_size, BackgroundSize::Cover | BackgroundSize::Contain => bounds_size,
BackgroundSize::Explicit { width, height } => Size2D::new( 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), .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), .specified_or_default(bounds_size.height),
), ),
}, },
@ -123,29 +124,29 @@ fn compute_background_image_size(
( (
BackgroundSize::Explicit { BackgroundSize::Explicit {
width, 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); .specified_or_default(own_size.width);
Size2D::new(width, width.scale_by(image_aspect_ratio.recip())) Size2D::new(width, width.scale_by(image_aspect_ratio.recip()))
}, },
( (
BackgroundSize::Explicit { BackgroundSize::Explicit {
width: LengthOrPercentageOrAuto::Auto, width: NonNegative(LengthOrPercentageOrAuto::Auto),
height, 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); .specified_or_default(own_size.height);
Size2D::new(height.scale_by(image_aspect_ratio), height) Size2D::new(height.scale_by(image_aspect_ratio), height)
}, },
(BackgroundSize::Explicit { width, height }, _) => Size2D::new( (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), .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), .specified_or_default(own_size.height),
), ),
} }

View file

@ -916,9 +916,9 @@ impl FragmentDisplayListBuilding for Fragment {
get_cyclic(&style.get_background().background_size.0, i).clone(); get_cyclic(&style.get_background().background_size.0, i).clone();
let size = match background_size { let size = match background_size {
BackgroundSize::Explicit { width, height } => Size2D::new( 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), .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), .specified_or_default(bounding_box_size.height),
), ),
_ => bounding_box_size, _ => bounding_box_size,