| 1 | /* |
| 2 | * Copyright 2009 Closure Compiler Authors |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | /** |
| 17 | * @fileoverview Definitions for all iPhone extensions. Created from: |
| 18 | * http://developer.apple.com/library/safari/navigation/ |
| 19 | * |
| 20 | * @externs |
| 21 | * @author [email protected] (Andrew Grieve) |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * The Touch class represents a single touch on the surface. A touch is the |
| 26 | * presence or movement of a finger that is part of a unique multi-touch |
| 27 | * sequence. |
| 28 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchClassReference/Touch/Touch.html |
| 29 | * @constructor |
| 30 | */ |
| 31 | function Touch() {} |
| 32 | |
| 33 | /** |
| 34 | * The x-coordinate of the touch's location relative to the window's viewport. |
| 35 | * @type {number} |
| 36 | */ |
| 37 | Touch.prototype.clientX; |
| 38 | |
| 39 | /** |
| 40 | * The y-coordinate of the touch's location relative to the window's viewport. |
| 41 | * @type {number} |
| 42 | */ |
| 43 | Touch.prototype.clientY; |
| 44 | |
| 45 | /** |
| 46 | * The unique identifier for this touch object. |
| 47 | * @type {number} |
| 48 | */ |
| 49 | Touch.prototype.identifier; |
| 50 | |
| 51 | /** |
| 52 | * The x-coordinate of the touch's location in page coordinates. |
| 53 | * @type {number} |
| 54 | */ |
| 55 | Touch.prototype.pageX; |
| 56 | |
| 57 | /** |
| 58 | * The y-coordinate of the touch's location in page coordinates. |
| 59 | * @type {number} |
| 60 | */ |
| 61 | Touch.prototype.pageY; |
| 62 | |
| 63 | /** |
| 64 | * The x-coordinate of the touch's location in screen coordinates. |
| 65 | * @type {number} |
| 66 | */ |
| 67 | Touch.prototype.screenX; |
| 68 | |
| 69 | /** |
| 70 | * The y-coordinate of the touch's location in screen coordinates. |
| 71 | * @type {number} |
| 72 | */ |
| 73 | Touch.prototype.screenY; |
| 74 | |
| 75 | /** |
| 76 | * The target of this touch. |
| 77 | * @type {EventTarget} |
| 78 | */ |
| 79 | Touch.prototype.target; |
| 80 | |
| 81 | /** |
| 82 | * Creates a new Touch object. |
| 83 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html#//apple_ref/javascript/instm/Document/createTouch |
| 84 | * @param {Window} view |
| 85 | * @param {EventTarget} target |
| 86 | * @param {number} identifier |
| 87 | * @param {number} pageX |
| 88 | * @param {number} pageY |
| 89 | * @param {number} screenX |
| 90 | * @param {number} screenY |
| 91 | * @return {Touch} |
| 92 | */ |
| 93 | Document.prototype.createTouch = function(view, target, identifier, pageX, |
| 94 | pageY, screenX, screenY) {}; |
| 95 | |
| 96 | /** |
| 97 | * The TouchList class is used to represent a collection of Touch objects. |
| 98 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchListClassReference/TouchList/TouchList.html |
| 99 | * @constructor |
| 100 | */ |
| 101 | function TouchList() {} |
| 102 | |
| 103 | /** |
| 104 | * The number of Touch objects in this TouchList object. |
| 105 | * @type {number} |
| 106 | */ |
| 107 | TouchList.prototype.length; |
| 108 | |
| 109 | /** |
| 110 | * Returns the Touch object at the given index. |
| 111 | * @param {number} index |
| 112 | * @return {!Touch} |
| 113 | */ |
| 114 | TouchList.prototype.item = function(index) {}; |
| 115 | |
| 116 | /** |
| 117 | * Creates a new TouchList object. |
| 118 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html#//apple_ref/javascript/instm/Document/createTouchList |
| 119 | * @param {Array.<Touch>} touches |
| 120 | * @return {TouchList} |
| 121 | */ |
| 122 | Document.prototype.createTouchList = function(touches) {}; |
| 123 | |
| 124 | /** |
| 125 | * The TouchEvent class encapsulates information about a touch event. |
| 126 | * |
| 127 | * <p>The system continually sends TouchEvent objects to an application as |
| 128 | * fingers touch and move across a surface. A touch event provides a snapshot of |
| 129 | * all touches during a multi-touch sequence, most importantly the touches that |
| 130 | * are new or have changed for a particular target. A multi-touch sequence |
| 131 | * begins when a finger first touches the surface. Other fingers may |
| 132 | * subsequently touch the surface, and all fingers may move across the surface. |
| 133 | * The sequence ends when the last of these fingers is lifted from the surface. |
| 134 | * An application receives touch event objects during each phase of any touch. |
| 135 | * </p> |
| 136 | * |
| 137 | * <p>The different types of TouchEvent objects that can occur are: |
| 138 | * <ul> |
| 139 | * <li>touchstart - Sent when a finger for a given event touches the surface. |
| 140 | * <li>touchmove - Sent when a given event moves on the surface. |
| 141 | * <li>touchend - Sent when a given event lifts from the surface. |
| 142 | * <li>touchcancel - Sent when the system cancels tracking for the touch. |
| 143 | * </ul> |
| 144 | * TouchEvent objects are combined together to form high-level GestureEvent |
| 145 | * objects that are also sent during a multi-touch sequence.</p> |
| 146 | * |
| 147 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html |
| 148 | * @extends {UIEvent} |
| 149 | * @constructor |
| 150 | */ |
| 151 | function TouchEvent() {} |
| 152 | |
| 153 | /** |
| 154 | * A collection of Touch objects representing all touches associated with this |
| 155 | * target. |
| 156 | * @type {TouchList} |
| 157 | */ |
| 158 | TouchEvent.prototype.touches; |
| 159 | |
| 160 | /** |
| 161 | * A collection of Touch objects representing all touches associated with this |
| 162 | * target. |
| 163 | * @type {TouchList} |
| 164 | */ |
| 165 | TouchEvent.prototype.targetTouches; |
| 166 | |
| 167 | /** |
| 168 | * A collection of Touch objects representing all touches that changed in this event. |
| 169 | * @type {TouchList} |
| 170 | */ |
| 171 | TouchEvent.prototype.changedTouches; |
| 172 | |
| 173 | /** |
| 174 | * The distance between two fingers since the start of an event as a multiplier |
| 175 | * of the initial distance. The initial value is 1.0. If less than 1.0, the |
| 176 | * gesture is pinch close (to zoom out). If greater than 1.0, the gesture is |
| 177 | * pinch open (to zoom in). |
| 178 | * @type {number} |
| 179 | */ |
| 180 | TouchEvent.prototype.scale; |
| 181 | |
| 182 | /** |
| 183 | * The delta rotation since the start of an event, in degrees, where clockwise |
| 184 | * is positive and counter-clockwise is negative. The initial value is 0.0. |
| 185 | * @type {number} |
| 186 | */ |
| 187 | TouchEvent.prototype.rotation; |
| 188 | |
| 189 | /** |
| 190 | * Initializes a newly created TouchEvent object. |
| 191 | * @param {string} type |
| 192 | * @param {boolean} canBubble |
| 193 | * @param {boolean} cancelable |
| 194 | * @param {Window} view |
| 195 | * @param {number} detail |
| 196 | * @param {number} screenX |
| 197 | * @param {number} screenY |
| 198 | * @param {number} clientX |
| 199 | * @param {number} clientY |
| 200 | * @param {boolean} ctrlKey |
| 201 | * @param {boolean} altKey |
| 202 | * @param {boolean} shiftKey |
| 203 | * @param {boolean} metaKey |
| 204 | * @param {TouchList} touches |
| 205 | * @param {TouchList} targetTouches |
| 206 | * @param {TouchList} changedTouches |
| 207 | * @param {number} scale |
| 208 | * @param {number} rotation |
| 209 | */ |
| 210 | TouchEvent.prototype.initTouchEvent = function(type, canBubble, cancelable, |
| 211 | view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
| 212 | metaKey, touches, targetTouches, changedTouches, scale, rotation) {}; |
| 213 | |
| 214 | /** |
| 215 | * The GestureEvent class encapsulates information about a multi-touch gesture. |
| 216 | * |
| 217 | * GestureEvent objects are high-level events that encapsulate the low-level |
| 218 | * TouchEvent objects. Both GestureEvent and TouchEvent events are sent during |
| 219 | * a multi-touch sequence. Gesture events contain scaling and rotation |
| 220 | * information allowing gestures to be combined, if supported by the platform. |
| 221 | * If not supported, one gesture ends before another starts. Listen for |
| 222 | * GestureEvent events if you want to respond to gestures only, not process |
| 223 | * the low-level TouchEvent objects. |
| 224 | * |
| 225 | * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/GestureEvent/GestureEvent.html |
| 226 | * @extends {UIEvent} |
| 227 | * @constructor |
| 228 | */ |
| 229 | function GestureEvent() {} |
| 230 | |
| 231 | /** |
| 232 | * The distance between two fingers since the start of an event as a multiplier |
| 233 | * of the initial distance. The initial value is 1.0. If less than 1.0, the |
| 234 | * gesture is pinch close (to zoom out). If greater than 1.0, the gesture is |
| 235 | * pinch open (to zoom in). |
| 236 | * @type {number} |
| 237 | */ |
| 238 | GestureEvent.prototype.scale; |
| 239 | |
| 240 | /** |
| 241 | * The delta rotation since the start of an event, in degrees, where clockwise |
| 242 | * is positive and counter-clockwise is negative. The initial value is 0.0. |
| 243 | * @type {number} |
| 244 | */ |
| 245 | GestureEvent.prototype.rotation; |
| 246 | |
| 247 | /** |
| 248 | * The target of this gesture. |
| 249 | * @type {EventTarget} |
| 250 | */ |
| 251 | GestureEvent.prototype.target; |
| 252 | |
| 253 | /** |
| 254 | * Initializes a newly created GestureEvent object. |
| 255 | * @param {string} type |
| 256 | * @param {boolean} canBubble |
| 257 | * @param {boolean} cancelable |
| 258 | * @param {Window} view |
| 259 | * @param {number} detail |
| 260 | * @param {number} screenX |
| 261 | * @param {number} screenY |
| 262 | * @param {number} clientX |
| 263 | * @param {number} clientY |
| 264 | * @param {boolean} ctrlKey |
| 265 | * @param {boolean} altKey |
| 266 | * @param {boolean} shiftKey |
| 267 | * @param {boolean} metaKey |
| 268 | * @param {EventTarget} target |
| 269 | * @param {number} scale |
| 270 | * @param {number} rotation |
| 271 | */ |
| 272 | GestureEvent.prototype.initGestureEvent = function(type, canBubble, cancelable, |
| 273 | view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
| 274 | metaKey, target, scale, rotation) {}; |
| 275 | |
| 276 | /** |
| 277 | * Specifies the JavaScript method to invoke when the system cancels tracking |
| 278 | * for the touch. |
| 279 | * @type {?function(!TouchEvent)} |
| 280 | */ |
| 281 | Element.prototype.ontouchcancel = function(e) {}; |
| 282 | |
| 283 | /** |
| 284 | * Specifies the JavaScript method to invoke when a given event lifts from the |
| 285 | * surface. |
| 286 | * @type {?function(!TouchEvent)} |
| 287 | */ |
| 288 | Element.prototype.ontouchend = function(e) {}; |
| 289 | |
| 290 | /** |
| 291 | * Specifies the JavaScript method to invoke when a finger for a given event |
| 292 | * moves on the surface. |
| 293 | * @type {?function(!TouchEvent)} |
| 294 | */ |
| 295 | Element.prototype.ontouchmove = function(e) {}; |
| 296 | |
| 297 | /** |
| 298 | * Specifies the JavaScript method to invoke when a finger for a given event |
| 299 | * touches the surface. |
| 300 | * @type {?function(!TouchEvent)} |
| 301 | */ |
| 302 | Element.prototype.ontouchstart = function(e) {}; |
| 303 | |
| 304 | /** |
| 305 | * Specifies the JavaScript method to invoke when a gesture is started by |
| 306 | * two or more fingers touching the surface. |
| 307 | * @type {?function(!GestureEvent)} |
| 308 | */ |
| 309 | Element.prototype.ongesturestart = function(e) {}; |
| 310 | |
| 311 | /** |
| 312 | * Specifies the JavaScript method to invoke when fingers are moved during a |
| 313 | * gesture. |
| 314 | * @type {?function(!GestureEvent)} |
| 315 | */ |
| 316 | Element.prototype.ongesturechange = function(e) {}; |
| 317 | |
| 318 | /** |
| 319 | * Specifies the JavaScript method to invoke when a gesture ends (when there are |
| 320 | * 0 or 1 fingers touching the surface). |
| 321 | * @type {?function(!GestureEvent)} |
| 322 | */ |
| 323 | Element.prototype.ongestureend = function(e) {}; |
| 324 | |
| 325 | /** |
| 326 | * Specifies the JavaScript method to invoke when the browser device's |
| 327 | * orientation changes, i.e.the device is rotated. |
| 328 | * @type {?function(!Event)} |
| 329 | * @see http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html |
| 330 | */ |
| 331 | Window.prototype.onorientationchange = function(e) {}; |
| 332 | |
| 333 | /** |
| 334 | * Returns the orientation of the browser's device, one of [-90, 0, 90, 180]. |
| 335 | * @type {number} |
| 336 | * @see http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html |
| 337 | */ |
| 338 | Window.prototype.orientation; |
| 339 | |
| 340 | /** |
| 341 | * @implicitCast |
| 342 | * @type {boolean} |
| 343 | */ |
| 344 | HTMLInputElement.prototype.autocorrect; |
| 345 | |
| 346 | /** |
| 347 | * @implicitCast |
| 348 | * @type {boolean} |
| 349 | */ |
| 350 | HTMLInputElement.prototype.autocapitalize; |
| 351 | |
| 352 | /** |
| 353 | * @implicitCast |
| 354 | * @type {boolean} |
| 355 | */ |
| 356 | HTMLTextAreaElement.prototype.autocorrect; |
| 357 | |
| 358 | /** |
| 359 | * @implicitCast |
| 360 | * @type {boolean} |
| 361 | */ |
| 362 | HTMLTextAreaElement.prototype.autocapitalize; |