Changeset 69078 in webkit


Ignore:
Timestamp:
Oct 4, 2010 10:43:54 PM (14 years ago)
Author:
yael.aharon@nokia.com
Message:

2010-10-04 Yael Aharon <yael.aharon@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@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.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69077 r69078  
     12010-10-04  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        Spatial Navigation: Add support for <input type="radio">
     6        https://bugs.webkit.org/show_bug.cgi?id=46993
     7
     8        * fast/events/spatial-navigation/snav-radio-expected.txt: Added.
     9        * fast/events/spatial-navigation/snav-radio-group-expected.txt: Added.
     10        * fast/events/spatial-navigation/snav-radio-group.html: Added.
     11        * fast/events/spatial-navigation/snav-radio.html: Added.
     12
    1132010-10-04  Renata Hodovan  <reni@inf.u-szeged.hu>
    214
  • trunk/WebCore/ChangeLog

    r69077 r69078  
     12010-10-04  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        Spatial Navigation: Add support for <input type="radio">
     6        https://bugs.webkit.org/show_bug.cgi?id=46993
     7
     8        When using Spatial Navigation, every radio button should be focusable and
     9        users should be able to navigate from one button to the next without moving the selection.
     10
     11        Tests: fast/events/spatial-navigation/snav-radio-group.html
     12               fast/events/spatial-navigation/snav-radio.html
     13
     14        * html/HTMLInputElement.cpp:
     15        (WebCore::HTMLInputElement::isKeyboardFocusable):
     16        Every radio button should be keyboard focusable, if using Spatial Navigation.
     17        (WebCore::HTMLInputElement::defaultEventHandler):
     18        Disable the algorithm for selecting the next radio button within a group, if using Spatial Navigation.
     19
    1202010-10-04  Renata Hodovan  <reni@inf.u-szeged.hu>
    221
  • trunk/WebCore/html/HTMLInputElement.cpp

    r68996 r69078  
    6666#include "RenderTheme.h"
    6767#include "ScriptEventListener.h"
     68#include "Settings.h"
    6869#include "StepRange.h"
    6970#include "TextEvent.h"
     
    768769
    769770    if (deprecatedInputType() == RADIO) {
     771        // When using Spatial Navigation, every radio button should be focusable.
     772        if (document()->frame() && document()->frame()->settings() && document()->frame()->settings()->isSpatialNavigationEnabled())
     773            return true;
    770774
    771775        // Never allow keyboard tabbing to leave you in the same radio group.  Always
     
    22612265            // Tested in WinIE, and even for RTL, left still means previous radio button (and so moves
    22622266            // to the right).  Seems strange, but we'll match it.
    2263             bool forward = (key == "Down" || key == "Right");
    2264            
    2265             // We can only stay within the form's children if the form hasn't been demoted to a leaf because
    2266             // of malformed HTML.
    2267             Node* n = this;
    2268             while ((n = (forward ? n->traverseNextNode() : n->traversePreviousNode()))) {
    2269                 // Once we encounter a form element, we know we're through.
    2270                 if (n->hasTagName(formTag))
    2271                     break;
    2272                    
    2273                 // Look for more radio buttons.
    2274                 if (n->hasTagName(inputTag)) {
    2275                     HTMLInputElement* elt = static_cast<HTMLInputElement*>(n);
    2276                     if (elt->form() != form())
     2267            // However, when using Spatial Navigation, we need to be able to navigate without changing the selection.
     2268            if (!document()->frame() || !document()->frame()->settings() || !document()->frame()->settings()->isSpatialNavigationEnabled()) {
     2269                bool forward = (key == "Down" || key == "Right");
     2270
     2271                // We can only stay within the form's children if the form hasn't been demoted to a leaf because
     2272                // of malformed HTML.
     2273                Node* n = this;
     2274                while ((n = (forward ? n->traverseNextNode() : n->traversePreviousNode()))) {
     2275                    // Once we encounter a form element, we know we're through.
     2276                    if (n->hasTagName(formTag))
    22772277                        break;
     2278
     2279                    // Look for more radio buttons.
    22782280                    if (n->hasTagName(inputTag)) {
    2279                         HTMLInputElement* inputElt = static_cast<HTMLInputElement*>(n);
    2280                         if (inputElt->deprecatedInputType() == RADIO && inputElt->name() == name() && inputElt->isFocusable()) {
    2281                             inputElt->setChecked(true);
    2282                             document()->setFocusedNode(inputElt);
    2283                             inputElt->dispatchSimulatedClick(evt, false, false);
    2284                             evt->setDefaultHandled();
     2281                        HTMLInputElement* elt = static_cast<HTMLInputElement*>(n);
     2282                        if (elt->form() != form())
    22852283                            break;
     2284                        if (n->hasTagName(inputTag)) {
     2285                            HTMLInputElement* inputElt = static_cast<HTMLInputElement*>(n);
     2286                            if (inputElt->deprecatedInputType() == RADIO && inputElt->name() == name() && inputElt->isFocusable()) {
     2287                                inputElt->setChecked(true);
     2288                                document()->setFocusedNode(inputElt);
     2289                                inputElt->dispatchSimulatedClick(evt, false, false);
     2290                                evt->setDefaultHandled();
     2291                                break;
     2292                            }
    22862293                        }
    22872294                    }
Note: See TracChangeset for help on using the changeset viewer.