Bug 772679. Make test_offsets.js handle the viewport being transformed. r=tnikkel

This commit is contained in:
Robert O'Callahan 2012-08-06 18:55:28 +12:00
Родитель 65fc24b3ac
Коммит 3fe838d0e8
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -119,11 +119,15 @@ function checkScrolledElement(element, child)
element.scrollTop = 20;
is(element.scrollLeft, 0, element.id + " scrollLeft after vertical scroll");
is(element.scrollTop, 20, element.id + " scrollTop after vertical scroll");
is(child.getBoundingClientRect().top, childrect.top - 20, "child position after vertical scroll");
// If the viewport has been transformed, then we might have scrolled to a subpixel value
// that's slightly different from what we requested. After rounding, however, it should
// be the same.
is(Math.round(childrect.top - child.getBoundingClientRect().top), 20, "child position after vertical scroll");
element.scrollTop = 0;
is(element.scrollLeft, 0, element.id + " scrollLeft after vertical scroll reset");
is(element.scrollTop, 0, element.id + " scrollTop after vertical scroll reset");
// Scrolling back to the top should work precisely.
is(child.getBoundingClientRect().top, childrect.top, "child position after vertical scroll reset");
element.scrollTop = 10;
@ -135,7 +139,7 @@ function checkScrolledElement(element, child)
element.scrollLeft = 18;
is(element.scrollLeft, 18, element.id + " scrollLeft after horizontal scroll");
is(element.scrollTop, 0, element.id + " scrollTop after horizontal scroll");
is(child.getBoundingClientRect().left, childrect.left - 18, "child position after horizontal scroll");
is(Math.round(childrect.left - child.getBoundingClientRect().left), 18, "child position after horizontal scroll");
element.scrollLeft = -30;
is(element.scrollLeft, 0, element.id + " scrollLeft after horizontal scroll reset");