summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas
diff options
context:
space:
mode:
authorjinho.bang <jinho.bang@samsung.com>2016-02-12 17:17:59 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-13 01:18:45 +0000
commitbd95f3ca29d7e11a5c11def6b2a46ee0a23084de (patch)
tree50a9513984cf294a7259d4f3f917e02278df90fc /third_party/WebKit/LayoutTests/fast/canvas
parent1c049dacd3da53c2b644a7a90a8dea4b77735434 (diff)
downloadchromium_src-bd95f3ca29d7e11a5c11def6b2a46ee0a23084de.zip
chromium_src-bd95f3ca29d7e11a5c11def6b2a46ee0a23084de.tar.gz
chromium_src-bd95f3ca29d7e11a5c11def6b2a46ee0a23084de.tar.bz2
Canvas2d: The control in hit region should be a canvas fallback element.
According to the hit region spec[1], the control parameter should be a supported interactive canvas fallback element. [1] https://html.spec.whatwg.org/multipage/scripting.html#supported-interactive-canvas-fallback-element BUG=328961 Review URL: https://codereview.chromium.org/1692183002 Cr-Commit-Position: refs/heads/master@{#375312}
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/canvas')
-rw-r--r--third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test.html91
1 files changed, 91 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test.html
new file mode 100644
index 0000000..17e59e8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<title>HitRegion Canvas Fallback Element Test</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="./resources/test-helpers.js"></script>
+<canvas width="400" height="400">
+ <a id="a"></a>
+ <a id="a_with_image"><img></a>
+ <button id="button"></button>
+ <input id="checkbox" type="checkbox">
+ <input id="radio" type="radio">
+ <input id="input_button" type="button">
+ <input id="input_image_button" type="image">
+ <select id="empty_select"></select>
+ <select id="select_size_greater_than_1" size="2"></select>
+ <select id="select_multiple" multiple="multiple"></select>
+ <select>
+ <option id="option_with_select"></option>
+ </select>
+ <select multiple="multiple">
+ <option id="option_with_select_multiple"></option>
+ </select>
+ <select size="2">
+ <option id="option_with_select_size_greater_than_1"></option>
+ </select>
+ <p id="p"></p>
+ <p id="p_with_tabindex" tabindex="0"></p>
+ <table>
+ <caption></caption>
+ <thead><tr><th></th></tr></thead>
+ <tfoot><tr><td></td></tr></tfoot>
+ <tbody><tr><td></td></tr></tbody>
+ </table>
+</canvas>
+<button id="button_is_not_descendant_of_canvas"></button>
+<style>
+
+body {
+ margin : 0px;
+ padding : 0px;
+}
+
+</style>
+<script>
+
+function canvas_fallback_test(element, expected) {
+ test(function() {
+ var canvas = document.querySelector('canvas');
+ var context = canvas.getContext('2d');
+
+ context.clearRect(0, 0, 400, 400);
+ context.rect(0, 0, 100, 100);
+ if (expected) {
+ assert_throws(expected, function() {
+ context.addHitRegion({ control : element });
+ });
+ } else {
+ context.addHitRegion({ control : element });
+ }
+ }, element.id);
+}
+
+const NotSupportedError = { name : 'NotSupportedError' };
+
+canvas_fallback_test(document.getElementById('button_is_not_descendant_of_canvas'), NotSupportedError);
+canvas_fallback_test(document.querySelector('canvas'), NotSupportedError);
+canvas_fallback_test(document.getElementById('a'));
+canvas_fallback_test(document.getElementById('a_with_image'), NotSupportedError);
+canvas_fallback_test(document.getElementById('button'));
+canvas_fallback_test(document.getElementById('checkbox'));
+canvas_fallback_test(document.getElementById('radio'));
+canvas_fallback_test(document.getElementById('input_button'));
+canvas_fallback_test(document.getElementById('input_image_button'), NotSupportedError);
+canvas_fallback_test(document.getElementById('empty_select'), NotSupportedError);
+canvas_fallback_test(document.getElementById('select_size_greater_than_1'));
+canvas_fallback_test(document.getElementById('select_multiple'));
+canvas_fallback_test(document.getElementById('option_with_select'), NotSupportedError);
+canvas_fallback_test(document.getElementById('option_with_select_multiple'));
+canvas_fallback_test(document.getElementById('option_with_select_size_greater_than_1'));
+canvas_fallback_test(document.getElementById('p'), NotSupportedError);
+canvas_fallback_test(document.getElementById('p_with_tabindex'));
+canvas_fallback_test(document.querySelector('canvas table'));
+canvas_fallback_test(document.querySelector('canvas tr'));
+canvas_fallback_test(document.querySelector('canvas th'));
+canvas_fallback_test(document.querySelector('canvas td'));
+canvas_fallback_test(document.querySelector('canvas thead'));
+canvas_fallback_test(document.querySelector('canvas tfoot'));
+canvas_fallback_test(document.querySelector('canvas tbody'));
+canvas_fallback_test(document.querySelector('canvas caption'));
+
+</script>