diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs index c4598d3177021..2cc7ae434bfa1 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout_2020/geom.rs @@ -733,22 +733,6 @@ impl From for Size { } impl LogicalVec2> { - pub(crate) fn percentages_relative_to( - &self, - containing_block: &ContainingBlock, - ) -> LogicalVec2> { - self.map_inline_and_block_axes( - |inline_size| inline_size.map(|lp| lp.to_used_value(containing_block.size.inline)), - |block_size| { - block_size - .maybe_map(|lp| { - lp.maybe_to_used_value(containing_block.size.block.to_definite()) - }) - .unwrap_or_default() - }, - ) - } - pub(crate) fn maybe_percentages_relative_to_basis( &self, basis: &LogicalVec2>, diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index 2adfc4cb55032..0a73be72acdd0 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -232,31 +232,11 @@ pub(crate) trait ComputedValuesExt { &self, containing_block_writing_mode: WritingMode, ) -> LogicalVec2>; - fn content_box_size( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2>; - fn content_box_size_deprecated( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2; fn content_box_size_for_box_size( &self, box_size: LogicalVec2>, pbm: &PaddingBorderMargin, ) -> LogicalVec2>; - fn content_min_box_size( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2>; - fn content_min_box_size_deprecated( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2; fn content_min_box_size_for_min_size( &self, box_size: LogicalVec2>, @@ -385,26 +365,6 @@ impl ComputedValuesExt for ComputedValues { ) } - fn content_box_size( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2> { - let box_size = self - .box_size(containing_block.style.writing_mode) - .percentages_relative_to(containing_block); - self.content_box_size_for_box_size(box_size, pbm) - } - - fn content_box_size_deprecated( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2 { - self.content_box_size(containing_block, pbm) - .map(Size::to_auto_or) - } - fn content_box_size_for_box_size( &self, box_size: LogicalVec2>, @@ -421,32 +381,6 @@ impl ComputedValuesExt for ComputedValues { } } - fn content_min_box_size( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2> { - let min_size = self - .min_box_size(containing_block.style.writing_mode) - .map_inline_and_block_sizes( - |lp| lp.to_used_value(containing_block.size.inline), - |lp| { - let cbbs = containing_block.size.block.to_definite(); - lp.to_used_value(cbbs.unwrap_or_else(Au::zero)) - }, - ); - self.content_min_box_size_for_min_size(min_size, pbm) - } - - fn content_min_box_size_deprecated( - &self, - containing_block: &ContainingBlock, - pbm: &PaddingBorderMargin, - ) -> LogicalVec2 { - self.content_min_box_size(containing_block, pbm) - .map(Size::to_auto_or) - } - fn content_min_box_size_for_min_size( &self, min_box_size: LogicalVec2>, diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index 84c543b477573..5551dbbdd5479 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -21,7 +21,6 @@ use style::values::computed::{ BorderStyle, LengthPercentage as ComputedLengthPercentage, Percentage, }; use style::values::generics::box_::{GenericVerticalAlign as VerticalAlign, VerticalAlignKeyword}; -use style::values::generics::length::GenericLengthPercentageOrAuto::{Auto, LengthPercentage}; use style::Zero; use super::{Table, TableCaption, TableSlot, TableSlotCell, TableTrack, TableTrackGroup}; @@ -1530,24 +1529,17 @@ impl<'a> TableLayout<'a> { &mut self, mut row_sizes: Vec, containing_block_for_children: &ContainingBlock, - containing_block_for_table: &ContainingBlock, ) { // The table content height is the maximum of the computed table height from style and the // sum of computed row heights from row layout plus size from borders and spacing. - // When block-size doesn't compute to auto, `containing_block_for children` will have - // the resulting length, properly clamped between min-block-size and max-block-size. - let style = &self.table.style; - let table_height_from_style = match style - .content_box_size_deprecated(containing_block_for_table, &self.pbm) - .block - { - LengthPercentage(_) => containing_block_for_children.size.block.to_auto_or(), - Auto => style - .content_min_box_size_deprecated(containing_block_for_table, &self.pbm) - .block - .map(Au::from), - } - .auto_is(Au::zero); + // TODO: for `height: stretch`, the block size of the containing block is the available + // space for the entire table wrapper, but here we are using that amount for the table grid. + // Therefore, if there is a caption, this will cause overflow. Gecko and WebKit have the + // same problem, but not Blink. + let table_height_from_style = match containing_block_for_children.size.block { + SizeConstraint::Definite(size) => size, + SizeConstraint::MinMax(min, _) => min, + }; let block_border_spacing = self.table.total_border_spacing().block; let table_height_from_rows = row_sizes.iter().sum::() + block_border_spacing; @@ -1736,7 +1728,6 @@ impl<'a> TableLayout<'a> { positioning_context, &containing_block_for_logical_conversion, containing_block_for_children, - containing_block_for_table, ); // Take the baseline of the grid fragment, after adjusting it to be in the coordinate system @@ -1833,7 +1824,6 @@ impl<'a> TableLayout<'a> { positioning_context: &mut PositioningContext, containing_block_for_logical_conversion: &ContainingBlock, containing_block_for_children: &ContainingBlock, - containing_block_for_table: &ContainingBlock, ) -> BoxFragment { self.distributed_column_widths = self.distribute_width_to_columns(); self.layout_cells_in_row( @@ -1846,7 +1836,6 @@ impl<'a> TableLayout<'a> { self.compute_table_height_and_final_row_heights( first_layout_row_heights, containing_block_for_children, - containing_block_for_table, ); assert_eq!(self.table.size.height, self.row_sizes.len());