Files
ladybird/Tests/LibWeb/Layout/input/svg-foreignobject-absolute-positioning.html
Aliaksandr Kalenik b3231ea2a0 LibWeb: Make foreignObject establish a containing block for abspos
Absolutely positioned elements inside SVG foreignObject were being
positioned relative to an ancestor containing block outside the SVG,
instead of relative to the foreignObject itself. Per a W3C resolution
and the behavior of other browsers, foreignObject should establish a
containing block for absolutely and fixed positioned elements.

With this fix, the `has_abspos_with_external_containing_block` check
in `set_needs_layout_update()` and the abspos preservation loop in
`relayout_svg_root()` become dead code — remove both and simplify the
ancestor loops. Rename related tests to reflect the new behavior.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3241
2026-02-17 15:59:59 +01:00

16 lines
273 B
HTML

<!DOCTYPE html>
<style>
div {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
}
</style>
<svg width="200" height="200">
<foreignObject width="100" height="100" x="50" y="50">
<div>I am offset!</div>
</foreignObject>
</svg>