Bug 75067 - [Forms] Spin buttons of number input type should fire both input and change event
Summary: [Forms] Spin buttons of number input type should fire both input and change e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: yosin
URL: http://jsfiddle.net/Pwdzc/
Keywords:
Depends on: 75217 78873
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-21 22:13 PST by yosin
Modified: 2012-02-20 02:48 PST (History)
2 users (show)

See Also:


Attachments
Patch 1 (7.36 KB, patch)
2012-02-20 00:23 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 2 (9.31 KB, patch)
2012-02-20 01:01 PST, yosin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yosin 2011-12-21 22:13:15 PST
According to specification[1]

UA should fire input and change event when spin button of number input type clicked.

== References ==
[1] 4.10.74 Common event behaviors
  http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#common-event-behaviors

=== Excerpt ===
When the user agent changes the element's value on behalf of the user (e.g. as part of a form prefilling feature), the user agent must follow these steps:

1. If the input event applies, queue a task to fire a simple event that bubbles named input at the input element.
2. If the change event applies, queue a task to fire a simple event that bubbles named change at the input element.
Comment 1 yosin 2012-02-20 00:23:01 PST
Created attachment 127772 [details]
Patch 1
Comment 2 Kent Tamura 2012-02-20 00:34:27 PST
Comment on attachment 127772 [details]
Patch 1

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

> Source/WebCore/html/TextFieldInputType.cpp:113
> +    case DispatchInputAndChangeEvent:
> +        element()->dispatchFormControlInputEvent();
> +        element()->dispatchFormControlChangeEvent();
> +        break;
> +

dispatchFormControlInputEvent() executes a JavaScript event handler, and it might change the input type, or might delete the input element. So, we can't access any members of this and element().

You need to do:
    RefPtr<HTMLInputElement> input(element()); 
before event dispatching functions, and use 'input' instead of 'element()' after an event dispatching functions.

> LayoutTests/fast/forms/number/spin-button-events.html:23
> +if (window.layoutTestController) {
> +  testIt();
> +}

Please show a manual test instruction if there is no layoutTestControler.
Comment 3 yosin 2012-02-20 01:01:05 PST
Created attachment 127777 [details]
Patch 2
Comment 4 Kent Tamura 2012-02-20 02:15:35 PST
Comment on attachment 127777 [details]
Patch 2

ok
Comment 5 WebKit Review Bot 2012-02-20 02:48:09 PST
Comment on attachment 127777 [details]
Patch 2

Clearing flags on attachment: 127777

Committed r108228: <http://trac.webkit.org/changeset/108228>
Comment 6 WebKit Review Bot 2012-02-20 02:48:19 PST
All reviewed patches have been landed.  Closing bug.