Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: LayoutTests/fast/events/touch/resources/touch-hover-active-tests.js

Issue 163933002: Send early ShowPress on TapDown when page isn't scrollable/pinchable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refactor into hasEarlyShowPress() Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function getHoverActiveState(e) 1 function getHoverActiveState(e)
2 { 2 {
3 var states = { 3 var states = {
4 "rgb(0, 0, 255)": "default", 4 "rgb(0, 0, 255)": "default",
5 "rgb(0, 255, 0)": "active", 5 "rgb(0, 255, 0)": "active",
6 "rgb(255, 0, 0)": "hovered", 6 "rgb(255, 0, 0)": "hovered",
7 "rgb(255, 255, 0)": "hoveredAndActive" 7 "rgb(255, 255, 0)": "hoveredAndActive"
8 }; 8 };
9 9
10 var color = window.getComputedStyle(e).backgroundColor; 10 var color = window.getComputedStyle(e).backgroundColor;
11 var result = states[color]; 11 var result = states[color];
12 if (!result) 12 if (!result)
13 result = "unknown: " + color; 13 result = "unknown: " + color;
14 return result; 14 return result;
15 } 15 }
16 16
17 function elementCenter(e) 17 function elementCenter(e)
18 { 18 {
19 return { 19 return {
20 x: e.offsetLeft + e.offsetWidth / 2, 20 x: e.offsetLeft + e.offsetWidth / 2,
21 y: e.offsetTop + e.offsetHeight / 2 21 y: e.offsetTop + e.offsetHeight / 2
22 } 22 }
23 } 23 }
24 24
25 function shouldBeDefault(e) { shouldBeEqualToString(e, "default"); } 25 function shouldBeDefault(e) { shouldBeEqualToString(e, "default"); }
26 function shouldBeOnlyActive(e) { shouldBeEqualToString(e, "active"); } 26 function shouldBeOnlyActive(e) { shouldBeEqualToString(e, "active"); }
27 function shouldBeOnlyHovered(e) { shouldBeEqualToString(e, "hovered"); } 27 function shouldBeOnlyHovered(e) { shouldBeEqualToString(e, "hovered"); }
28 function shouldBeHoveredAndActive(e) { shouldBeEqualToString(e, "hoveredAndActiv e"); } 28 function shouldBeHoveredAndActive(e) { shouldBeEqualToString(e, "hoveredAndActiv e"); }
29
30 function hasEarlyShowPress(e, elementLocation, shouldBeActivated)
31 {
32 debug("Verify hover, active aren't initially set.");
33 shouldBeDefault(e);
34
35 eventSender.gestureTapDown(elementLocation.x, elementLocation.y);
36 if (shouldBeActivated) {
37 debug("tapDown on element should activate.");
38 shouldBeHoveredAndActive(e);
39 } else {
40 debug("tapdown on element should not activate.");
41 shouldBeDefault(e);
42 }
43
44 debug("showPress on element should " + (shouldBeActivated ? "keep hover and active." : "activate."));
45 eventSender.gestureShowPress(elementLocation.x, elementLocation.y);
46 shouldBeHoveredAndActive(e);
47 eventSender.gestureTapCancel(elementLocation.x, elementLocation.y);
48 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/touch/gesture/resources/gesture-tap-down-iframe.html ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698