LibWeb: Use caption content width for inline layout in table captions

Previously, `run_caption_layout()` passed the table's border-box width
as the available space to the caption's formatting context. The BFC then
used this width directly for inline line breaking, causing text to
overflow the caption's content box by the size of the caption's own
border and padding.
This commit is contained in:
Tim Ledbetter
2026-04-05 20:05:47 +01:00
committed by Sam Atkins
parent 6f3833e857
commit d8825c89af
Notes: github-actions[bot] 2026-04-22 14:36:15 +00:00
5 changed files with 83 additions and 22 deletions

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
@font-face {
font-family: 'Ahem';
src: url('../../../Ref/data/fonts/Ahem.ttf');
}
table {
border: 1px solid black;
font: 10px/1 Ahem;
}
caption {
padding: 0 6px;
border: 1px solid gray;
}
</style>
<table>
<!-- The text should not overflow the table border -->
<caption>AAAAAAAAAA BBBBBBBBB CCCC</caption>
<tr><td style="width: 200px">x</td></tr>
</table>