Bug 94238 - [chromium] Add additional fields to WebGestureEvent
Summary: [chromium] Add additional fields to WebGestureEvent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rick Byers
URL:
Keywords:
Depends on:
Blocks: 93123
  Show dependency treegraph
 
Reported: 2012-08-16 12:39 PDT by Rick Byers
Modified: 2019-02-06 09:18 PST (History)
7 users (show)

See Also:


Attachments
Patch (3.00 KB, patch)
2012-08-16 13:08 PDT, Rick Byers
no flags Details | Formatted Diff | Diff
Patch (3.20 KB, patch)
2012-08-19 07:48 PDT, Rick Byers
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Byers 2012-08-16 12:39:51 PDT
To fix bug 93123, we're going to add a few gesture-type-specific fields to WebGestureEvent and PlatformGestureEvent.
The first step is to add these new fields to WebGestureEvent so that chromium can start setting them (redundantly with deltaX/deltaY temporarily).  Only once chromium is writing to the new fields, can I submit a CL to stop overloading deltaX/deltaY.
Comment 1 Rick Byers 2012-08-16 13:08:43 PDT
Created attachment 158882 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-16 13:14:00 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Adam Barth 2012-08-16 13:33:45 PDT
Thanks.
Comment 4 James Robinson 2012-08-16 13:34:06 PDT
What about using a union instead of growing the type's size even further, if these fields don't overlap?
Comment 5 Adam Barth 2012-08-16 13:37:57 PDT
rjkroege, should we respond to jamesr's question before landing the patch?
Comment 6 Rick Byers 2012-08-16 13:40:14 PDT
(In reply to comment #4)
> What about using a union instead of growing the type's size even further, if these fields don't overlap?

See bug 93123 - abarth@ said to prefer adding more fields over a union.  I did a bunch of measurements to confirm that the performance impact (even with 1024 new fields) is negligible.
Comment 7 Robert Kroeger 2012-08-16 13:46:01 PDT
abarth@ jamesr@: Sorry for being too eager. Fixed.
Comment 8 Rick Byers 2012-08-16 13:47:44 PDT
Also note that we don't use a union anywhere else in WebInputEvent.h.  For example, WebMouseEvent has a clickCount field that's only used for some event types (MouseDown, MouseUp, Click).

I also need to update PlatformGestureEvent.  I don't see a lot of unions in WebCore code, I wasn't sure if they were frowned upon.  The cleaner option is to have a bunch of sub-classes, but that adds a lot of complexity for almost no practical benefit.
Comment 9 James Robinson 2012-08-16 14:21:07 PDT
Subclasses are the same as unions practically speaking, just a different way to spell it.  It's not a huge difference - but it does add up.  Piling on extra fields is OK, but IMO it's sloppy coding.
Comment 10 Rick Byers 2012-08-16 14:50:05 PDT
(In reply to comment #9)
> Subclasses are the same as unions practically speaking, just a different way to spell it.  

I agree (although in practice the difference in the amount of code, and likelihood of accidentally violating type safety can be quite different).

> It's not a huge difference - but it does add up.  Piling on extra fields is OK, but IMO it's sloppy coding.

It's up to you and abarth - I'm happy to take whichever approach you guys agree is better.  Unions (or subclassing) was our first plan.  After doing the perf measurements, I can't help but find myself thinking the shorter/simpler code is a better trade-off.  IMHO a simpler but more wasteful approach isn't always sloppiness if an explicit cost/benefit trade-off is being made.

Anyway, like I said - let me know which approach you guys believe is better.
Comment 11 Adam Barth 2012-08-18 22:45:15 PDT
I don't think it's a big deal one way or another.  I'm happy to defer to James here if he feels strongly.  I suspect it's not an issue we should get hung up on one way or another.
Comment 12 Rick Byers 2012-08-19 07:45:51 PDT
(In reply to comment #11)
> I don't think it's a big deal one way or another.  I'm happy to defer to James here if he feels strongly.  I suspect it's not an issue we should get hung up on one way or another.

Agreed.  It may be more contentious for PlatformGestureEvent, but there's no reason we need to choose the same solution there.  It's trivial to use a union here in WebGestureEvent.  Patch forthcoming.
Comment 13 Rick Byers 2012-08-19 07:48:14 PDT
Created attachment 159294 [details]
Patch
Comment 14 James Robinson 2012-08-19 12:11:32 PDT
Comment on attachment 159294 [details]
Patch

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

> Source/WebKit/chromium/src/WebInputEvent.cpp:63
> +    int gestureData[14];

this size growth is temporary, right?
Comment 15 WebKit Review Bot 2012-08-19 12:49:33 PDT
Comment on attachment 159294 [details]
Patch

Clearing flags on attachment: 159294

Committed r125981: <http://trac.webkit.org/changeset/125981>
Comment 16 WebKit Review Bot 2012-08-19 12:49:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Rick Byers 2012-08-19 19:00:20 PDT
Thanks James.

(In reply to comment #14)
> (From update of attachment 159294 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=159294&action=review
> 
> > Source/WebKit/chromium/src/WebInputEvent.cpp:63
> > +    int gestureData[14];
> 
> this size growth is temporary, right?

Yes, by simplifying the bounding box stuff (x/y was unused) I'll get this down to 8 once I update chromium.
Comment 18 James Robinson 2012-08-19 20:32:13 PDT
OK great! Feel free to CC me on the chromium patches if you need any reviews on that side.
Comment 19 Lucas Forschler 2019-02-06 09:18:25 PST
Mass move bugs into the DOM component.