Permalink
Browse files

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.
  • Loading branch information...
pyfisch authored and jdm committed Oct 12, 2017
1 parent b666718 commit 6f62723898e962a176dc8b39709c9b1009079716
Showing with 5 additions and 1 deletion.
  1. +1 −1 tests/wpt/metadata/MANIFEST.json
  2. +4 −0 tests/wpt/web-platform-tests/cssom-view/elementScroll.html
@@ -574411,7 +574411,7 @@
"testharness"
],
"cssom-view/elementScroll.html": [
"24c65428976fc4971a33368e6bf6f8b77199d69b",
"2119d689cc369bd6632ee1a9525bcbf7d1d4ba65",
"testharness"
],
"cssom-view/elementsFromPoint-iframes.html": [
@@ -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 () {

0 comments on commit 6f62723

Please sign in to comment.