Bug 109544

Summary: INPUT_MULTIPLE_FIELDS_UI: Mouse click not on sub-fields in multiple fields input should not move focus
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Severity: Normal CC: haraken, mifenton, morrita, nbarth, ojan.autocc, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch 2
INPUT_MULTIPLE_FIELDS_UI: Mouse click not on sub-fields in multiple fields input should not move focus none

Description Kent Tamura 2013-02-11 21:53:48 PST
INPUT_MULTIPLE_FIELDS_UI: Mouse click not on sub-fields in multiple fields input  should not move focus

Steps to reproduce:
1. Open data:text/html,<input type=time autofocus>
2. Click on the minutes field
3. Click on ':' between fields

  Nothing happens. The minutes field keeps focus.
  Chrome 24: Any sub-fields doesn't have focus.
  Chrome 26: The hour field gets focus.
Comment 1 Kent Tamura 2013-02-11 22:13:44 PST
Created attachment 187773 [details]
Comment 2 Build Bot 2013-02-11 23:11:54 PST
Comment on attachment 187773 [details]

Attachment 187773 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/16496635
Comment 3 Kent Tamura 2013-02-11 23:20:58 PST
Created attachment 187781 [details]
Patch 2

Fix mac build
Comment 4 Kentaro Hara 2013-02-12 00:03:24 PST
Comment on attachment 187781 [details]
Patch 2

Looks OK
Comment 5 WebKit Review Bot 2013-02-12 00:36:36 PST
Comment on attachment 187781 [details]
Patch 2

Clearing flags on attachment: 187781

Committed r142592: <http://trac.webkit.org/changeset/142592>
Comment 6 WebKit Review Bot 2013-02-12 00:36:40 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Nils Barth 2013-02-12 01:00:18 PST
Created attachment 187803 [details]
INPUT_MULTIPLE_FIELDS_UI: Mouse click not on sub-fields in multiple fields input  should not move focus


Reviewed by Kentaro Hara.


This is similar to Bug 108914, "Should not move focus if the element
already has focus." We fixed a focus() case in Bug 108914. However we
still have the problem in a case of focusing by mouse click.

The fix for Bug 108914 intercepted focus() function to change the
behavior. However focus-by-click doesn't call focus(), but calls
FocusController::setFocusedNode. To fix this problem, we introduce
oldFocusedNode argument to handleFocusEvent, and
BaseMultipleFieldsDateAndTimeInputType::handleFocusEvent restores the
focus to oldFocusedNode if oldFocusedNode is one of sub-fields.
handleFocusEvent is called whenever the focused node is changed.

We don't need InputType::willCancelFocus any more because the new code
in handleFocusEvent covers it.

Tests: Update fast/forms/time-multiple-fields/time-multiple-fields-focus.html.

* html/HTMLTextFormControlElement.h:
Add oldFocusedNode argument.
* html/HTMLTextFormControlElement.cpp:
Pass oldFocusedNode to handleFocusEvent.

* html/HTMLInputElement.h:
- Add oldFocusedNode argument to handleFocusEvent.
- Remove focus() override.
* html/HTMLInputElement.cpp: Remove focus() override.
Pass oldFocusedNode to InputType::handleFocusEvent.
* html/InputType.cpp: Remove willCancelFocus.
Add oldFocusedNode argument.
* html/InputType.h:
(InputType): Ditto.
* html/PasswordInputType.cpp:
(WebCore::PasswordInputType::handleFocusEvent): Ditto.
* html/PasswordInputType.h:
(PasswordInputType): Ditto.

* html/BaseMultipleFieldsDateAndTimeInputType.h:
Remove willCancelFocus, and add oldFocusedNode argument to handleFocusEvent.
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
Pass oldFocusedNode to DateTimeEditElement::focusByOwner if the
direction is FocusDirectionNone.

* html/shadow/DateTimeEditElement.h:
(DateTimeEditElement): Add oldFocusedNode argument to focusByOwner.
* html/shadow/DateTimeEditElement.cpp:
If oldFocusedNode is one of sub-fields, focus on it again.


* fast/forms/time-multiple-fields/time-multiple-fields-focus-expected.txt:
* fast/forms/time-multiple-fields/time-multiple-fields-focus.html:
Add test to click a delimiter.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
 16 files changed, 118 insertions(+), 45 deletions(-)
Comment 8 Nils Barth 2013-02-12 01:02:19 PST
(In reply to comment #7)
> Created an attachment (id=187803) [details]

Sorry sorry -- webkit-patch accidentally uploaded to wrong bug number.
Please ignore.