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

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

Issue 197923006: Refactor touch hit-testing hover/active tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
(Empty)
1 function getElement(e)
2 {
3 if (typeof e == "string")
4 e = document.getElementById(e);
5 return e;
6 }
7
8 function isBoxOfColor(givenColor)
9 {
10 return function(e, quiet)
11 {
12 e = getElement(e);
13 var color = window.getComputedStyle(e).backgroundColor;
14 if (color == givenColor)
15 return true;
16 if (!quiet)
17 testFailed('Box had backgroundColor: ' + color);
18 return false;
19 }
20 }
21
22 function elementCenter(e)
tdresser 2014/03/14 14:24:51 Where is this used?
Zeeshan Qureshi 2014/03/14 14:52:21 Oh I was using this in another CL and decided to s
23 {
24 e = getElement(e);
25 return {
26 x: e.offsetLeft + e.offsetWidth / 2,
27 y: e.offsetTop + e.offsetHeight / 2
28 }
29 }
30
31 // Generate methods
tdresser 2014/03/14 14:24:51 Could switch to "boxShouldBeOfColor," which would
Zeeshan Qureshi 2014/03/14 14:52:21 I'm not quite following this, wouldn't the test ou
32 window.isBoxDefault = isBoxOfColor("rgb(0, 0, 255)");
33 window.isBoxHovered = isBoxOfColor("rgb(255, 0, 0)");
34 window.isBoxActive = isBoxOfColor("rgb(0, 255, 0)");
35 window.isBoxHoverActive = isBoxOfColor("rgb(255, 255, 0)");
tdresser 2014/03/14 14:24:51 How about "isBoxHoveredAndActive"?
Zeeshan Qureshi 2014/03/14 14:52:21 That sounds better.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698