[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
yael.aharon at nokia.com
yael.aharon at nokia.com
Wed Dec 22 14:10:12 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e76174ddddecb42354e4cd6895e507f900314132
Author: yael.aharon at nokia.com <yael.aharon at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 5 05:43:54 2010 +0000
2010-10-04 Yael Aharon <yael.aharon at nokia.com>
Reviewed by Antonio Gomes.
Spatial Navigation: Add support for <input type="radio">
https://bugs.webkit.org/show_bug.cgi?id=46993
* fast/events/spatial-navigation/snav-radio-expected.txt: Added.
* fast/events/spatial-navigation/snav-radio-group-expected.txt: Added.
* fast/events/spatial-navigation/snav-radio-group.html: Added.
* fast/events/spatial-navigation/snav-radio.html: Added.
2010-10-04 Yael Aharon <yael.aharon at nokia.com>
Reviewed by Antonio Gomes.
Spatial Navigation: Add support for <input type="radio">
https://bugs.webkit.org/show_bug.cgi?id=46993
When using Spatial Navigation, every radio button should be focusable and
users should be able to navigate from one button to the next without moving the selection.
Tests: fast/events/spatial-navigation/snav-radio-group.html
fast/events/spatial-navigation/snav-radio.html
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isKeyboardFocusable):
Every radio button should be keyboard focusable, if using Spatial Navigation.
(WebCore::HTMLInputElement::defaultEventHandler):
Disable the algorithm for selecting the next radio button within a group, if using Spatial Navigation.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dbec655..2ec217d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-04 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ Spatial Navigation: Add support for <input type="radio">
+ https://bugs.webkit.org/show_bug.cgi?id=46993
+
+ * fast/events/spatial-navigation/snav-radio-expected.txt: Added.
+ * fast/events/spatial-navigation/snav-radio-group-expected.txt: Added.
+ * fast/events/spatial-navigation/snav-radio-group.html: Added.
+ * fast/events/spatial-navigation/snav-radio.html: Added.
+
2010-10-04 Renata Hodovan <reni at inf.u-szeged.hu>
Reviewed by Andreas Kling.
diff --git a/LayoutTests/fast/events/spatial-navigation/snav-multiple-select-expected.txt b/LayoutTests/fast/events/spatial-navigation/snav-radio-expected.txt
similarity index 100%
copy from LayoutTests/fast/events/spatial-navigation/snav-multiple-select-expected.txt
copy to LayoutTests/fast/events/spatial-navigation/snav-radio-expected.txt
diff --git a/LayoutTests/fast/events/spatial-navigation/snav-radio-group-expected.txt b/LayoutTests/fast/events/spatial-navigation/snav-radio-group-expected.txt
new file mode 100644
index 0000000..21debaa
--- /dev/null
+++ b/LayoutTests/fast/events/spatial-navigation/snav-radio-group-expected.txt
@@ -0,0 +1,24 @@
+2
+4
+
+
+ 6
+8
+PASS gFocusedDocument.activeElement.getAttribute("id") is "down"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "8"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "down"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "up"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "up"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "right"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "right"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "left"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "left"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
+PASS document.getElementById('down').checked is true
+
diff --git a/LayoutTests/fast/events/spatial-navigation/snav-radio-group.html b/LayoutTests/fast/events/spatial-navigation/snav-radio-group.html
new file mode 100644
index 0000000..403f97a
--- /dev/null
+++ b/LayoutTests/fast/events/spatial-navigation/snav-radio-group.html
@@ -0,0 +1,109 @@
+<html>
+ <!--
+ This test ensures the correctness of Spatial Navigation (SNav) algorithm over single select element.
+
+ * Pre-conditions:
+ 1) DRT support for SNav enable/disable.
+
+ * Navigation steps:
+ 1) Loads this page, focus goes to "start" automatically.
+ 2) Focus moves away from select in 4 different directions to neighbor nodes and back.
+ -->
+ <head>
+ <script src="../../js/resources/js-test-pre.js"></script>
+ <script src="resources/spatial-navigation-utils.js"></script>
+ <script type="application/javascript">
+
+ var resultMap = [
+ ["Down", "down"],
+ ["Down", "8"],
+ ["Up", "down"],
+ ["Up", "start"],
+ ["Up", "up"],
+ ["Up", "2"],
+ ["Down", "up"],
+ ["Down", "start"],
+ ["Right", "right"],
+ ["Right", "6"],
+ ["Left", "right"],
+ ["Left", "start"],
+ ["Left", "left"],
+ ["Left", "4"],
+ ["Right", "left"],
+ ["Right", "start"],
+ ["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)
+ shouldBe("document.getElementById('down').checked", "true");
+ layoutTestController.notifyDone();
+ }
+
+ window.onload = runTest;
+
+ </script>
+ <script src="../js/resources/js-test-post.js"></script>
+ </head>
+ <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
+ <table style="text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
+ <tbody>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"></td>
+ <td style="vertical-align: center; text-align: center;"><a id="2" href="a">2</a></td>
+ <td style="vertical-align: center; text-align: center;"></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"><a id="4" href="a">4</a></td>
+ <td style="vertical-align: center; text-align: center;">
+ <table style="text-align: center; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
+ <tbody>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"></td>
+ <td style="vertical-align: center; text-align: center;"><input type="radio" name="group" id="up" ></td>
+ <td style="vertical-align: center; text-align: center;"></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"><input type="radio" name="group" id="left" ></td>
+ <td style="vertical-align: center; text-align: center;">
+ <input type="radio" name="group" id="start" >
+ </td>
+ <td style="vertical-align: center; text-align: center;"><input type="radio" name="group" id="right" ></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"></td>
+ <td style="vertical-align: center; text-align: center;"><input type="radio" name="group" id="down" checked ></td>
+ <td style="vertical-align: center; text-align: center;"></td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ <td style="vertical-align: center; text-align: center;"><a id="6" href="a">6</a></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: center; text-align: center;"></td>
+ <td style="vertical-align: center; text-align: center;"><a id="8" href="a">8</a></td>
+ <td style="vertical-align: center; text-align: center;"></td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="console"></div>
+ </body>
+</html>
+
diff --git a/LayoutTests/fast/events/spatial-navigation/snav-radio.html b/LayoutTests/fast/events/spatial-navigation/snav-radio.html
new file mode 100644
index 0000000..ee60cde
--- /dev/null
+++ b/LayoutTests/fast/events/spatial-navigation/snav-radio.html
@@ -0,0 +1,78 @@
+<html>
+ <!--
+ This test ensures the correctness of Spatial Navigation (SNav) algorithm over single select element.
+
+ * Pre-conditions:
+ 1) DRT support for SNav enable/disable.
+
+ * Navigation steps:
+ 1) Loads this page, focus goes to "start" automatically.
+ 2) Focus moves away from select in 4 different directions to neighbor nodes and back.
+ -->
+ <head>
+ <script src="../../js/resources/js-test-pre.js"></script>
+ <script src="resources/spatial-navigation-utils.js"></script>
+ <script type="application/javascript">
+
+ var resultMap = [
+ ["Down", "8"],
+ ["Up", "start"],
+ ["Up", "2"],
+ ["Down", "start"],
+ ["Right", "6"],
+ ["Left", "start"],
+ ["Left", "4"],
+ ["Right", "start"],
+ ["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="../js/resources/js-test-post.js"></script>
+ </head>
+ <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
+ <table style="text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top; text-align: center;"></td>
+ <td style="vertical-align: top; text-align: center;"><a id="2" href="a">2</a></td>
+ <td style="vertical-align: top; text-align: center;"></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top; text-align: center;"><a id="4" href="a">4</a></td>
+ <td style="vertical-align: top; text-align: center;"><input type="radio" id="start" ></td>
+ <td style="vertical-align: top; text-align: center;"><a id="6" href="a">6</a></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top; text-align: center;"></td>
+ <td style="vertical-align: top; text-align: center;"><a id="8" href="a">8</a></td>
+ <td style="vertical-align: top; text-align: center;"></td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="console"></div>
+ </body>
+</html>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d3b7879..f008e63 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-04 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ Spatial Navigation: Add support for <input type="radio">
+ https://bugs.webkit.org/show_bug.cgi?id=46993
+
+ When using Spatial Navigation, every radio button should be focusable and
+ users should be able to navigate from one button to the next without moving the selection.
+
+ Tests: fast/events/spatial-navigation/snav-radio-group.html
+ fast/events/spatial-navigation/snav-radio.html
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::isKeyboardFocusable):
+ Every radio button should be keyboard focusable, if using Spatial Navigation.
+ (WebCore::HTMLInputElement::defaultEventHandler):
+ Disable the algorithm for selecting the next radio button within a group, if using Spatial Navigation.
+
2010-10-04 Renata Hodovan <reni at inf.u-szeged.hu>
Reviewed by Andreas Kling.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index dff895a..61ad526 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -65,6 +65,7 @@
#include "RenderTextControlSingleLine.h"
#include "RenderTheme.h"
#include "ScriptEventListener.h"
+#include "Settings.h"
#include "StepRange.h"
#include "TextEvent.h"
#include "WheelEvent.h"
@@ -767,6 +768,9 @@ bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const
return false;
if (deprecatedInputType() == RADIO) {
+ // When using Spatial Navigation, every radio button should be focusable.
+ if (document()->frame() && document()->frame()->settings() && document()->frame()->settings()->isSpatialNavigationEnabled())
+ return true;
// Never allow keyboard tabbing to leave you in the same radio group. Always
// skip any other elements in the group.
@@ -2260,29 +2264,32 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
// Right and down mean "next radio button".
// Tested in WinIE, and even for RTL, left still means previous radio button (and so moves
// to the right). Seems strange, but we'll match it.
- bool forward = (key == "Down" || key == "Right");
-
- // We can only stay within the form's children if the form hasn't been demoted to a leaf because
- // of malformed HTML.
- Node* n = this;
- while ((n = (forward ? n->traverseNextNode() : n->traversePreviousNode()))) {
- // Once we encounter a form element, we know we're through.
- if (n->hasTagName(formTag))
- break;
-
- // Look for more radio buttons.
- if (n->hasTagName(inputTag)) {
- HTMLInputElement* elt = static_cast<HTMLInputElement*>(n);
- if (elt->form() != form())
+ // However, when using Spatial Navigation, we need to be able to navigate without changing the selection.
+ if (!document()->frame() || !document()->frame()->settings() || !document()->frame()->settings()->isSpatialNavigationEnabled()) {
+ bool forward = (key == "Down" || key == "Right");
+
+ // We can only stay within the form's children if the form hasn't been demoted to a leaf because
+ // of malformed HTML.
+ Node* n = this;
+ while ((n = (forward ? n->traverseNextNode() : n->traversePreviousNode()))) {
+ // Once we encounter a form element, we know we're through.
+ if (n->hasTagName(formTag))
break;
+
+ // Look for more radio buttons.
if (n->hasTagName(inputTag)) {
- HTMLInputElement* inputElt = static_cast<HTMLInputElement*>(n);
- if (inputElt->deprecatedInputType() == RADIO && inputElt->name() == name() && inputElt->isFocusable()) {
- inputElt->setChecked(true);
- document()->setFocusedNode(inputElt);
- inputElt->dispatchSimulatedClick(evt, false, false);
- evt->setDefaultHandled();
+ HTMLInputElement* elt = static_cast<HTMLInputElement*>(n);
+ if (elt->form() != form())
break;
+ if (n->hasTagName(inputTag)) {
+ HTMLInputElement* inputElt = static_cast<HTMLInputElement*>(n);
+ if (inputElt->deprecatedInputType() == RADIO && inputElt->name() == name() && inputElt->isFocusable()) {
+ inputElt->setChecked(true);
+ document()->setFocusedNode(inputElt);
+ inputElt->dispatchSimulatedClick(evt, false, false);
+ evt->setDefaultHandled();
+ break;
+ }
}
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list