diff options
Diffstat (limited to 'components/layout/table_wrapper.rs')
-rw-r--r-- | components/layout/table_wrapper.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 9e8f137e70a..b63da7d56e5 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -33,7 +33,7 @@ use style::computed_values::{position, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::{LogicalRect, LogicalSize}; use style::properties::ComputedValues; -use style::values::computed::LengthPercentageOrAuto; +use style::values::computed::NonNegativeLengthPercentageOrAuto; use style::values::CSSFloat; #[derive(Clone, Copy, Debug, Serialize)] @@ -201,7 +201,7 @@ impl TableWrapperFlow { // says "the basic idea is the same as the shrink-to-fit width that CSS2.1 defines". So we // just use the shrink-to-fit inline size. let available_inline_size = match self.block_flow.fragment.style().content_inline_size() { - LengthPercentageOrAuto::Auto => { + NonNegativeLengthPercentageOrAuto::Auto => { self.block_flow .get_shrink_to_fit_inline_size(available_inline_size) - table_border_padding @@ -840,12 +840,8 @@ fn initial_computed_inline_size( preferred_width_of_all_columns: Au, table_border_padding: Au, ) -> MaybeAuto { - let inline_size_from_style = MaybeAuto::from_style( - block.fragment.style.content_inline_size(), - containing_block_inline_size, - ); - match inline_size_from_style { - MaybeAuto::Auto => { + match block.fragment.style.content_inline_size() { + NonNegativeLengthPercentageOrAuto::Auto => { if preferred_width_of_all_columns + table_border_padding <= containing_block_inline_size { MaybeAuto::Specified(preferred_width_of_all_columns + table_border_padding) @@ -855,10 +851,13 @@ fn initial_computed_inline_size( MaybeAuto::Auto } }, - MaybeAuto::Specified(inline_size_from_style) => MaybeAuto::Specified(max( - inline_size_from_style - table_border_padding, - minimum_width_of_all_columns, - )), + NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => { + let used = lp.to_used_value(containing_block_inline_size); + MaybeAuto::Specified(max( + used - table_border_padding, + minimum_width_of_all_columns, + )) + }, } } |