Bug 1348321 - Add a mochitest for dragging a scrollbar on a fixed transformed scrollframe. r?botond
MozReview-Commit-ID: EWYSrG4OO7m
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1462961.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Dragging the mouse on a transformed scrollframe inside a fixed-pos element</title>
+ <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+ <script type="text/javascript">
+
+function* test(testDriver) {
+ var scrollableDiv = document.getElementById('scrollable');
+ scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
+
+ // Scroll down a small amount (10px). The bug in this case is that the
+ // scrollthumb remains a little "above" where it's supposed to be, so if the
+ // bug manifests here, then the thumb will remain at the top of the track
+ // and the scroll position will remain at 0.
+ var scrolled = yield* dragVerticalScrollbar(scrollableDiv, testDriver, 10, 10);
+ if (!scrolled) {
+ ok(true, "No scrollbar, can't do this test");
+ return;
+ }
+
+ // the events above might be stuck in APZ input queue for a bit until the
+ // layer is activated, so we wait here until the scroll event listener is
+ // triggered.
+ yield;
+
+ // Flush everything just to be safe
+ yield flushApzRepaints(testDriver);
+
+ // In this case we just want to make sure the scroll position moved from 0
+ // which indicates the thumb dragging worked properly.
+ ok(scrollableDiv.scrollTop > 0, "Scrollbar drag resulted in a scroll position of " + scrollableDiv.scrollTop);
+}
+
+waitUntilApzStable()
+.then(runContinuation(test))
+.then(subtestDone);
+
+ </script>
+ <style>
+ #fixed {
+ position: fixed;
+ left: 0;
+ top: 0;
+ width: 300px;
+ height: 100%;
+ }
+ #scrollable {
+ transform: translateY(100px);
+ overflow: scroll;
+ height: 100%;
+ }
+ #content {
+ height: 5000px;
+ background-image: linear-gradient(red,blue);
+ }
+ </style>
+</head>
+<body>
+<div id="fixed">
+ <div id="scrollable">
+ <div id="content"></div>
+ </div>
+</div>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
@@ -18,17 +18,19 @@ var subtests = [
{'file': 'helper_drag_click.html'},
// Test for dragging on a fake-scrollbar element that scrolls the page
{'file': 'helper_drag_scroll.html'},
// Test for dragging the scrollbar with a fixed-pos element overlaying it
{'file': 'helper_bug1346632.html'},
// Test for scrollbar-dragging on a scrollframe that's inactive
{'file': 'helper_bug1326290.html'},
// Test for scrollbar-dragging on a scrollframe inside an SVGEffects
- {'file': 'helper_bug1331693.html'}
+ {'file': 'helper_bug1331693.html'},
+ // Test for scrollbar-dragging on a transformed scrollframe inside a fixed-pos item
+ {'file': 'helper_bug1462961.html'}
];
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
window.onload = function() {
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish, SimpleTest.finish);
};