AX: Should be able to tab to focus a link in a canvas subtree
authordmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 19:05:43 +0000 (19:05 +0000)
committerdmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 19:05:43 +0000 (19:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94967

Reviewed by Chris Fleizach.

Source/WebCore:

Skips the hasNonEmptyBoundingBox check in isKeyboardFocusable
when in a canvas subtree.

Test: fast/events/tab-focus-link-in-canvas.html

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isKeyboardFocusable):

LayoutTests:

Adds a test to make sure you can tab to a link inside a canvas
subtree.

* fast/events/tab-focus-link-in-canvas-expected.txt: Added.
* fast/events/tab-focus-link-in-canvas.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126908 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/events/tab-focus-link-in-canvas-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/tab-focus-link-in-canvas.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLAnchorElement.cpp

index 746821b..d069d0f 100644 (file)
@@ -1,3 +1,16 @@
+2012-08-28  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: Should be able to tab to focus a link in a canvas subtree
+        https://bugs.webkit.org/show_bug.cgi?id=94967
+
+        Reviewed by Chris Fleizach.
+
+        Adds a test to make sure you can tab to a link inside a canvas
+        subtree.
+
+        * fast/events/tab-focus-link-in-canvas-expected.txt: Added.
+        * fast/events/tab-focus-link-in-canvas.html: Added.
+
 2012-08-28  Philip Rogers  <pdr@google.com>
 
         Rebaselining chromium-mac test results with scrollbars.
 2012-08-28  Philip Rogers  <pdr@google.com>
 
         Rebaselining chromium-mac test results with scrollbars.
diff --git a/LayoutTests/fast/events/tab-focus-link-in-canvas-expected.txt b/LayoutTests/fast/events/tab-focus-link-in-canvas-expected.txt
new file mode 100644 (file)
index 0000000..63a9735
--- /dev/null
@@ -0,0 +1,11 @@
+Ensures that you can tab to focus a link inside a canvas subtree.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.activeElement.id is "before"
+PASS document.activeElement.id is "canvas_link"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Before 
diff --git a/LayoutTests/fast/events/tab-focus-link-in-canvas.html b/LayoutTests/fast/events/tab-focus-link-in-canvas.html
new file mode 100644 (file)
index 0000000..adc9ef4
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<a id="before" href="#">Before</a>
+
+<canvas>
+  <a id="canvas_link" href="#">Canvas Link</a>
+</canvas>
+
+<script>
+description("Ensures that you can tab to focus a link inside a canvas subtree.");
+
+if (window.testRunner && window.eventSender) {
+    testRunner.dumpAsText();
+    testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+
+    document.getElementById('before').focus();
+    shouldBe('document.activeElement.id', '"before"');
+
+    eventSender.keyDown('\t');
+    shouldBe('document.activeElement.id', '"canvas_link"');
+}
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
index dd3c0cc..7d3688d 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-28  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: Should be able to tab to focus a link in a canvas subtree
+        https://bugs.webkit.org/show_bug.cgi?id=94967
+
+        Reviewed by Chris Fleizach.
+
+        Skips the hasNonEmptyBoundingBox check in isKeyboardFocusable
+        when in a canvas subtree.
+
+        Test: fast/events/tab-focus-link-in-canvas.html
+
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::isKeyboardFocusable):
+
 2012-08-28  Koji Ishii  <kojiishi@gmail.com>
 
         OPENTYPE_VERTICAL support for Chromium Win
 2012-08-28  Koji Ishii  <kojiishi@gmail.com>
 
         OPENTYPE_VERTICAL support for Chromium Win
index 9f50c7f..6477558 100644 (file)
@@ -114,6 +114,9 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
     if (!document()->frame()->eventHandler()->tabsToLinks(event))
         return false;
 
     if (!document()->frame()->eventHandler()->tabsToLinks(event))
         return false;
 
+    if (isInCanvasSubtree())
+        return true;
+
     return hasNonEmptyBoundingBox();
 }
 
     return hasNonEmptyBoundingBox();
 }