Bug 35691 - [Chromium] Adding new platform types for touch events and touch points.
Summary: [Chromium] Adding new platform types for touch events and touch points.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Enhancement
Assignee: Garret Kelly
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-03 10:56 PST by Garret Kelly
Modified: 2010-03-04 00:01 PST (History)
2 users (show)

See Also:


Attachments
Initial patch (4.67 KB, patch)
2010-03-03 10:57 PST, Garret Kelly
no flags Details | Formatted Diff | Diff
Removed extraneous include (4.65 KB, patch)
2010-03-03 11:11 PST, Garret Kelly
fishd: review-
Details | Formatted Diff | Diff
Review fixes (4.59 KB, patch)
2010-03-03 13:59 PST, Garret Kelly
no flags Details | Formatted Diff | Diff
Second-round review fixes (4.60 KB, patch)
2010-03-03 15:52 PST, Garret Kelly
fishd: review-
Details | Formatted Diff | Diff
Third-round review fixes (4.54 KB, patch)
2010-03-03 16:03 PST, Garret Kelly
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Garret Kelly 2010-03-03 10:56:12 PST
The Chromium WebKit needs the requisite platform types to allow for touch events to be transferred into WebKit, which this feature adds. This is the first of several patches to incorporate touch event support into Chromium.
Comment 1 Garret Kelly 2010-03-03 10:57:47 PST
Created attachment 49921 [details]
Initial patch
Comment 2 Garret Kelly 2010-03-03 11:11:12 PST
Created attachment 49923 [details]
Removed extraneous include
Comment 3 Darin Fisher (:fishd, Google) 2010-03-03 13:31:23 PST
Comment on attachment 49923 [details]
Removed extraneous include

> +++ b/WebKit/chromium/public/WebInputEvent.h
>  
> +// WebTouchEvent --------------------------------------------------------------
> +
> +class WebTouchEvent : public WebInputEvent {
> +public:
> +    static const int touchPointCountCap = 4;

nit: CountCap -> LengthCap for consistency with WebKeyboardEvent


> +
> +    int modifiers;
> +    int touchPointCount;
> +    WebTouchPoint touchPoints[touchPointCountCap];

Is touchPointCount necessary?  Perhaps you could use
touchPoints[i].state == WebTouchPoint::Undefined as
an array terminator instead?

WebInputEvent already defines a modifiers member var,
so I'm surprised to see it repeated here.


> +++ b/WebKit/chromium/public/WebTouchPoint.h
...
> +#include <string.h>

^^^ this include seems unnecessary


> +namespace WebKit {
> +
> +class WebTouchPoint {
> +public:
> +    WebTouchPoint()
> +        : id(0)
> +        , state(Undefined)
> +        , screenPosition(0, 0)
> +        , position(0, 0) { }
> +
> +    enum State {
> +        Undefined,
> +        TouchReleased,
> +        TouchPressed,
> +        TouchMoved,
> +        TouchStationary,
> +        TouchCancelled,

How about StateReleased, StatePressed, etc. to better
match the name of the enum?

Since these enum values will primarily be written w/
the WebTouchPoint prefix, it seems unnecessary to have
the word "Touch" in the names of the enum values.
Comment 4 Garret Kelly 2010-03-03 13:58:32 PST
(In reply to comment #3)
> (From update of attachment 49923 [details])
> > +++ b/WebKit/chromium/public/WebInputEvent.h
> >  
> > +// WebTouchEvent --------------------------------------------------------------
> > +
> > +class WebTouchEvent : public WebInputEvent {
> > +public:
> > +    static const int touchPointCountCap = 4;
> 
> nit: CountCap -> LengthCap for consistency with WebKeyboardEvent

Done.

> 
> > +
> > +    int modifiers;
> > +    int touchPointCount;
> > +    WebTouchPoint touchPoints[touchPointCountCap];
> 
> Is touchPointCount necessary?  Perhaps you could use
> touchPoints[i].state == WebTouchPoint::Undefined as
> an array terminator instead?

That'd require using up a WebTouchPoint entry in the array just to indicate the total length. For the sake of space it seems better to stick with the touchPointCount.

> WebInputEvent already defines a modifiers member var,
> so I'm surprised to see it repeated here.

Removed.

> 
> > +++ b/WebKit/chromium/public/WebTouchPoint.h
> ...
> > +#include <string.h>
> 
> ^^^ this include seems unnecessary

Entirely. I'm baffled as to why I put that there. Removed. :)

> 
> > +namespace WebKit {
> > +
> > +class WebTouchPoint {
> > +public:
> > +    WebTouchPoint()
> > +        : id(0)
> > +        , state(Undefined)
> > +        , screenPosition(0, 0)
> > +        , position(0, 0) { }
> > +
> > +    enum State {
> > +        Undefined,
> > +        TouchReleased,
> > +        TouchPressed,
> > +        TouchMoved,
> > +        TouchStationary,
> > +        TouchCancelled,
> 
> How about StateReleased, StatePressed, etc. to better
> match the name of the enum?
> 
> Since these enum values will primarily be written w/
> the WebTouchPoint prefix, it seems unnecessary to have
> the word "Touch" in the names of the enum values.

Very sensible. Done. Also renamed Undefined -> StateUndefined.

Thank you very much for the comments. :)
Comment 5 Garret Kelly 2010-03-03 13:59:31 PST
Created attachment 49942 [details]
Review fixes
Comment 6 Darin Fisher (:fishd, Google) 2010-03-03 15:34:21 PST
What it the use case for StateUndefined if not to terminate the array?  Can you have a WebTouchPoint that is undefined and have the other fields contain meaningful data?  It is OK to have the terminator be optional.  All fields could contain data, or some of them could contain StateUndefined to indicate that they are unused.  Maybe that is less clear though.
Comment 7 Garret Kelly 2010-03-03 15:52:43 PST
Created attachment 49958 [details]
Second-round review fixes
Comment 8 Darin Fisher (:fishd, Google) 2010-03-03 15:56:03 PST
Comment on attachment 49958 [details]
Second-round review fixes

> +class WebTouchPoint {
> +public:
> +    WebTouchPoint()
> +        : id(0)
> +        , state(StateUndefined)
> +        , screenPosition(0, 0)
> +        , position(0, 0) { }

minor nit: no need to initialize a WebPoint explicitly.  just let
the default constructor do its thing.

otherwise, r=me
Comment 9 Garret Kelly 2010-03-03 16:03:15 PST
Created attachment 49959 [details]
Third-round review fixes
Comment 10 WebKit Commit Bot 2010-03-04 00:01:45 PST
Comment on attachment 49959 [details]
Third-round review fixes

Clearing flags on attachment: 49959

Committed r55507: <http://trac.webkit.org/changeset/55507>
Comment 11 WebKit Commit Bot 2010-03-04 00:01:50 PST
All reviewed patches have been landed.  Closing bug.