LibWeb: Avoid infinite loop in HTMLElement.scrollParent

We were failing to actually climb up the containing block chain,
causing this API to infinite loop for anything but the most
trivial cases.

By fixing the loop structure, we also make a bunch of the already
imported WPT tests pass. :^)
This commit is contained in:
Andreas Kling
2025-06-30 15:11:44 +02:00
committed by Tim Ledbetter
parent 8d1c860fcd
commit b3d9e39bad
Notes: github-actions[bot] 2025-06-30 19:39:31 +00:00
6 changed files with 33 additions and 15 deletions

View File

@@ -2,8 +2,9 @@ Harness status: OK
Found 4 tests
4 Fail
Fail scrollParent skips intermediate closed shadow tree nodes
3 Pass
1 Fail
Pass scrollParent skips intermediate closed shadow tree nodes
Fail scrollParent skips intermediate open shadow tree nodes
Fail scrollParent from inside closed shadow tree
Fail scrollParent from inside open shadow tree
Pass scrollParent from inside closed shadow tree
Pass scrollParent from inside open shadow tree

View File

@@ -2,14 +2,14 @@ Harness status: OK
Found 9 tests
3 Pass
6 Fail
Fail scrollParent returns the nearest scroll container.
Fail hidden element is a scroll container.
7 Pass
2 Fail
Pass scrollParent returns the nearest scroll container.
Pass hidden element is a scroll container.
Pass Element with no box has null scrollParent.
Fail scrollParent follows absolute positioned containing block chain.
Pass scrollParent follows absolute positioned containing block chain.
Fail scrollParent follows fixed positioned containing block chain.
Pass scrollParent of element fixed to root is null.
Fail scrollParent of child in root viewport returns document scrolling element.
Fail scrollParent of fixed element contained within root is document scrolling element.
Fail scrollParent of element fixed to root is null.
Pass scrollParent of child in root viewport returns document scrolling element.
Pass scrollParent of fixed element contained within root is document scrolling element.
Pass scrollParent of body is null.