mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix size of tables in flow layout (#31455)
* Fix size of tables in flow layout The contents of a table can make it bigger than what we would expect from its 'width', 'min-width', 'height' and ' min-height' properties. Also, 'width: auto' doesn't stretch it to fill the containing block. We had to refactor the resolution of margins to happen after layout, otherwise 'auto' margins wouldn't align correctly. Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Feedback * Consistently use `containing_block_for_table` in table layout * Update test result --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
c23999941a
commit
50fdb82246
54 changed files with 289 additions and 388 deletions
|
@ -251,6 +251,18 @@ impl<'a> PlacementAmongFloats<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// After placing a table and then laying it out, it may turn out wider than what
|
||||
/// we initially expected. This method takes care of updating the data so that
|
||||
/// the next place() can find the right area for the new size.
|
||||
/// Note that if the new size is smaller, placement won't backtrack to consider
|
||||
/// areas that weren't big enough for the old size.
|
||||
pub(crate) fn set_inline_size(&mut self, inline_size: Au, pbm: &PaddingBorderMargin) {
|
||||
self.object_size.inline = inline_size;
|
||||
self.max_inline_end = (self.float_context.containing_block_info.inline_end -
|
||||
pbm.margin.inline_end.auto_is(Length::zero).into())
|
||||
.max(self.min_inline_start + inline_size);
|
||||
}
|
||||
|
||||
/// After placing an object with `height: auto` (and using the minimum inline and
|
||||
/// block size as the object size) and then laying it out, try to fit the object into
|
||||
/// the current set of bands, given block size after layout and the available inline
|
||||
|
@ -939,6 +951,7 @@ impl FloatBox {
|
|||
layout_context,
|
||||
positioning_context,
|
||||
&containing_block_for_children,
|
||||
&containing_block,
|
||||
);
|
||||
content_size = LogicalVec2 {
|
||||
inline: inline_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue