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-06-17 15:33:34 +02:00
parent effd6f2f87
commit 284cb8aae8
6 changed files with 33 additions and 25 deletions

View file

@ -553488,7 +553488,7 @@
"testharness"
],
"cssom-view/elementScroll.html": [
"5471dca08aae9d446c487d40853957e9290677f3",
"56d85d2973ad630dd28842df6479b1f571b7f340",
"testharness"
],
"cssom-view/elementsFromPoint.html": [

View file

@ -0,0 +1,4 @@
[003.html]
type: testharness
[Fragment Navigation: Updating scroll position]
expected: FAIL

View file

@ -33,12 +33,14 @@
Curabitur elit lacus, bibendum non tempus a, bibendum sit amet ante. Mauris eget nibh quis leo rhoncus consequat. Integer iaculis sed sapien eu pellentesque. In aliquet elementum lorem, ut consequat elit ultrices id. Phasellus vestibulum ex ex, ac sagittis tortor convallis et. Curabitur placerat id lectus at aliquam. Morbi sed nisl sem. Nam sit amet arcu maximus, volutpat nisl ac, dignissim neque. Etiam nec efficitur libero. Quisque tristique pulvinar est, eget dictum ex vehicula non. Nam dignissim non felis a iaculis. Nullam vel dolor vitae libero aliquet congue. Donec mi eros, semper non lectus at, commodo ullamcorper ligula. Donec commodo, sem vel lacinia porttitor, elit orci maximus felis, eget eleifend est velit id lorem.
</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");
@ -49,6 +51,9 @@
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 () {