INPUT_MULTIPLE_FIELDS_UI: Should not move focus if the element already has focus
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 13:03:38 +0000 (13:03 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 13:03:38 +0000 (13:03 +0000)
commit5c6096a0f74ae854c90a84191907b5f2597de6dd
treeb1f71dbee532187fad91453fca74e0c45cd85070
parentb87b4094e80808b4641cc12bb465cfd6e155fa30
INPUT_MULTIPLE_FIELDS_UI: Should not move focus if the element already has focus
https://bugs.webkit.org/show_bug.cgi?id=108914

Reviewed by Kentaro Hara.

Source/WebCore:

If timeInput.focus() is called when a sub-field of the time input
already has focus, we should not focus on the first sub-field of the
time input.

Test: fast/forms/time-multiple-fields/time-multiple-fields-focus.html

* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::willCancelFocus): If
the input elment already has focused sub-field, we don't need to proceed
focus handling. FocusDirection check is required because we don't need
to do this in cases of sequential focus navigation.
* html/BaseMultipleFieldsDateAndTimeInputType.h:
(BaseMultipleFieldsDateAndTimeInputType): Override InputType::willCancelFocus.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::focus):
Cancel focus if InputType::willCancelFocus returns true.
* html/HTMLInputElement.h:
(HTMLInputElement): Override focus.
* html/InputType.cpp:
(WebCore::InputType::willCancelFocus):
Add a default implementation. It returns false.
* html/InputType.h:
(InputType): Declare willCancelFocus.

LayoutTests:

* fast/forms/time-multiple-fields/time-multiple-fields-focus-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-focus.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp
Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h