Fix several bugs related to scrolling

* scrollLeft/scrollTop returned values of parent or even document root
   Only the scroll of the node itself is returned. Otherwise 0.0.
* Scrolling via script had set viewport.
   This resulted in other nodes appearing scrolled.
   Now scroll_offsets are updated with correct node id.

These bugs caused other odd behavior like both body and
document.documentElement being scrolled or the view for scrolled
elements jumping.
This commit is contained in:
Pyfisch 2017-10-12 09:32:36 -04:00 committed by Josh Matthews
parent b6667181ee
commit 6f62723898
2 changed files with 5 additions and 1 deletions

View file

@ -574411,7 +574411,7 @@
"testharness"
],
"cssom-view/elementScroll.html": [
"24c65428976fc4971a33368e6bf6f8b77199d69b",
"2119d689cc369bd6632ee1a9525bcbf7d1d4ba65",
"testharness"
],
"cssom-view/elementsFromPoint-iframes.html": [

View file

@ -25,12 +25,14 @@
<section id="section">
<div id="scrollable"></div>
<div id="unrelated"></div>
</section>
<script>
setup({explicit_done:true});
window.onload = function () {
var section = document.getElementById("section");
var unrelated = document.getElementById("unrelated");
test(function () {
assert_equals(section.scrollTop, 0, "initial scrollTop should be 0");
@ -41,6 +43,8 @@
assert_equals(section.scrollTop, 30, "changed scrollTop should be 40");
assert_equals(section.scrollLeft, 40, "changed scrollLeft should be 40");
assert_equals(unrelated.scrollTop, 0, "unrelated element should not scroll");
assert_equals(unrelated.scrollLeft, 0, "unrelated element should not scroll");
}, "Element scrollTop/Left getter/setter test");
test(function () {