Bug 48937 - Spatial Navigation: Add support for <select> element in single selection mode
Summary: Spatial Navigation: Add support for <select> element in single selection mode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Chang Shu
URL:
Keywords:
Depends on:
Blocks: 47094
  Show dependency treegraph
 
Reported: 2010-11-03 11:34 PDT by Chang Shu
Modified: 2010-11-06 14:26 PDT (History)
4 users (show)

See Also:


Attachments
fix patch (8.16 KB, patch)
2010-11-03 11:49 PDT, Chang Shu
tonikitoo: review-
Details | Formatted Diff | Diff
fix patch 2 (7.75 KB, patch)
2010-11-04 07:32 PDT, Chang Shu
tonikitoo: review+
tonikitoo: commit-queue-
Details | Formatted Diff | Diff
fix patch 3 (7.73 KB, patch)
2010-11-05 11:45 PDT, Chang Shu
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chang Shu 2010-11-03 11:34:58 PDT
This case handles the single selection mode only.
Comment 1 Chang Shu 2010-11-03 11:49:57 PDT
Created attachment 72847 [details]
fix patch
Comment 2 Antonio Gomes 2010-11-03 12:04:03 PDT
Comment on attachment 72847 [details]
fix patch

View in context: https://bugs.webkit.org/attachment.cgi?id=72847&action=review

Looks generally good. Comments below.

> WebCore/dom/SelectElement.cpp:236
> +bool SelectElement::isSpatialNavigation(const Element* element)

Should not be a class method, but a static helper.

Name is also not so good.

> WebCore/dom/SelectElement.cpp:655
> +        } else if (keyCode == ' ' && isSpatialNavigation(element)) {

What about ENTER?

> LayoutTests/fast/events/spatial-navigation/resources/spatial-navigation-utils.js:58
> -    return;
> +    direction = gExpectedResults[gIndex][0];
>    }

Lets also do "case " ":" and keep the default no-op. otherwise anything could get here.
Comment 3 Chang Shu 2010-11-04 07:32:05 PDT
Created attachment 72941 [details]
fix patch 2
Comment 4 Antonio Gomes 2010-11-05 09:23:50 PDT
Comment on attachment 72941 [details]
fix patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=72941&action=review

Looks good. r=me with my comments addressed.

> WebCore/dom/SelectElement.cpp:572
> +        if (isSpatialNavigationEnabled(element))

lets do it as

if (isSpatialNavigationEnabled(frame->settings()))

then in the function you do:

bool isSpatialNavigationenabled(Settings* settings)
{
  if (!setting)
     return false;

  return settings->isSpatialNavigationEnabled();
}

> WebCore/dom/SelectElement.cpp:777
> -        if (Frame* frame = element->document()->frame()) {
> -            if (frame->settings() && frame->settings()->isSpatialNavigationEnabled()) {
> -                // Check if the selection moves to the boundary.
> -                if (keyIdentifier == "Left" || keyIdentifier == "Right" || ((keyIdentifier == "Down" || keyIdentifier == "Up") && endIndex == data.activeSelectionEndIndex()))
> -                    return;
> -            }
> -        }
> +        if (isSpatialNavigationEnabled(element))

same here:

id (Frame* frame = element->document()->frame())
   if (isSpatialNavigationEnabled(frame->settings()))

so we would change only only of code here.

> LayoutTests/fast/events/spatial-navigation/resources/spatial-navigation-utils.js:63
> +  if (window.layoutTestController && direction != null)

only "&& direction" does not work?
Comment 5 Chang Shu 2010-11-05 11:45:08 PDT
Created attachment 73092 [details]
fix patch 3
Comment 6 Antonio Gomes 2010-11-05 12:01:01 PDT
Comment on attachment 73092 [details]
fix patch 3

View in context: https://bugs.webkit.org/attachment.cgi?id=73092&action=review

> WebCore/dom/SelectElement.cpp:75
> +static bool isSpatialNavigationEnabled(const Frame* frame)
> +{

Could you please file a bug to add a "static bool SpatialNavigation::isEnabled(Settings*)" method in spatialNavigation.h

they each file that touches it will have to have its own copy of this method. It is in /editing already.

If we do that, it should probably take a Settings* and that we should do the early return logic even for such small function, as I described in the previous comment.
Comment 7 Chang Shu 2010-11-05 12:03:41 PDT
(In reply to comment #6)
> (From update of attachment 73092 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=73092&action=review
> 
> > WebCore/dom/SelectElement.cpp:75
> > +static bool isSpatialNavigationEnabled(const Frame* frame)
> > +{
> 
> Could you please file a bug to add a "static bool SpatialNavigation::isEnabled(Settings*)" method in spatialNavigation.h
> 
> they each file that touches it will have to have its own copy of this method. It is in /editing already.
> 
> If we do that, it should probably take a Settings* and that we should do the early return logic even for such small function, as I described in the previous comment.

Makes sense, will do.
Comment 8 Antonio Gomes 2010-11-05 12:05:15 PDT
> they each file that touches it will have to have its own copy of this method. It is in /editing already.

in english now: "then files that want to know about spatial navigation status do not need to have their own copy of this method. 

e.g. this method is also in /editing"
Comment 9 WebKit Commit Bot 2010-11-05 12:22:24 PDT
Comment on attachment 73092 [details]
fix patch 3

Clearing flags on attachment: 73092

Committed r71442: <http://trac.webkit.org/changeset/71442>
Comment 10 WebKit Commit Bot 2010-11-05 12:22:31 PDT
Comment on attachment 73092 [details]
fix patch 3

Rejecting patch 73092 from commit-queue.

Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sl', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 73092]" exit_code: 1
Last 500 characters of output:
ts/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 546, in __getattr__
    self.forms()
  File "/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 559, in forms
    self._forms_factory.forms())
  File "/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 228, in forms
    raise ParseError(exc)
webkitpy.thirdparty.autoinstalled.mechanize._html.ParseError

Full output: http://queues.webkit.org/results/5252020
Comment 11 Chang Shu 2010-11-05 12:43:05 PDT
(In reply to comment #10)
> (From update of attachment 73092 [details])
> Rejecting patch 73092 from commit-queue.
> 
> Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sl', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 73092]" exit_code: 1
> Last 500 characters of output:
> ts/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 546, in __getattr__
>     self.forms()
>   File "/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 559, in forms
>     self._forms_factory.forms())
>   File "/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py", line 228, in forms
>     raise ParseError(exc)
> webkitpy.thirdparty.autoinstalled.mechanize._html.ParseError
> 
> Full output: http://queues.webkit.org/results/5252020

I guess the script is broken. can anyone take a look?
Comment 12 Ryosuke Niwa 2010-11-06 14:26:07 PDT
This test has been failing on gtk.  Please fix.