Skip to content

Commit

Permalink
update touch event spec
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz committed Apr 5, 2017
1 parent 668ce45 commit 52e173d
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 32 deletions.
42 changes: 40 additions & 2 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,27 @@ interface SVGBoundingBoxOptions {
clipped?: boolean;
}

interface TouchInit {
identifier?: number;
target?: EventTarget;
clientX?: number;
clientY?: number;
screenX?: number;
screenY?: number;
pageX?: number;
pageY?: number;
radiusX?: number;
radiusY?: number;
rotationAngle?: number;
force?: number;
}

interface TouchEventInit extends EventModifierInit {
touches?: Touch[];
targetTouches?: Touch[];
changedTouches?: Touch[];
}

interface UIEventInit extends EventInit {
view?: Window;
detail?: number;
Expand Down Expand Up @@ -2468,6 +2489,7 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
createEvent(eventInterface:"SpeechSynthesisEvent"): SpeechSynthesisEvent;
createEvent(eventInterface:"StorageEvent"): StorageEvent;
createEvent(eventInterface:"SyncEvent"): SyncEvent;
createEvent(eventInterface:"TouchEvent"): TouchEvent;
createEvent(eventInterface:"TrackEvent"): TrackEvent;
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
createEvent(eventInterface:"UIEvent"): UIEvent;
Expand Down Expand Up @@ -9597,11 +9619,15 @@ interface Touch {
readonly clientY: number;
readonly pageX: number;
readonly pageY: number;
readonly radiusX: number;
readonly radiusY: number;
readonly rotationAngle: number;
readonly force: number;
}

declare var Touch: {
prototype: Touch;
new (): Touch;
new (touchInitDict: TouchInit): Touch;
}

interface TouchList {
Expand All @@ -9627,7 +9653,7 @@ interface TouchEvent extends UIEvent {

declare var TouchEvent: {
prototype: TouchEvent;
new (): TouchEvent;
new (type: string, eventInitDict?: TouchEventInit): TouchEvent;
}

interface UIEvent extends Event {
Expand Down Expand Up @@ -11731,6 +11757,10 @@ interface GlobalEventHandlersEventMap {
"pointerleave": Event;
"selectstart": Event;
"selectionchange": Event;
"touchstart": TouchEvent;
"touchend": TouchEvent;
"touchmove": TouchEvent;
"touchcancel": TouchEvent;
}

interface GlobalEventHandlers {
Expand Down Expand Up @@ -11814,6 +11844,10 @@ interface GlobalEventHandlers {
onpointerleave: (this: GlobalEventHandlers, ev: Event) => any;
onselectstart: (this: GlobalEventHandlers, ev: Event) => any;
onselectionchange: (this: GlobalEventHandlers, ev: Event) => any;
ontouchstart: (this: GlobalEventHandlers, ev: TouchEvent) => any;
ontouchend: (this: GlobalEventHandlers, ev: TouchEvent) => any;
ontouchmove: (this: GlobalEventHandlers, ev: TouchEvent) => any;
ontouchcancel: (this: GlobalEventHandlers, ev: TouchEvent) => any;
addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
Expand Down Expand Up @@ -12881,6 +12915,10 @@ declare var onpointerenter: (this: Window, ev: Event) => any;
declare var onpointerleave: (this: Window, ev: Event) => any;
declare var onselectstart: (this: Window, ev: Event) => any;
declare var onselectionchange: (this: Window, ev: Event) => any;
declare var ontouchstart: (this: Window, ev: TouchEvent) => any;
declare var ontouchend: (this: Window, ev: TouchEvent) => any;
declare var ontouchmove: (this: Window, ev: TouchEvent) => any;
declare var ontouchcancel: (this: Window, ev: TouchEvent) => any;
declare var onafterprint: (this: Window, ev: Event) => any;
declare var onbeforeprint: (this: Window, ev: Event) => any;
declare var onbeforeunload: OnBeforeUnloadEventHandler;
Expand Down
62 changes: 52 additions & 10 deletions inputfiles/browser.webidl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,29 @@
<member name="clipped" default="false" type="boolean"/>
</members>
</dictionary>
<dictionary name="TouchInit" extends="Object">
<members>
<member name="identifier" type="long" required="1"/>
<member name="target" type="EventTarget" required="1"/>
<member name="clientX" default="0" type="double"/>
<member name="clientY" default="0" type="double"/>
<member name="screenX" default="0" type="double"/>
<member name="screenY" default="0" type="double"/>
<member name="pageX" default="0" type="double"/>
<member name="pageY" default="0" type="double"/>
<member name="radiusX" default="0" type="float"/>
<member name="radiusY" default="0" type="float"/>
<member name="rotationAngle" default="0" type="float"/>
<member name="force" default="0" type="float"/>
</members>
</dictionary>
<dictionary name="TouchEventInit" extends="EventModifierInit">
<members>
<member name="touches" default="[]" type="sequence&lt;Touch&gt;"/>
<member name="targetTouches" default="[]" type="sequence&lt;Touch&gt;"/>
<member name="changedTouches" default="[]" type="sequence&lt;Touch&gt;"/>
</members>
</dictionary>
<dictionary name="UIEventInit" extends="EventInit">
<members>
<member name="view" default="null" nullable="1" type="Window"/>
Expand Down Expand Up @@ -3200,10 +3223,10 @@
<param name="view" type="WindowProxy"/>
<param name="target" type="EventTarget"/>
<param name="identifier" type="long"/>
<param name="pageX" type="long"/>
<param name="pageY" type="long"/>
<param name="screenX" type="long"/>
<param name="screenY" type="long"/>
<param name="pageX" type="double"/>
<param name="pageY" type="double"/>
<param name="screenX" type="double"/>
<param name="screenY" type="double"/>
</method>
<method name="createTouchList" type="TouchList">
<param name="touches" type="Touch" variadic="1"/>
Expand Down Expand Up @@ -8631,15 +8654,22 @@
<implements>SVGZoomAndPan</implements>
</interface>
<interface name="Touch" extends="Object">
<constructor>
<param name="touchInitDict" type="TouchInit"/>
</constructor>
<properties>
<property name="identifier" read-only="1" type="long"/>
<property name="target" read-only="1" type="EventTarget"/>
<property name="screenX" read-only="1" type="long"/>
<property name="screenY" read-only="1" type="long"/>
<property name="clientX" read-only="1" type="long"/>
<property name="clientY" read-only="1" type="long"/>
<property name="pageX" read-only="1" type="long"/>
<property name="pageY" read-only="1" type="long"/>
<property name="screenX" read-only="1" type="double"/>
<property name="screenY" read-only="1" type="double"/>
<property name="clientX" read-only="1" type="double"/>
<property name="clientY" read-only="1" type="double"/>
<property name="pageX" read-only="1" type="double"/>
<property name="pageY" read-only="1" type="double"/>
<property name="radiusX" read-only="1" type="float"/>
<property name="radiusY" read-only="1" type="float"/>
<property name="rotationAngle" read-only="1" type="float"/>
<property name="force" read-only="1" type="float"/>
</properties>
</interface>
<interface name="TouchList" extends="Object">
Expand All @@ -8653,6 +8683,10 @@
</properties>
</interface>
<interface name="TouchEvent" extends="UIEvent">
<constructor>
<param name="type" type="DOMString"/>
<param name="eventInitDict" optional="1" type="TouchEventInit"/>
</constructor>
<properties>
<property name="touches" read-only="1" type="TouchList"/>
<property name="targetTouches" read-only="1" type="TouchList"/>
Expand Down Expand Up @@ -11040,6 +11074,10 @@
<property name="onpointerleave" type="EventHandler" event-handler="pointerleave"/>
<property name="onselectstart" type="EventHandler" event-handler="selectstart"/>
<property name="onselectionchange" type="EventHandler" event-handler="selectionchange"/>
<property name="ontouchstart" type="EventHandler" event-handler="touchstart"/>
<property name="ontouchend" type="EventHandler" event-handler="touchend"/>
<property name="ontouchmove" type="EventHandler" event-handler="touchmove"/>
<property name="ontouchcancel" type="EventHandler" event-handler="touchcancel"/>
</properties>
<events>
<event name="abort" type="Event"/>
Expand Down Expand Up @@ -11113,6 +11151,10 @@
<event name="transitioncancel" type="TransitionEvent"/>
<event name="selectstart" type="Event"/>
<event name="selectionchange" type="Event"/>
<event name="touchstart" type="TouchEvent"/>
<event name="touchend" type="TouchEvent"/>
<event name="touchmove" type="TouchEvent"/>
<event name="touchcancel" type="TouchEvent"/>
</events>
</interface>
<interface name="WindowEventHandlers" extends="Object" no-interface-object="1">
Expand Down
20 changes: 0 additions & 20 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,26 +532,6 @@
"disconnect(destination: AudioParam, output?: number): void"
]
},
{
"kind": "property",
"name": "ontouchcancel",
"type": "(ev: TouchEvent) => any"
},
{
"kind": "property",
"name": "ontouchend",
"type": "(ev: TouchEvent) => any"
},
{
"kind": "property",
"name": "ontouchmove",
"type": "(ev: TouchEvent) => any"
},
{
"kind": "property",
"name": "ontouchstart",
"type": "(ev: TouchEvent) => any"
},
{
"kind": "property",
"name": "keyPath?",
Expand Down

0 comments on commit 52e173d

Please sign in to comment.