Index: third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html |
diff --git a/third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html b/third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html |
index e3790e5950ef5ec80d5ce9a5ff368d009984d966..650690742e4d1257864c578f2c8493e194b3535b 100644 |
--- a/third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html |
+++ b/third_party/WebKit/LayoutTests/fast/images/imagemap-dynamic-area-updates.html |
@@ -1,9 +1,39 @@ |
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
-</head> |
-<body> |
-<script src="script-tests/imagemap-dynamic-area-updates.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE html> |
+<title>Test that when image map areas have their shape or coordinate dynamically altered, the clickable region changes.</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<img usemap="#m" width ="400" height="400" border="1px solid red" position="absolute" left="0" right="0" > |
fs
2016/08/16 16:56:19
'width', 'height' et.c should be in a style attrib
sivag
2016/08/16 17:50:52
Done.
|
+<map name="m"> |
+<area href="#" onclick="areaClicked = true; return false;"> |
+</map> |
+<script> |
+test(function() { |
+ var area = document.querySelector('area'); |
+ function CheckPointInArea(shape, cords, x, y) { |
fs
2016/08/16 16:56:19
CheckPointInArea -> checkPointInArea; cords -> coo
sivag
2016/08/16 17:50:52
Done.
|
+ area.setAttribute('shape', shape); |
+ area.setAttribute('coords', cords); |
+ areaClicked = false; |
+ // TODO(siva.gunturi): Use elementFromPoint here. |
+ eventSender.mouseMoveTo(x, y); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ return areaClicked; |
+ } |
+ assert_true(CheckPointInArea('default', '', 50, 50)); |
+ assert_true(CheckPointInArea('default', '', 50, 50)); |
+ assert_true(CheckPointInArea('rect', '0, 0, 100, 100', 50, 50)); |
+ assert_false(CheckPointInArea('rect', '0, 0, 100, 100', 150, 150)); |
+ assert_false(CheckPointInArea('rect', '200, 200, 300, 300', 50, 50)); |
+ assert_true(CheckPointInArea('rect', '200, 200, 300, 300', 250, 250)); |
+ assert_true(CheckPointInArea('circle', '100, 100, 50', 100, 100)); |
+ assert_true(CheckPointInArea('circle', '100, 100, 50', 120, 100)); |
+ assert_false(CheckPointInArea('circle', '100, 100, 50', 200, 100)); |
+ assert_false(CheckPointInArea('circle', '300, 300, 50', 100, 100)); |
+ assert_true(CheckPointInArea('circle', '300, 300, 50', 300, 300)); |
+ assert_true(CheckPointInArea('circle', '300, 300, 50', 320, 300)); |
+ assert_true(CheckPointInArea('poly', '100, 100, 200, 100, 200, 200', 150, 150)); |
+ assert_false(CheckPointInArea('poly', '100, 100, 200, 100, 200, 200', 100, 150)); |
+ assert_false(CheckPointInArea('poly', '100, 100, 200, 100, 200, 200', 300, 300)); |
+ assert_true(CheckPointInArea('default', '', 300, 300)); |
+}); |
+</script> |