| Index: LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-pinch.html
|
| diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-pinch.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-pinch.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..baab467131216e0b1b810458f2eedeb88c463d82
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-pinch.html
|
| @@ -0,0 +1,168 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../../../resources/js-test.js"></script>
|
| +<style type="text/css">
|
| +#box {
|
| + width: 300px;
|
| + height: 50px;
|
| +}
|
| +
|
| +#overflowBox {
|
| + width: 300px;
|
| + height: 600px;
|
| +}
|
| +
|
| +#container {
|
| + width: 300px;
|
| + height: 50px;
|
| + overflow-y: scroll;
|
| + overflow-x: hidden;
|
| + margin: 10px 0 10px 0;
|
| +}
|
| +
|
| +.interactive { background-color: blue; }
|
| +
|
| +.interactive:hover { background-color: red; }
|
| +
|
| +.interactive:active { background-color: green; }
|
| +
|
| +.interactive:hover:active { background-color: yellow; }
|
| +
|
| +#scroller {
|
| + display: none;
|
| + width: 100px;
|
| + height: 600px;
|
| +}
|
| +</style>
|
| +</head>
|
| +<body>
|
| +<div id="box" class="interactive">Gestures go here</div>
|
| +<div id="container">
|
| + <div id="overflowBox" class="interactive">Gestures go here</div>
|
| +</div>
|
| +
|
| +<p id="description"></p>
|
| +<p>See http://crbug.com/316974 for details</p>
|
| +
|
| +<div id="console"></div>
|
| +
|
| +<div id="scroller"></div>
|
| +
|
| +<script>
|
| +if (window.internals) {
|
| + internals.settings.setViewportEnabled(true);
|
| + internals.settings.setViewportMetaEnabled(true);
|
| +}
|
| +
|
| +var color;
|
| +
|
| +function isBoxOfColor(id, givenColor)
|
| +{
|
| + var b = document.getElementById(id);
|
| + color = window.getComputedStyle(b).backgroundColor;
|
| + if (color == givenColor)
|
| + return true;
|
| +
|
| + testFailed('Box had backgroundColor: ' + color);
|
| + return false;
|
| +}
|
| +
|
| +function isBoxHoverActive(id)
|
| +{
|
| + return isBoxOfColor(id, "rgb(255, 255, 0)");
|
| +}
|
| +
|
| +function isBoxDefault(id)
|
| +{
|
| + return isBoxOfColor(id, "rgb(0, 0, 255)");
|
| +}
|
| +
|
| +description("Tests gesture tapdown behaviour on different scroll / pinch settings.");
|
| +
|
| +function runTests()
|
| +{
|
| + if (!window.eventSender) {
|
| + debug('This test requires DRT.');
|
| + return;
|
| + }
|
| +
|
| + if (!eventSender.gestureTapDown
|
| + || !eventSender.gestureShowPress) {
|
| + debug('Gesture events are not supported by this platform');
|
| + return;
|
| + }
|
| +
|
| + // Insert meta tag after viewport has been enabled via internals
|
| + var meta = document.createElement('meta');
|
| + meta.name = 'viewport';
|
| + meta.content = 'initial-scale=1, maximum-scale=2';
|
| + document.head.appendChild(meta);
|
| +
|
| + // Verify behaviour when page is pinchable
|
| + debug("Verify hover, active aren't initially set (scroll disabled, pinch enabled).");
|
| + shouldBeTrue("isBoxDefault('box')");
|
| +
|
| + debug("tapdown on element should not activate.");
|
| + eventSender.gestureTapDown(50, 25);
|
| + shouldBeTrue("isBoxDefault('box')");
|
| +
|
| + debug("showpress on element should activate.");
|
| + eventSender.gestureShowPress(50, 25);
|
| + shouldBeTrue("isBoxHoverActive('box')");
|
| + eventSender.gestureTapCancel(50, 25);
|
| +
|
| + // Send a sequence to another element to clear current one without relying on tap
|
| + eventSender.gestureTapDown(50, 80);
|
| + eventSender.gestureShowPress(50, 80);
|
| + eventSender.gestureTapCancel(50, 80);
|
| +
|
| + // Update viewport to make page non-pinchable
|
| + meta.content = 'width=device-width, initial-scale=1, user-scalable=no';
|
| +
|
| + // Verify behaviour when page isn't scrollable or pinchable
|
| + debug("Verify hover, active aren't initially set (scroll disabled, pinch disabled).");
|
| + shouldBeTrue("isBoxDefault('box')");
|
| +
|
| + debug("tapdown on element should activate.");
|
| + eventSender.gestureTapDown(50, 25);
|
| + shouldBeTrue("isBoxHoverActive('box')");
|
| +
|
| + debug("showpress on element should keep hover and active.");
|
| + eventSender.gestureShowPress(50, 25);
|
| + shouldBeTrue("isBoxHoverActive('box')");
|
| + eventSender.gestureTapCancel(50, 25);
|
| +
|
| + // Verify behaviour when ancestor is scrollable
|
| + debug("Verify hover, active aren't initially set (overflowBox with scrollable ancestor).");
|
| + shouldBeTrue("isBoxDefault('overflowBox')");
|
| +
|
| + debug("tapdown on element should not activate.");
|
| + eventSender.gestureTapDown(50, 80);
|
| + shouldBeTrue("isBoxDefault('overflowBox')");
|
| +
|
| + debug("showpress on element should activate.");
|
| + eventSender.gestureShowPress(50, 80);
|
| + shouldBeTrue("isBoxHoverActive('overflowBox')");
|
| + eventSender.gestureTapCancel(50, 80);
|
| +
|
| + // Now check when page becomes scrollable
|
| + document.getElementById('scroller').style.display = 'block';
|
| + debug("Verify hover, active aren't initially set (scroll enabled, pinch disabled).");
|
| + shouldBeTrue("isBoxDefault('box')");
|
| +
|
| + debug("tapdown on element should not activate.");
|
| + eventSender.gestureTapDown(50, 25);
|
| + shouldBeTrue("isBoxDefault('box')");
|
| +
|
| + debug("showpress on element should activate.");
|
| + eventSender.gestureShowPress(50, 25);
|
| + shouldBeTrue("isBoxHoverActive('box')");
|
| + eventSender.gestureTapCancel(50, 25);
|
| +}
|
| +
|
| +runTests();
|
| +</script>
|
| +</body>
|
| +</html>
|
| +
|
|
|