diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-12-15 22:12:10 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-12-16 14:23:56 +0100 |
commit | 7d30a7da750141bb0ca20b236271b41167ee225b (patch) | |
tree | 3b41496c0c91a2659123134f3d5e146bcbe3a773 /components/layout/fragment.rs | |
parent | c1c2b746c829a9d2266a181e35170300680e6636 (diff) | |
download | servo-7d30a7da750141bb0ca20b236271b41167ee225b.tar.gz servo-7d30a7da750141bb0ca20b236271b41167ee225b.zip |
Servo build fixes.
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r-- | components/layout/fragment.rs | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index f663dad744d..3eadf0a0ac8 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -61,10 +61,9 @@ use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::str::char_is_whitespace; use style::values::computed::counters::ContentItem; -use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size, VerticalAlign}; +use style::values::computed::{Size, VerticalAlign}; use style::values::generics::box_::{Perspective, VerticalAlignKeyword}; use style::values::generics::transform; -use style::Zero; use webrender_api; use webrender_api::units::LayoutTransform; @@ -1329,13 +1328,17 @@ impl Fragment { return; }, _ => { - let margin = self.style().logical_margin(); - self.margin.inline_start = - MaybeAuto::from_style(margin.inline_start, containing_block_inline_size) - .specified_or_zero(); - self.margin.inline_end = - MaybeAuto::from_style(margin.inline_end, containing_block_inline_size) - .specified_or_zero(); + let (inline_start, inline_end) = { + let margin = self.style().logical_margin(); + ( + MaybeAuto::from_style(margin.inline_start, containing_block_inline_size) + .specified_or_zero(), + MaybeAuto::from_style(margin.inline_end, containing_block_inline_size) + .specified_or_zero(), + ) + }; + self.margin.inline_start = inline_start; + self.margin.inline_end = inline_end; }, } @@ -1384,13 +1387,17 @@ impl Fragment { _ => { // NB: Percentages are relative to containing block inline-size (not block-size) // per CSS 2.1. - let margin = self.style().logical_margin(); - self.margin.block_start = - MaybeAuto::from_style(margin.block_start, containing_block_inline_size) - .specified_or_zero(); - self.margin.block_end = - MaybeAuto::from_style(margin.block_end, containing_block_inline_size) - .specified_or_zero(); + let (block_start, block_end) = { + let margin = self.style().logical_margin(); + ( + MaybeAuto::from_style(margin.block_start, containing_block_inline_size) + .specified_or_zero(), + MaybeAuto::from_style(margin.block_end, containing_block_inline_size) + .specified_or_zero(), + ) + }; + self.margin.block_start = block_start; + self.margin.block_end = block_end; }, } } @@ -1458,14 +1465,14 @@ impl Fragment { pub fn relative_position(&self, containing_block_size: &LogicalSize<Au>) -> LogicalSize<Au> { fn from_style(style: &ComputedValues, container_size: &LogicalSize<Au>) -> LogicalSize<Au> { let offsets = style.logical_position(); - let offset_i = if offsets.inline_start != LengthPercentageOrAuto::Auto { + let offset_i = if !offsets.inline_start.is_auto() { MaybeAuto::from_style(offsets.inline_start, container_size.inline) .specified_or_zero() } else { -MaybeAuto::from_style(offsets.inline_end, container_size.inline) .specified_or_zero() }; - let offset_b = if offsets.block_start != LengthPercentageOrAuto::Auto { + let offset_b = if !offsets.block_start.is_auto() { MaybeAuto::from_style(offsets.block_start, container_size.block).specified_or_zero() } else { -MaybeAuto::from_style(offsets.block_end, container_size.block).specified_or_zero() @@ -2520,14 +2527,10 @@ impl Fragment { { continue; } - if inline_context_node.style.logical_margin().inline_end != - LengthPercentageOrAuto::zero() - { + if !inline_context_node.style.logical_margin().inline_end.is_definitely_zero() { return false; } - if inline_context_node.style.logical_padding().inline_end != - LengthPercentage::zero() - { + if !inline_context_node.style.logical_padding().inline_end.is_definitely_zero() { return false; } if inline_context_node.style.logical_border_width().inline_end != Au(0) { @@ -2546,14 +2549,10 @@ impl Fragment { { continue; } - if inline_context_node.style.logical_margin().inline_start != - LengthPercentageOrAuto::zero() - { + if !inline_context_node.style.logical_margin().inline_start.is_definitely_zero() { return false; } - if inline_context_node.style.logical_padding().inline_start != - LengthPercentage::zero() - { + if !inline_context_node.style.logical_padding().inline_start.is_definitely_zero() { return false; } if inline_context_node @@ -3193,7 +3192,7 @@ impl Fragment { ) -> Option<LayoutTransform> { match self.style().get_box().perspective { Perspective::Length(length) => { - let perspective_origin = self.style().get_box().perspective_origin; + let perspective_origin = &self.style().get_box().perspective_origin; let perspective_origin = Point2D::new( perspective_origin .horizontal |