LibWeb: Honor box-sizing for block-level replaced element widths

Before this change, we were always behaving as if box-sizing were
content-box for block-level replaced element widths.

This fixes the squishy logo on https://videolan.org/
This commit is contained in:
Andreas Kling 2025-07-13 16:38:33 +02:00 committed by Jelle Raaijmakers
commit 11fa5fdd47
Notes: github-actions[bot] 2025-07-14 09:17:25 +00:00
3 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,15 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x416 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 400x400 floating [BFC] children: not-inline
ImageBox <img> at (58,8) content-size 300x400 children: not-inline
BlockContainer <(anonymous)> at (8,408) content-size 400x0 children: inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x416]
PaintableWithLines (BlockContainer<BODY>) [8,8 400x400]
ImagePaintable (ImageBox<IMG>) [8,8 400x400]
PaintableWithLines (BlockContainer(anonymous)) [8,408 400x0]
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x416] [children: 0] (z-index: auto)

View file

@ -0,0 +1,14 @@
<!doctype html><style>
* { outline: 1px solid black; }
body {
float: left;
}
img {
display: block;
padding-left: 50px;
padding-right: 50px;
width: 400px;
height: 400px;
box-sizing: border-box;
}
</style><body><img src="../400.png" />