mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
layout: Align table-cell contents safely (#39491)
As resolved in https://github.com/w3c/csswg-drafts/issues/12220, when resolving `align-content: normal` on a table cell, we will now use safe alignment. The difference only matters when the contents of the cell are taller than the cell, which doesn't typically happen. But in Servo it's observable when there are collapsed rows. Testing: Adding new tests. Some fail because we don't support `align-content` yet. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
92dd54b1ec
commit
858208bd25
9 changed files with 260 additions and 4 deletions
|
@ -2819,12 +2819,11 @@ impl TableSlotCell {
|
|||
|
||||
let cell_content_rect = cell_rect.deflate(&(layout.padding + layout.border));
|
||||
let content_block_size = layout.layout.content_block_size;
|
||||
let free_space = || Au::zero().max(cell_content_rect.size.block - content_block_size);
|
||||
let vertical_align_offset = match self.effective_vertical_align() {
|
||||
VerticalAlignKeyword::Top => Au::zero(),
|
||||
VerticalAlignKeyword::Bottom => cell_content_rect.size.block - content_block_size,
|
||||
VerticalAlignKeyword::Middle => {
|
||||
(cell_content_rect.size.block - content_block_size).scale_by(0.5)
|
||||
},
|
||||
VerticalAlignKeyword::Bottom => free_space(),
|
||||
VerticalAlignKeyword::Middle => free_space().scale_by(0.5),
|
||||
_ => {
|
||||
cell_baseline -
|
||||
(layout.padding.block_start + layout.border.block_start) -
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue