aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/construct.rs5
-rw-r--r--components/layout/display_list/background.rs21
-rw-r--r--components/layout/display_list/builder.rs4
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<ConcreteThreadS
let style = node.style(self.style_context());
- // Bail out if this node has an ancestor with display: none.
- if style.is_in_display_none_subtree() {
+ // Bail out if this node is display: none. The style system guarantees
+ // 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);
return;
}
diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs
index 566752a5499..145c069cb85 100644
--- a/components/layout/display_list/background.rs
+++ b/components/layout/display_list/background.rs
@@ -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::properties::style_structs::{self, Background};
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::{NumberOrPercentage, Percentage, Position};
use style::values::computed::image::{EndingShape, LineDirection};
+use style::values::generics::NonNegative;
use style::values::generics::background::BackgroundSize;
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
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
/// image should be displayed on the background.
fn compute_background_image_size(
- bg_size: BackgroundSize<LengthOrPercentageOrAuto>,
+ bg_size: ComputedBackgroundSize,
bounds_size: Size2D<Au>,
intrinsic_size: Option<Size2D<Au>>,
) -> Size2D<Au> {
@@ -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,