From bab1d09d92cddf69ac04b9c4a97864f9804cbbf7 Mon Sep 17 00:00:00 2001 From: Andi Gallo Date: Sun, 20 Aug 2023 08:50:28 +0000 Subject: [PATCH] LibWeb: Derive baseline from rightmost descendant Make the existing algorithm recursive, accounting for boxes which contain line boxes indirectly. Fixes some button alignment issues on Wikipedia. --- .../button-baseline-align.txt | 44 ++++++++++++++++ ...should-have-vertically-aligned-content.txt | 2 +- ...tton-with-block-content-baseline-align.txt | 50 +++++++++++++++++++ ...on-with-multiple-words-text-node-label.txt | 4 +- ...ton-with-text-node-label-and-font-size.txt | 4 +- .../button-with-text-node-label.txt | 4 +- ...text-node-invalidation-on-value-change.txt | 2 +- .../table/border-collapse-is-inherited.txt | 13 +++-- .../expected/table/inline-table-width.txt | 2 +- .../expected/table/nested-table-box-width.txt | 15 +++--- .../table/row-span-and-nested-tables.txt | 15 +++--- .../button-baseline-align.html | 23 +++++++++ ...ton-with-block-content-baseline-align.html | 25 ++++++++++ .../LibWeb/Layout/FormattingContext.cpp | 21 ++++---- 14 files changed, 188 insertions(+), 36 deletions(-) create mode 100644 Tests/LibWeb/Layout/expected/block-and-inline/button-baseline-align.txt create mode 100644 Tests/LibWeb/Layout/expected/block-and-inline/button-with-block-content-baseline-align.txt create mode 100644 Tests/LibWeb/Layout/input/block-and-inline/button-baseline-align.html create mode 100644 Tests/LibWeb/Layout/input/block-and-inline/button-with-block-content-baseline-align.html diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/button-baseline-align.txt b/Tests/LibWeb/Layout/expected/block-and-inline/button-baseline-align.txt new file mode 100644 index 0000000000..9324050bde --- /dev/null +++ b/Tests/LibWeb/Layout/expected/block-and-inline/button-baseline-align.txt @@ -0,0 +1,44 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x47.671875 children: inline + line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.828125 + frag 0 from BlockContainer start: 0, length: 0, rect: [8,8 61.1875x47.671875] + BlockContainer at (8,8) content-size 61.1875x47.671875 inline-block [BFC] children: inline + line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.828125 + frag 0 from BlockContainer start: 0, length: 0, rect: [9,26 17.828125x21.84375] + frag 1 from TextNode start: 0, length: 1, rect: [28,30 8x17.46875] + " " + frag 2 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.671875] + TextNode <#text> + BlockContainer at (9,26) content-size 17.828125x21.84375 inline-block [BFC] children: inline + line 0 width: 17.828125, height: 21.84375, bottom: 21.84375, baseline: 16.921875 + frag 0 from TextNode start: 0, length: 1, rect: [9,26 17.828125x21.84375] + "A" + TextNode <#text> + TextNode <#text> + BlockContainer