Bug 42441

Summary: <input type=number> UI: Support wheel event
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, dglazkov, ojan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 27968    
Attachments:
Description Flags
Patch
none
Patch 2 none

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.