diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-04-22 16:04:47 -0700 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2015-04-27 17:12:08 +0200 |
commit | 4d46d257cdb2ee42353c915934b338b5f2be4f65 (patch) | |
tree | 3d625c97677cd671122cca10b62297dc1ab4c9ff /components/layout | |
parent | 48299a53cbe39d1a8a9bd4547a678d1d1cc345ae (diff) | |
download | servo-4d46d257cdb2ee42353c915934b338b5f2be4f65.tar.gz servo-4d46d257cdb2ee42353c915934b338b5f2be4f65.zip |
Address review comments
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/block.rs | 3 | ||||
-rw-r--r-- | components/layout/inline.rs | 7 | ||||
-rw-r--r-- | components/layout/table_row.rs | 61 |
3 files changed, 34 insertions, 37 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index 15d6e2e1684..3879c627d88 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1589,7 +1589,8 @@ impl Flow for BlockFlow { // Our inline-size was set to the inline-size of the containing block by the flow's parent. // Now compute the real value. - self.propagate_and_compute_used_inline_size(layout_context, border_collapse::T::separate); + let border_collapse = self.fragment.style.get_inheritedtable().border_collapse; + self.propagate_and_compute_used_inline_size(layout_context, border_collapse); // Formatting contexts are never impacted by floats. match self.formatting_context_type() { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index e4a91bec006..d755678d7ed 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -28,8 +28,8 @@ use std::num::ToPrimitive; use std::ops::{Add, Sub, Mul, Div, Rem, Neg, Shl, Shr, Not, BitOr, BitAnd, BitXor}; use std::sync::Arc; use std::u16; -use style::computed_values::{border_collapse, display, overflow_x, text_align, text_justify}; -use style::computed_values::{text_overflow, vertical_align, white_space}; +use style::computed_values::{display, overflow_x, text_align, text_justify, text_overflow}; +use style::computed_values::{vertical_align, white_space}; use style::properties::ComputedValues; use util::geometry::{Au, MAX_AU, ZERO_RECT}; use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; @@ -1197,7 +1197,8 @@ impl Flow for InlineFlow { { let this = &mut *self; for fragment in this.fragments.fragments.iter_mut() { - fragment.compute_border_and_padding(inline_size, border_collapse::T::separate); + let border_collapse = fragment.style.get_inheritedtable().border_collapse; + fragment.compute_border_and_padding(inline_size, border_collapse); fragment.compute_block_direction_margins(inline_size); fragment.compute_inline_direction_margins(inline_size); fragment.assign_replaced_inline_size_if_necessary(inline_size); diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 36afbabcd0c..5b6e1909a26 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -30,7 +30,7 @@ use style::computed_values::{border_collapse, border_spacing, border_top_style}; use style::properties::ComputedValues; use style::values::computed::LengthOrPercentageOrAuto; use util::geometry::Au; -use util::logical_geometry::{LogicalRect, WritingMode}; +use util::logical_geometry::{LogicalRect, PhysicalSide, WritingMode}; /// A single row of a table. pub struct TableRowFlow { @@ -593,58 +593,53 @@ impl CollapsedBorder { } } + /// Creates a collapsed border style from the given physical side. + fn from_side(side: PhysicalSide, + css_style: &ComputedValues, + provenance: CollapsedBorderProvenance) + -> CollapsedBorder { + match side { + PhysicalSide::Top => CollapsedBorder::top(css_style, provenance), + PhysicalSide::Right => CollapsedBorder::right(css_style, provenance), + PhysicalSide::Bottom => CollapsedBorder::bottom(css_style, provenance), + PhysicalSide::Left => CollapsedBorder::left(css_style, provenance), + } + } + /// Creates a collapsed border style from the inline-start border described in the given CSS /// style object. pub fn inline_start(css_style: &ComputedValues, provenance: CollapsedBorderProvenance) -> CollapsedBorder { - let writing_mode = css_style.writing_mode; - match (writing_mode.is_vertical(), - writing_mode.is_inline_tb(), - writing_mode.is_bidi_ltr()) { - (false, _, true) => CollapsedBorder::left(css_style, provenance), - (false, _, false) => CollapsedBorder::right(css_style, provenance), - (true, true, _) => CollapsedBorder::top(css_style, provenance), - (true, false, _) => CollapsedBorder::bottom(css_style, provenance), - } + CollapsedBorder::from_side(css_style.writing_mode.inline_start_physical_side(), + css_style, + provenance) } /// Creates a collapsed border style from the inline-start border described in the given CSS /// style object. pub fn inline_end(css_style: &ComputedValues, provenance: CollapsedBorderProvenance) -> CollapsedBorder { - let writing_mode = css_style.writing_mode; - match (writing_mode.is_vertical(), - writing_mode.is_inline_tb(), - writing_mode.is_bidi_ltr()) { - (false, _, true) => CollapsedBorder::right(css_style, provenance), - (false, _, false) => CollapsedBorder::left(css_style, provenance), - (true, true, _) => CollapsedBorder::bottom(css_style, provenance), - (true, false, _) => CollapsedBorder::top(css_style, provenance), - } + CollapsedBorder::from_side(css_style.writing_mode.inline_end_physical_side(), + css_style, + provenance) } /// Creates a collapsed border style from the block-start border described in the given CSS /// style object. pub fn block_start(css_style: &ComputedValues, provenance: CollapsedBorderProvenance) -> CollapsedBorder { - let writing_mode = css_style.writing_mode; - match (writing_mode.is_vertical(), writing_mode.is_vertical_lr()) { - (false, _) => CollapsedBorder::top(css_style, provenance), - (true, true) => CollapsedBorder::left(css_style, provenance), - (true, false) => CollapsedBorder::right(css_style, provenance), - } + CollapsedBorder::from_side(css_style.writing_mode.block_start_physical_side(), + css_style, + provenance) } /// Creates a collapsed border style from the block-end border described in the given CSS style /// object. pub fn block_end(css_style: &ComputedValues, provenance: CollapsedBorderProvenance) -> CollapsedBorder { - let writing_mode = css_style.writing_mode; - match (writing_mode.is_vertical(), writing_mode.is_vertical_lr()) { - (false, _) => CollapsedBorder::bottom(css_style, provenance), - (true, true) => CollapsedBorder::right(css_style, provenance), - (true, false) => CollapsedBorder::left(css_style, provenance), - } + CollapsedBorder::from_side(css_style.writing_mode.block_end_physical_side(), + css_style, + provenance) } /// If `other` has a higher priority per CSS 2.1 § 17.6.2.1, replaces `self` with it. @@ -659,8 +654,8 @@ impl CollapsedBorder { // Step 3. _ if self.width > other.width => {} _ if self.width < other.width => *self = *other, - (this_style, other_style) if (this_style as i8) > other_style as i8 => {} - (this_style, other_style) if (this_style as i8) < other_style as i8 => *self = *other, + (this_style, other_style) if this_style > other_style => {} + (this_style, other_style) if this_style < other_style => *self = *other, // Step 4. _ if (self.provenance as i8) >= other.provenance as i8 => {} _ => *self = *other, |