mirror of
https://github.com/servo/servo.git
synced 2025-09-19 19:30:10 +01:00
script: Use HTMLElement.scrollParent
to implement Element.scrollIntoView
(#39144)
To find scrolling ancestors, we need to walk up the flat tree and only consider the elements that are in the chain of containing block ancestors of an element. `scrollParent` now does this so we can use it to properly implement `scrollIntoView`. Testing: There are WPT tests for this change. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
286bbe6cb1
commit
9f4f598f44
9 changed files with 141 additions and 71 deletions
13
tests/wpt/meta/MANIFEST.json
vendored
13
tests/wpt/meta/MANIFEST.json
vendored
|
@ -334450,6 +334450,19 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"scrollIntoView-should-treat-slot-as-scroll-container.html": [
|
||||
"a5211cc1095b82101a22300bcf4d1d233ccdf41a",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"scrollTo-zoom.html": [
|
||||
"49ec49325034f9d2e10cf9b5f52add24bbcc57f6",
|
||||
[
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
[scrollIntoView-fixed.html]
|
||||
[[Box A\] scrollIntoView from unscrollable position:fixed]
|
||||
expected: FAIL
|
||||
|
||||
[[Box B\] scrollIntoView from unscrollable position:fixed in iframe]
|
||||
expected: FAIL
|
||||
|
||||
[[Box C\] scrollIntoView from scrollable position:fixed]
|
||||
expected: FAIL
|
||||
|
||||
[[Box D\] scrollIntoView from scrollable position:fixed in iframe]
|
||||
expected: FAIL
|
||||
|
|
19
tests/wpt/tests/css/cssom-view/scrollIntoView-should-treat-slot-as-scroll-container.html
vendored
Normal file
19
tests/wpt/tests/css/cssom-view/scrollIntoView-should-treat-slot-as-scroll-container.html
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#overflow-control">
|
||||
<meta name="assert" content="scrollIntoView called on the descendant of shadow host with a slot should treat the slot as a pontential scroll container.">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div id="host">
|
||||
<div style="height: 200px"></div>
|
||||
<div id="target" style="height: 100px; width: 100px; background: green"></div>
|
||||
</div>
|
||||
<script>
|
||||
var shadow = host.attachShadow({mode: "open"});
|
||||
var slot = document.createElement("slot");
|
||||
slot.style="display: block; overflow: hidden; width: 100px; height: 100px; background: red";
|
||||
shadow.appendChild(slot);
|
||||
target.scrollIntoView();
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue