Bug 42441 - <input type=number> UI: Support wheel event
Summary: <input type=number> UI: Support wheel event
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks: 27968
  Show dependency treegraph
 
Reported: 2010-07-16 01:46 PDT by Kent Tamura
Modified: 2010-08-03 19:10 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.96 KB, patch)
2010-07-16 01:49 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 2 (5.40 KB, patch)
2010-07-22 22:30 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2010-07-16 01:46:47 PDT
<input type=number> UI: Support wheel event
Comment 1 Kent Tamura 2010-07-16 01:49:58 PDT
Created attachment 61780 [details]
Patch
Comment 2 Ojan Vafai 2010-07-22 15:58:53 PDT
Comment on attachment 61780 [details]
Patch

Is it possible to add a layout test for this? If not, can you add a manual test?
Comment 3 Kent Tamura 2010-07-22 22:21:47 PDT
> Is it possible to add a layout test for this? If not, can you add a manual test?

I thought we didn't have a way to produce wheel events with eventSender.  But it is not needed.  We can produce it by document.createEvent('WheelEvent').initWebKitWheelEvent().
Comment 4 Kent Tamura 2010-07-22 22:30:44 PDT
Created attachment 62382 [details]
Patch 2
Comment 5 Ojan Vafai 2010-08-03 11:38:56 PDT
Comment on attachment 62382 [details]
Patch 2

> +++ b/LayoutTests/fast/forms/script-tests/input-number-wheel.js
> @@ -0,0 +1,31 @@
> +description('Test for wheel operations for &lt;input type=number>');
> +var parent = document.createElement('div');
> +document.body.appendChild(parent);
> +parent.innerHTML = '<input type=number id=number value=0>';

No need for parent. Can just do the following, no?
document.body.innerHTML = '<input type=number id=number value=0>';

> +var input = document.getElementById('number');
> +input.focus();
> +
> +function dispatchWheelEvent(element, deltaX, deltaY) {

open bracket should be on the following line.

> +    var event = document.createEvent('WheelEvent');
> +    var DontCare = 0;

Should be camelCase (i.e. dontCare).
Comment 6 Kent Tamura 2010-08-03 19:09:37 PDT
Landed as r64616.

(In reply to comment #5)
> (From update of attachment 62382 [details])
> > +++ b/LayoutTests/fast/forms/script-tests/input-number-wheel.js
> > @@ -0,0 +1,31 @@
> > +description('Test for wheel operations for &lt;input type=number>');
> > +var parent = document.createElement('div');
> > +document.body.appendChild(parent);
> > +parent.innerHTML = '<input type=number id=number value=0>';
> 
> No need for parent. Can just do the following, no?
> document.body.innerHTML = '<input type=number id=number value=0>';

It doesn't work.  documet.body has other elements for description, console, scripts.

> > +function dispatchWheelEvent(element, deltaX, deltaY) {
> open bracket should be on the following line.
> 
> > +    var event = document.createEvent('WheelEvent');
> > +    var DontCare = 0;
> 
> Should be camelCase (i.e. dontCare).


Fixed them.  We don't have a standard style for JavaScript, but we had better follow C++ style.