Bug 162806 - [iOS] Allow sequence<Touch> input in TouchEvent constructor
Summary: [iOS] Allow sequence<Touch> input in TouchEvent constructor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar, WebExposed
Depends on:
Blocks: 147740
  Show dependency treegraph
 
Reported: 2016-09-30 13:55 PDT by Chris Dumez
Modified: 2016-09-30 15:24 PDT (History)
9 users (show)

See Also:


Attachments
Patch (4.95 KB, patch)
2016-09-30 14:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-09-30 13:55:23 PDT
Allow sequence<Touch> input in TouchEvent constructor in addition to TouchList object. It is convenient for developers to pass arrays of Touch objects.
Comment 1 Chris Dumez 2016-09-30 13:55:40 PDT
<rdar://problem/28566429>
Comment 2 Chris Dumez 2016-09-30 14:46:32 PDT
Created attachment 290388 [details]
Patch
Comment 3 Ryosuke Niwa 2016-09-30 15:01:10 PDT
Can't we do this by just overloading constructors instead?
Comment 4 Chris Dumez 2016-09-30 15:21:07 PDT
(In reply to comment #3)
> Can't we do this by just overloading constructors instead?

Not really, the constructor looks like so:

dictionary TouchEventInit : EventModifierInit {
    TouchList touches;
    TouchList targetTouches;
    TouchList changedTouches;
};

[Constructor(DOMString type, optional TouchEventInit eventInitDict)]

I think the clean way (once we support union) and once we use proper constructors for event interfaces (instead of [ConstructorTemplate=Event] / [InitializedByEventConstructor]) would be:

dictionary TouchEventInit : EventModifierInit {
    (TouchList or sequence<Touch>) touches = [];
    (TouchList or sequence<Touch>) targetTouches = [];
    (TouchList or sequence<Touch>) changedTouches = [];
};

But we do not support unions just yet.
Comment 5 Chris Dumez 2016-09-30 15:24:23 PDT
Comment on attachment 290388 [details]
Patch

Clearing flags on attachment: 290388

Committed r206681: <http://trac.webkit.org/changeset/206681>
Comment 6 Chris Dumez 2016-09-30 15:24:29 PDT
All reviewed patches have been landed.  Closing bug.