Diff
Modified: trunk/LayoutTests/ChangeLog (95380 => 95381)
--- trunk/LayoutTests/ChangeLog 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/LayoutTests/ChangeLog 2011-09-17 10:57:17 UTC (rev 95381)
@@ -1,3 +1,22 @@
+2011-09-17 Deepak Sherveghar <[email protected]>
+
+ Override supportsFocus() for HTMLMediaElement.
+ https://bugs.webkit.org/show_bug.cgi?id=67190
+
+ Reviewed by Antonio Gomes.
+
+ For media elements be able to receive focus without tabindex if
+ control attribute is present, hence changed
+ tabindex-focus-blur-all.js and tabindex-focus-blur-all-expected.txt.
+
+ * fast/events/media-element-focus-tab-expected.txt: Added.
+ * fast/events/media-element-focus-tab.html: Added.
+ * fast/events/resources/tabindex-focus-blur-all.js:
+ (test):
+ * fast/events/tabindex-focus-blur-all-expected.txt:
+ * fast/spatial-navigation/snav-media-elements-expected.txt: Added.
+ * fast/spatial-navigation/snav-media-elements.html: Added.
+
2011-09-17 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening.
Added: trunk/LayoutTests/fast/events/media-element-focus-tab-expected.txt (0 => 95381)
--- trunk/LayoutTests/fast/events/media-element-focus-tab-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/media-element-focus-tab-expected.txt 2011-09-17 10:57:17 UTC (rev 95381)
@@ -0,0 +1,18 @@
+This tests that a media element ie: <Audio> or <video>, without tabindex can be selected with keyboard (TAB Key)
+
+SUCCESS: Tab-Key did tab to the Media Element (video1). TEST: WithTabIndexVideo.
+SUCCESS: Tab-Key did tab to the Media Element (video2). TEST: WithoutTabIndexVideo.
+SUCCESS: Tab-Key did tab to the Media Element (video3). TEST: WithoutControlsButWithTabIndexVideo.
+SUCCESS: Tab-Key did tab to the Media Element (audio1). TEST: WithoutTabIndexAudio.
+SUCCESS: Tab-Key did not tab to the Media Element (audio2). TEST: WithoutControlaAndTabIndexAudio.
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/LayoutTests/fast/events/media-element-focus-tab.html (0 => 95381)
--- trunk/LayoutTests/fast/events/media-element-focus-tab.html (rev 0)
+++ trunk/LayoutTests/fast/events/media-element-focus-tab.html 2011-09-17 10:57:17 UTC (rev 95381)
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <body id="body">
+ <p>This tests that a media element ie: <code><Audio></code> or <code><video></code>, without tabindex can be selected with keyboard (TAB Key)</p>
+ <pre id="console"></pre>
+
+ <input id="WithTabIndexVideo" type=text>
+ <br>
+ <video id="video1" _onfocus_="window.mediaFocused = true" controls tabindex="0" src=""
+ <br>
+
+ <input id="WithoutTabIndexVideo" type=text>
+ <br>
+ <video id="video2" _onfocus_="window.mediaFocused = true" controls src=""
+ <br>
+
+ <input id="WithoutControlsButWithTabIndexVideo" type=text>
+ <br>
+ <video id="video3" _onfocus_="window.mediaFocused = true" tabindex="0" src=""
+ <br>
+
+ <input id="WithoutTabIndexAudio" type=text>
+ <br>
+ <audio id="audio1" _onfocus_="window.mediaFocused = true" controls src=""
+ <br>
+
+ <input id="WithoutControlaAndTabIndexAudio" type=text>
+ <br>
+ <audio id="audio2" _onfocus_="window.mediaFocused = true" src=""
+ <br>
+
+ <script>
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function test(mediaId, fieldId, shoulbefocussed)
+ {
+ if (!window.eventSender)
+ return;
+
+ var mediaFocusedResult, mediaNotFocusedResult;
+ if (shoulbefocussed)
+ {
+ mediaFocusedResult = "SUCCESS";
+ mediaNotFocusedResult = "FAIL";
+ }
+ else
+ {
+ mediaFocusedResult = "FAIL";
+ mediaNotFocusedResult = "SUCCESS";
+ }
+
+ window.mediaFocused = false;
+ document.getElementById(fieldId).focus();
+ eventSender.keyDown('\t');
+ if (window.mediaFocused)
+ document.getElementById("console").innerHTML += mediaFocusedResult + ": Tab-Key did tab to the Media Element (" + mediaId + "). TEST: " + fieldId + ".\n";
+ else
+ document.getElementById("console").innerHTML += mediaNotFocusedResult + ": Tab-Key did not tab to the Media Element (" + mediaId + "). TEST: " + fieldId + ".\n";
+ }
+
+ test("video1", "WithTabIndexVideo", true);
+ test("video2", "WithoutTabIndexVideo", true);
+ test("video3", "WithoutControlsButWithTabIndexVideo", true);
+ test("audio1", "WithoutTabIndexAudio", "SUCCESS", true);
+ test("audio2", "WithoutControlaAndTabIndexAudio", false);
+
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/fast/events/resources/tabindex-focus-blur-all.js (95380 => 95381)
--- trunk/LayoutTests/fast/events/resources/tabindex-focus-blur-all.js 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/LayoutTests/fast/events/resources/tabindex-focus-blur-all.js 2011-09-17 10:57:17 UTC (rev 95381)
@@ -17,7 +17,9 @@
"INPUT",
"ISINDEX",
"SELECT",
- "TEXTAREA"];
+ "TEXTAREA",
+ "AUDIO",
+ "VIDEO"];
var tagNamesTransferFocused = ["LABEL"]; // labels always transfer focus to the labeled element
@@ -52,7 +54,7 @@
var homeBase = window.frames[1].document.getElementsByClassName('homebase');
homeBase[0].focus();
- var resultSummary = focusCount+" focus / "+blurCount+" blur events dispatched, and should be 331 / 331 ";
+ var resultSummary = focusCount+" focus / "+blurCount+" blur events dispatched, and should be 333 / 333 ";
resultSummary += (focusCount==blurCount) ? "<span style='color:green'>PASSED</span><br>" : "<span style='color:red'>FAILED</span><br>";
resultSummary += "Total of "+failedTestCount+" focus test(s) failed.";
if (failedTestCount)
Modified: trunk/LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt (95380 => 95381)
--- trunk/LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/LayoutTests/fast/events/tabindex-focus-blur-all-expected.txt 2011-09-17 10:57:17 UTC (rev 95381)
@@ -1,2 +1,2 @@
-331 focus / 331 blur events dispatched, and should be 331 / 331 PASSED
+333 focus / 333 blur events dispatched, and should be 333 / 333 PASSED
Total of 0 focus test(s) failed. PASSED
Added: trunk/LayoutTests/fast/spatial-navigation/snav-media-elements-expected.txt (0 => 95381)
--- trunk/LayoutTests/fast/spatial-navigation/snav-media-elements-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/spatial-navigation/snav-media-elements-expected.txt 2011-09-17 10:57:17 UTC (rev 95381)
@@ -0,0 +1,25 @@
+This is a link start of Test.
+
+This is a link i2.
+
+This is a link i4.
+
+This is a link i6.
+
+This is a link i8.
+
+This is a link End of Test.
+
+PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "v1"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "i2"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "v3"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "i4"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "v5"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "i6"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "a7"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "i8"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "i8"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
+This tests that a media elements ie: <Audio> or <video>, without tabindex are able to be reached through keyboard access
Added: trunk/LayoutTests/fast/spatial-navigation/snav-media-elements.html (0 => 95381)
--- trunk/LayoutTests/fast/spatial-navigation/snav-media-elements.html (rev 0)
+++ trunk/LayoutTests/fast/spatial-navigation/snav-media-elements.html 2011-09-17 10:57:17 UTC (rev 95381)
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script type="application/_javascript_">
+
+ var resultMap = [
+ ["Up", "start"],
+ ["Down", "v1"],
+ ["Down", "i2"],
+ ["Down", "v3"],
+ ["Down", "i4"],
+ ["Down", "v5"],
+ ["Down", "i6"],
+ ["Down", "a7"],
+ ["Down", "i8"],
+ ["Down", "end"],
+ ["Up", "i8"],
+ ["Down", "end"],
+ ["DONE", "DONE"]
+ ];
+
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setSpatialNavigationEnabled(true);
+ layoutTestController.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+ layoutTestController.waitUntilDone();
+ }
+
+ function runTest()
+ {
+ // starting the test itself: get to a known place.
+ document.getElementById("start").focus();
+
+ initTest(resultMap, testCompleted);
+ }
+
+ function testCompleted()
+ {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+
+ window._onload_ = runTest;
+
+ </script>
+ <script src=""
+ </head>
+
+ <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
+
+ <p>This is a link <a id="start" href="" of Test</a>.</p>
+ <video id="v1" controls tabindex="0" src=""
+
+ <p>This is a link <a id="i2" href=""
+ <video id="v3" controls src=""
+
+ <p>This is a link <a id="i4" href=""
+ <video id="v5" tabindex="0" src=""
+
+ <p>This is a link <a id="i6" href=""
+ <audio id="a7" controls src=""
+
+ <p>This is a link <a id="i8" href=""
+ <!-- 'a9' is not focussable: no controls attribute as well no tab index.
+ Key down from 'i8' should go to 'end'. -->
+ <audio id="a9" src=""
+
+ <p>This is a link <a id="end" href="" of Test</a>.</p>
+
+ <div id="console"></div>
+ <p>This tests that a media elements ie: <code><Audio></code> or <code><video></code>, without tabindex are able to be reached through keyboard access</p>
+ </body>
+</html>
Property changes on: trunk/LayoutTests/fast/spatial-navigation/snav-media-elements.html
___________________________________________________________________
Added: svn:executable
Modified: trunk/Source/WebCore/ChangeLog (95380 => 95381)
--- trunk/Source/WebCore/ChangeLog 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/Source/WebCore/ChangeLog 2011-09-17 10:57:17 UTC (rev 95381)
@@ -1,3 +1,19 @@
+2011-09-17 Deepak Sherveghar <[email protected]>
+
+ Override supportsFocus() for HTMLMediaElement.
+ https://bugs.webkit.org/show_bug.cgi?id=67190
+
+ Reviewed by Antonio Gomes.
+
+ Tests: fast/events/media-element-focus-tab.html
+ fast/spatial-navigation/snav-media-elements.html
+
+ Return true from supportsFocus() if control's attribute is present or a tabindex is specified.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::supportsFocus):
+ * html/HTMLMediaElement.h:
+
2011-09-16 Adam Barth <[email protected]>
Rename ENABLE(LEVELDB) to USE(LEVELDB)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (95380 => 95381)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-17 10:57:17 UTC (rev 95381)
@@ -245,6 +245,12 @@
HTMLElement::didMoveToNewOwnerDocument();
}
+bool HTMLMediaElement::supportsFocus() const
+{
+ // If no controls specified, we should still be able to focus the element if it has tabIndex.
+ return controls() || HTMLElement::supportsFocus();
+}
+
void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
HTMLElement::attributeChanged(attr, preserveDecls);
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (95380 => 95381)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2011-09-17 09:49:26 UTC (rev 95380)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2011-09-17 10:57:17 UTC (rev 95381)
@@ -249,6 +249,7 @@
private:
void createMediaPlayer();
+ virtual bool supportsFocus() const;
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);