mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Don't update row baseline if cell is empty (#31831)
Gecko, Blink and WebKit agree that the if a row only has empty cells, its baseline should be at the bottom, not at the top. There isn't interoperability when the cells are just empty-ish, so this patch takes the simplest approach, aligning with Blink: any out-of-flow or in-flow content other than collapsed whitespace counts as not empty.
This commit is contained in:
parent
c50df5ccbe
commit
dbe3cb8a3c
7 changed files with 47 additions and 7 deletions
|
@ -54,6 +54,12 @@ impl CellLayout {
|
|||
fn outer_block_size(&self) -> Au {
|
||||
self.layout.content_block_size + (self.border.block_sum() + self.padding.block_sum()).into()
|
||||
}
|
||||
|
||||
/// Whether the cell has no in-flow or out-of-flow contents, other than collapsed whitespace.
|
||||
/// Note this logic differs from 'empty-cells', which counts abspos contents as empty.
|
||||
fn is_empty(&self) -> bool {
|
||||
self.layout.fragments.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
/// Information stored during the layout of rows.
|
||||
|
@ -1560,7 +1566,7 @@ impl<'a> TableLayout<'a> {
|
|||
|
||||
let row_block_offset = row_rect.start_corner.block;
|
||||
let row_baseline = self.row_baselines[row_index];
|
||||
if cell.effective_vertical_align() == VerticalAlignKeyword::Baseline {
|
||||
if cell.effective_vertical_align() == VerticalAlignKeyword::Baseline && !layout.is_empty() {
|
||||
let baseline = row_block_offset + row_baseline;
|
||||
if row_index == 0 {
|
||||
baselines.first = Some(baseline);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue