ladybird/Tests/LibWeb/Layout/input/block-and-inline/inline-block-leading-and-trailing-metrics.html
Jelle Raaijmakers 30efcd0d00
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
LibWeb: Prevent time-traveling leading inline metrics
In `InlineLevelIterator`, whenever we call `skip_to_next()` and enter a
node with box model metrics, we could potentially accumulate leading and
trailing metrics. This lead to a weird situation where an element with
`display: inline-block` could adopt the leading metrics of an inline
element that follows it, since we perform the call to
`add_extra_box_model_metrics_to_item()` too late.

Move `skip_to_next()` down so it no longer interferes with the `Item`
we're creating.

The test expectation for
`atomic-inline-with-percentage-vertical-align.html` is updated, although
neither the old nor new results are 100% accurate since either box jumps
one pixel to the right.
2025-06-20 19:59:32 +02:00

28 lines
493 B
HTML

<!DOCTYPE html>
<style>
div {
border: 1px solid red;
}
#a i {
display: inline-block;
}
#a b {
padding-left: 20px;
}
#b i {
padding-right: 20px;
}
#b b {
display: inline-block;
}
#c b {
padding-left: 20px;
padding-right: 20px;
}
#c u {
display: inline-block;
}
</style>
<div id="a"><i>inline-block</i><b>inline</b><u>inline</u></div>
<div id="b"><i>inline</i><b>inline-block</b><u>inline</u></div>
<div id="c"><i>inline</i><b>inline</b><u>inline-block</u></div>