script/layout: Implement HTMLElement.scrollParent (#39110)

This new API allows getting the element which establishes an element's
scroll container. This will be used to properly implement
`scrollIntoView`. There is still work to do for this API and
`offsetParent` to properly handle ancestors which are
closed-shadow-hidden from the original query element.

In addition, fix an issue where inline boxes were establishing scrolling
containers (they shouldn't do that).

Testing: There are tests for this change.
Fixes: #39096.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-09-03 11:52:15 -07:00 committed by GitHub
parent 5c7ea4bdee
commit 2c7866eb24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 173 additions and 49 deletions

View file

@ -574,12 +574,3 @@
[Document interface: calling caretPositionFromPoint(double, double, optional CaretPositionFromPointOptions) on document with too few arguments must throw TypeError]
expected: FAIL
[HTMLElement interface: attribute scrollParent]
expected: FAIL
[HTMLElement interface: document.createElement("div") must inherit property "scrollParent" with the proper type]
expected: FAIL
[HTMLElement interface: document.createElement("img") must inherit property "scrollParent" with the proper type]
expected: FAIL

View file

@ -4,9 +4,3 @@
[scrollParent skips intermediate open shadow tree nodes]
expected: FAIL
[scrollParent from inside closed shadow tree]
expected: FAIL
[scrollParent from inside open shadow tree]
expected: FAIL

View file

@ -1,27 +0,0 @@
[scrollParent.html]
[scrollParent returns the nearest scroll container.]
expected: FAIL
[hidden element is a scroll container.]
expected: FAIL
[Element with no box has null scrollParent.]
expected: FAIL
[scrollParent follows absolute positioned containing block chain.]
expected: FAIL
[scrollParent follows fixed positioned containing block chain.]
expected: FAIL
[scrollParent of element fixed to root is null.]
expected: FAIL
[scrollParent of child in root viewport returns document scrolling element.]
expected: FAIL
[scrollParent of fixed element contained within root is document scrolling element.]
expected: FAIL
[scrollParent of body is null.]
expected: FAIL