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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html

Issue 2244333004: Use document.ElementFromPoint instead of eventsender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed as per review comments. Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test that when image map areas have their shape or coordinate dynamically altered, the clickable region changes.</title> 2 <title>Test that when image map areas have their shape or coordinate dynamically altered, the test region changes.</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <img usemap="#m" style="height:400px; width:400px; border:1px solid red; positio n:absolute; left:0; right:0" > 5 <img usemap="#m" style="height:400px; width:400px; border:1px solid red; positio n:absolute; left:0; right:0" >
6 <map name="m"> 6 <map name="m">
7 <area href="#" onclick="areaClicked = true; return false;"> 7 <area href="#">
8 </map> 8 </map>
9 <script> 9 <script>
10 test(function() { 10 test(function() {
11 var area = document.querySelector('area'); 11 var area = document.querySelector('area');
12 function checkPointInArea(shape, coords, x, y) { 12 function checkPointInArea(shape, coords, x, y, equals) {
13 area.setAttribute('shape', shape); 13 area.setAttribute('shape', shape);
14 area.setAttribute('coords', coords); 14 area.setAttribute('coords', coords);
15 areaClicked = false; 15 equals ? assert_equals(area, document.elementFromPoint(x, y))
fs 2016/08/18 09:35:56 What I had in mind was more like: function checkP
16 // TODO(siva.gunturi): Use elementFromPoint here. 16 : assert_not_equals(area, document.elementFromPoint(x, y));
17 eventSender.mouseMoveTo(x, y);
18 eventSender.mouseDown();
19 eventSender.mouseUp();
20 return areaClicked;
21 } 17 }
22 assert_true(checkPointInArea('default', '', 50, 50)); 18 checkPointInArea('default', '', 50, 50, true);
23 assert_true(checkPointInArea('default', '', 50, 50)); 19 checkPointInArea('default', '', 50, 50, true);
24 assert_true(checkPointInArea('rect', '0, 0, 100, 100', 50, 50)); 20 checkPointInArea('rect', '0, 0, 100, 100', 50, 50, true);
25 assert_false(checkPointInArea('rect', '0, 0, 100, 100', 150, 150)); 21 checkPointInArea('rect', '0, 0, 100, 100', 150, 150, false);
26 assert_false(checkPointInArea('rect', '200, 200, 300, 300', 50, 50)); 22 checkPointInArea('rect', '200, 200, 300, 300', 50, 50, false);
27 assert_true(checkPointInArea('rect', '200, 200, 300, 300', 250, 250)); 23 checkPointInArea('rect', '200, 200, 300, 300', 250, 250, true);
28 assert_true(checkPointInArea('circle', '100, 100, 50', 100, 100)); 24 checkPointInArea('circle', '100, 100, 50', 100, 100, true);
29 assert_true(checkPointInArea('circle', '100, 100, 50', 120, 100)); 25 checkPointInArea('circle', '100, 100, 50', 120, 100, true);
30 assert_false(checkPointInArea('circle', '100, 100, 50', 200, 100)); 26 checkPointInArea('circle', '100, 100, 50', 200, 100, false);
31 assert_false(checkPointInArea('circle', '300, 300, 50', 100, 100)); 27 checkPointInArea('circle', '300, 300, 50', 100, 100, false);
32 assert_true(checkPointInArea('circle', '300, 300, 50', 300, 300)); 28 checkPointInArea('circle', '300, 300, 50', 300, 300, true);
33 assert_true(checkPointInArea('circle', '300, 300, 50', 320, 300)); 29 checkPointInArea('circle', '300, 300, 50', 320, 300, true);
34 assert_true(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 150, 15 0)); 30 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 150, 150, true);
35 assert_false(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 100, 1 50)); 31 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 100, 150, false);
36 assert_false(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 300, 3 00)); 32 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 300, 300, false);
37 assert_true(checkPointInArea('default', '', 300, 300)); 33 checkPointInArea('default', '', 300, 300, true);
38 }); 34 });
39 </script> 35 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698