dom/interfaces/base/nsIDOMWindowUtils.idl

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 /**
michael@0 9 * nsIDOMWindowUtils is intended for infrequently-used methods related
michael@0 10 * to the current nsIDOMWindow. Some of the methods may require
michael@0 11 * elevated privileges; the method implementations should contain the
michael@0 12 * necessary security checks. Access this interface by calling
michael@0 13 * getInterface on a DOMWindow.
michael@0 14 */
michael@0 15
michael@0 16 %{C++
michael@0 17 #include "nsColor.h"
michael@0 18 class gfxContext;
michael@0 19 class nsRect;
michael@0 20 %}
michael@0 21
michael@0 22 [ref] native nsConstRect(const nsRect);
michael@0 23 native nscolor(nscolor);
michael@0 24 [ptr] native gfxContext(gfxContext);
michael@0 25 typedef unsigned long long nsViewID;
michael@0 26
michael@0 27 interface nsICycleCollectorListener;
michael@0 28 interface nsIDOMNode;
michael@0 29 interface nsIDOMNodeList;
michael@0 30 interface nsIDOMElement;
michael@0 31 interface nsIDOMHTMLCanvasElement;
michael@0 32 interface nsIDOMEvent;
michael@0 33 interface nsITransferable;
michael@0 34 interface nsIQueryContentEventResult;
michael@0 35 interface nsIDOMWindow;
michael@0 36 interface nsIDOMBlob;
michael@0 37 interface nsIDOMFile;
michael@0 38 interface nsIFile;
michael@0 39 interface nsIDOMClientRect;
michael@0 40 interface nsIURI;
michael@0 41 interface nsIDOMEventTarget;
michael@0 42 interface nsIRunnable;
michael@0 43 interface nsICompositionStringSynthesizer;
michael@0 44 interface nsITranslationNodeList;
michael@0 45
michael@0 46 [scriptable, uuid(d4ed34fc-9c07-4cef-b9e1-623794558db3)]
michael@0 47 interface nsIDOMWindowUtils : nsISupports {
michael@0 48
michael@0 49 /**
michael@0 50 * Image animation mode of the window. When this attribute's value
michael@0 51 * is changed, the implementation should set all images in the window
michael@0 52 * to the given value. That is, when set to kDontAnimMode, all images
michael@0 53 * will stop animating. The attribute's value must be one of the
michael@0 54 * animationMode values from imgIContainer.
michael@0 55 * @note Images may individually override the window's setting after
michael@0 56 * the window's mode is set. Therefore images given different modes
michael@0 57 * since the last setting of the window's mode may behave
michael@0 58 * out of line with the window's overall mode.
michael@0 59 * @note The attribute's value is the window's overall mode. It may
michael@0 60 * for example continue to report kDontAnimMode after all images
michael@0 61 * have subsequently been individually animated.
michael@0 62 * @note Only images immediately in this window are affected;
michael@0 63 * this is not recursive to subwindows.
michael@0 64 * @see imgIContainer
michael@0 65 */
michael@0 66 attribute unsigned short imageAnimationMode;
michael@0 67
michael@0 68 /**
michael@0 69 * Whether the charset of the window's current document has been forced by
michael@0 70 * the user.
michael@0 71 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 72 */
michael@0 73 readonly attribute boolean docCharsetIsForced;
michael@0 74
michael@0 75 /**
michael@0 76 * Get current cursor type from this window
michael@0 77 * @return the current value of nsCursor
michael@0 78 */
michael@0 79 short getCursorType();
michael@0 80
michael@0 81 /**
michael@0 82 * Function to get metadata associated with the window's current document
michael@0 83 * @param aName the name of the metadata. This should be all lowercase.
michael@0 84 * @return the value of the metadata, or the empty string if it's not set
michael@0 85 *
michael@0 86 * Will throw a DOM security error if called without chrome privileges.
michael@0 87 */
michael@0 88 AString getDocumentMetadata(in AString aName);
michael@0 89
michael@0 90 /**
michael@0 91 * Force an immediate redraw of this window. The parameter specifies
michael@0 92 * the number of times to redraw, and the return value is the length,
michael@0 93 * in milliseconds, that the redraws took. If aCount is not specified
michael@0 94 * or is 0, it is taken to be 1.
michael@0 95 */
michael@0 96 unsigned long redraw([optional] in unsigned long aCount);
michael@0 97
michael@0 98 /**
michael@0 99 * Set the CSS viewport to be |widthPx| x |heightPx| in units of CSS
michael@0 100 * pixels, regardless of the size of the enclosing widget/view.
michael@0 101 * This will trigger reflow.
michael@0 102 *
michael@0 103 * The caller of this method must have chrome privileges.
michael@0 104 */
michael@0 105 void setCSSViewport(in float aWidthPx, in float aHeightPx);
michael@0 106
michael@0 107 /**
michael@0 108 * Information retrieved from the <meta name="viewport"> tag.
michael@0 109 * See nsContentUtils::GetViewportInfo for more information.
michael@0 110 */
michael@0 111 void getViewportInfo(in uint32_t aDisplayWidth, in uint32_t aDisplayHeight,
michael@0 112 out double aDefaultZoom, out boolean aAllowZoom,
michael@0 113 out double aMinZoom, out double aMaxZoom,
michael@0 114 out uint32_t aWidth, out uint32_t aHeight,
michael@0 115 out boolean aAutoSize);
michael@0 116
michael@0 117 /**
michael@0 118 * For any scrollable element, this allows you to override the
michael@0 119 * visible region and draw more than what is visible, which is
michael@0 120 * useful for asynchronous drawing. The "displayport" will be
michael@0 121 * <xPx, yPx, widthPx, heightPx> in units of CSS pixels,
michael@0 122 * regardless of the size of the enclosing container. This
michael@0 123 * will *not* trigger reflow.
michael@0 124 *
michael@0 125 * For the root scroll area, pass in the root document element.
michael@0 126 * For scrollable elements, pass in the container element (for
michael@0 127 * instance, the element with overflow: scroll).
michael@0 128 *
michael@0 129 * <x, y> is relative to the top-left of what would normally be
michael@0 130 * the visible area of the element. This means that the pixels
michael@0 131 * rendered to the displayport take scrolling into account,
michael@0 132 * for example.
michael@0 133 *
michael@0 134 * It's legal to set a displayport that extends beyond the overflow
michael@0 135 * area in any direction (left/right/top/bottom).
michael@0 136 *
michael@0 137 * It's also legal to set a displayport that extends beyond the
michael@0 138 * area's bounds. No pixels are rendered outside the area bounds.
michael@0 139 *
michael@0 140 * The caller of this method must have chrome privileges.
michael@0 141 *
michael@0 142 * Calling this will always force a recomposite, so it should be
michael@0 143 * avoided if at all possible. Client code should do checks before
michael@0 144 * calling this so that duplicate sets are not made with the same
michael@0 145 * displayport.
michael@0 146 *
michael@0 147 * aPriority is recorded along with the displayport rectangle. If this
michael@0 148 * method is called with a lower priority than the current priority, the
michael@0 149 * call is ignored.
michael@0 150 */
michael@0 151 void setDisplayPortForElement(in float aXPx, in float aYPx,
michael@0 152 in float aWidthPx, in float aHeightPx,
michael@0 153 in nsIDOMElement aElement,
michael@0 154 in uint32_t aPriority);
michael@0 155 /**
michael@0 156 * An alternate way to represent a displayport rect as a set of margins and a
michael@0 157 * base rect to apply those margins to. A consumer of pixels may ask for as
michael@0 158 * many extra pixels as it would like in each direction. Layout then sets
michael@0 159 * the base rect to the "visible rect" of the element, which is just the
michael@0 160 * subrect of the element that is drawn (it does not take in account content
michael@0 161 * covering the element).
michael@0 162 *
michael@0 163 * If both a displayport rect and displayport margins with corresponding base
michael@0 164 * rect are set with the same priority then the margins will take precendence.
michael@0 165 *
michael@0 166 * Specifying an alignment value will ensure that after the base rect has
michael@0 167 * been expanded by the displayport margins, it will be further expanded so
michael@0 168 * that each edge is located at a multiple of the "alignment" value.
michael@0 169 *
michael@0 170 * Note that both the margin values and alignment are treated as values in
michael@0 171 * LayerPixels. Refer to layout/base/Units.h for a description of this unit.
michael@0 172 * The base rect values are in app units.
michael@0 173 */
michael@0 174 void setDisplayPortMarginsForElement(in float aLeftMargin,
michael@0 175 in float aTopMargin,
michael@0 176 in float aRightMargin,
michael@0 177 in float aBottomMargin,
michael@0 178 in uint32_t aAlignmentX,
michael@0 179 in uint32_t aAlignmentY,
michael@0 180 in nsIDOMElement aElement,
michael@0 181 in uint32_t aPriority);
michael@0 182
michael@0 183 void setDisplayPortBaseForElement(in int32_t aX,
michael@0 184 in int32_t aY,
michael@0 185 in int32_t aWidth,
michael@0 186 in int32_t aHeight,
michael@0 187 in nsIDOMElement aElement);
michael@0 188
michael@0 189 /**
michael@0 190 * When a display port is set, this allows a sub-section of that
michael@0 191 * display port to be marked as 'critical'. In this scenario, the
michael@0 192 * area outside of this rectangle may be rendered at a lower
michael@0 193 * detail (for example, by reducing its resolution), or not rendered
michael@0 194 * at all under some circumstances.
michael@0 195 * This call will have no effect if a display port has not been set.
michael@0 196 */
michael@0 197 void setCriticalDisplayPortForElement(in float aXPx, in float aYPx,
michael@0 198 in float aWidthPx, in float aHeightPx,
michael@0 199 in nsIDOMElement aElement);
michael@0 200
michael@0 201 /**
michael@0 202 * Get/set the resolution at which rescalable web content is drawn.
michael@0 203 * Currently this is only (some) thebes content.
michael@0 204 *
michael@0 205 * Setting a new resolution does *not* trigger reflow. This API is
michael@0 206 * entirely separate from textZoom and fullZoom; a resolution scale
michael@0 207 * can be applied together with both textZoom and fullZoom.
michael@0 208 *
michael@0 209 * The effect of is API for gfx code to allocate more or fewer
michael@0 210 * pixels for rescalable content by a factor of |resolution| in
michael@0 211 * either or both dimensions. setResolution() together with
michael@0 212 * setDisplayport() can be used to implement a non-reflowing
michael@0 213 * scale-zoom in concert with another entity that can draw with a
michael@0 214 * scale. For example, to scale a content |window| inside a
michael@0 215 * <browser> by a factor of 2.0
michael@0 216 *
michael@0 217 * window.setDisplayport(x, y, oldW / 2.0, oldH / 2.0);
michael@0 218 * window.setResolution(2.0, 2.0);
michael@0 219 * // elsewhere
michael@0 220 * browser.setViewportScale(2.0, 2.0);
michael@0 221 *
michael@0 222 * The caller of this method must have chrome privileges.
michael@0 223 */
michael@0 224 void setResolution(in float aXResolution, in float aYResolution);
michael@0 225
michael@0 226 void getResolution(out float aXResolution, out float aYResolution);
michael@0 227
michael@0 228 /**
michael@0 229 * Whether the resolution has been set by the user.
michael@0 230 * This gives a way to check whether the provided resolution is the default
michael@0 231 * value or restored from a previous session.
michael@0 232 *
michael@0 233 * Can only be accessed with chrome privileges.
michael@0 234 */
michael@0 235 readonly attribute boolean isResolutionSet;
michael@0 236
michael@0 237 /**
michael@0 238 * Whether the next paint should be flagged as the first paint for a document.
michael@0 239 * This gives a way to track the next paint that occurs after the flag is
michael@0 240 * set. The flag gets cleared after the next paint.
michael@0 241 *
michael@0 242 * Can only be accessed with chrome privileges.
michael@0 243 */
michael@0 244 attribute boolean isFirstPaint;
michael@0 245
michael@0 246 void getPresShellId(out uint32_t aPresShellId);
michael@0 247
michael@0 248 /**
michael@0 249 * Following modifiers are for sent*Event() except sendNative*Event().
michael@0 250 * NOTE: MODIFIER_ALT, MODIFIER_CONTROL, MODIFIER_SHIFT and MODIFIER_META
michael@0 251 * are must be same values as nsIDOMNSEvent::*_MASK for backward
michael@0 252 * compatibility.
michael@0 253 */
michael@0 254 const long MODIFIER_ALT = 0x0001;
michael@0 255 const long MODIFIER_CONTROL = 0x0002;
michael@0 256 const long MODIFIER_SHIFT = 0x0004;
michael@0 257 const long MODIFIER_META = 0x0008;
michael@0 258 const long MODIFIER_ALTGRAPH = 0x0010;
michael@0 259 const long MODIFIER_CAPSLOCK = 0x0020;
michael@0 260 const long MODIFIER_FN = 0x0040;
michael@0 261 const long MODIFIER_NUMLOCK = 0x0080;
michael@0 262 const long MODIFIER_SCROLLLOCK = 0x0100;
michael@0 263 const long MODIFIER_SYMBOLLOCK = 0x0200;
michael@0 264 const long MODIFIER_OS = 0x0400;
michael@0 265
michael@0 266 /** Synthesize a mouse event. The event types supported are:
michael@0 267 * mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu,
michael@0 268 * MozMouseHitTest
michael@0 269 *
michael@0 270 * Events are sent in coordinates offset by aX and aY from the window.
michael@0 271 *
michael@0 272 * Note that additional events may be fired as a result of this call. For
michael@0 273 * instance, typically a click event will be fired as a result of a
michael@0 274 * mousedown and mouseup in sequence.
michael@0 275 *
michael@0 276 * Normally at this level of events, the mouseover and mouseout events are
michael@0 277 * only fired when the window is entered or exited. For inter-element
michael@0 278 * mouseover and mouseout events, a movemove event fired on the new element
michael@0 279 * should be sufficient to generate the correct over and out events as well.
michael@0 280 *
michael@0 281 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 282 * Will throw a DOM security error if called without chrome privileges.
michael@0 283 *
michael@0 284 * The event is dispatched via the toplevel window, so it could go to any
michael@0 285 * window under the toplevel window, in some cases it could never reach this
michael@0 286 * window at all.
michael@0 287 *
michael@0 288 * @param aType event type
michael@0 289 * @param aX x offset in CSS pixels
michael@0 290 * @param aY y offset in CSS pixels
michael@0 291 * @param aButton button to synthesize
michael@0 292 * @param aClickCount number of clicks that have been performed
michael@0 293 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
michael@0 294 * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
michael@0 295 * during dispatch
michael@0 296 * @param aPressure touch input pressure: 0.0 -> 1.0
michael@0 297 * @param aInputSourceArg input source, see nsIDOMMouseEvent for values,
michael@0 298 * defaults to mouse input.
michael@0 299 * @param aIsSynthesized controls nsIDOMEvent.isSynthesized value
michael@0 300 * that helps identifying test related events,
michael@0 301 * defaults to true
michael@0 302 *
michael@0 303 * returns true if the page called prevent default on this event
michael@0 304 */
michael@0 305 [optional_argc]
michael@0 306 boolean sendMouseEvent(in AString aType,
michael@0 307 in float aX,
michael@0 308 in float aY,
michael@0 309 in long aButton,
michael@0 310 in long aClickCount,
michael@0 311 in long aModifiers,
michael@0 312 [optional] in boolean aIgnoreRootScrollFrame,
michael@0 313 [optional] in float aPressure,
michael@0 314 [optional] in unsigned short aInputSourceArg,
michael@0 315 [optional] in boolean aIsSynthesized);
michael@0 316
michael@0 317
michael@0 318 /** Synthesize a pointer event. The event types supported are:
michael@0 319 * pointerdown, pointerup, pointermove, pointerover, pointerout
michael@0 320 *
michael@0 321 * Events are sent in coordinates offset by aX and aY from the window.
michael@0 322 *
michael@0 323 * Note that additional events may be fired as a result of this call. For
michael@0 324 * instance, typically a click event will be fired as a result of a
michael@0 325 * mousedown and mouseup in sequence.
michael@0 326 *
michael@0 327 * Normally at this level of events, the pointerover and pointerout events are
michael@0 328 * only fired when the window is entered or exited. For inter-element
michael@0 329 * pointerover and pointerout events, a movemove event fired on the new element
michael@0 330 * should be sufficient to generate the correct over and out events as well.
michael@0 331 *
michael@0 332 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 333 * Will throw a DOM security error if called without chrome privileges.
michael@0 334 *
michael@0 335 * The event is dispatched via the toplevel window, so it could go to any
michael@0 336 * window under the toplevel window, in some cases it could never reach this
michael@0 337 * window at all.
michael@0 338 *
michael@0 339 * @param aType event type
michael@0 340 * @param aX x offset in CSS pixels
michael@0 341 * @param aY y offset in CSS pixels
michael@0 342 * @param aButton button to synthesize
michael@0 343 * @param aClickCount number of clicks that have been performed
michael@0 344 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
michael@0 345 * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
michael@0 346 * during dispatch
michael@0 347 * @param aPressure touch input pressure: 0.0 -> 1.0
michael@0 348 * @param aInputSourceArg input source, see nsIDOMMouseEvent for values,
michael@0 349 * defaults to mouse input.
michael@0 350 * @param aPointerId A unique identifier for the pointer causing the event. default is 0
michael@0 351 * @param aWidth The width (magnitude on the X axis), default is 0
michael@0 352 * @param aHeight The height (magnitude on the Y axis), default is 0
michael@0 353 * @param aTilt The plane angle between the Y-Z plane
michael@0 354 * and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis. default is 0
michael@0 355 * @param aTiltX The plane angle between the X-Z plane
michael@0 356 * and the plane containing both the transducer (e.g. pen stylus) axis and the X axis. default is 0
michael@0 357 * @param aIsPrimary Indicates if the pointer represents the primary pointer of this pointer type.
michael@0 358 * @param aIsSynthesized controls nsIDOMEvent.isSynthesized value
michael@0 359 * that helps identifying test related events,
michael@0 360 * defaults to true
michael@0 361 *
michael@0 362 * returns true if the page called prevent default on this event
michael@0 363 */
michael@0 364
michael@0 365 [optional_argc]
michael@0 366 boolean sendPointerEvent(in AString aType,
michael@0 367 in float aX,
michael@0 368 in float aY,
michael@0 369 in long aButton,
michael@0 370 in long aClickCount,
michael@0 371 in long aModifiers,
michael@0 372 [optional] in boolean aIgnoreRootScrollFrame,
michael@0 373 [optional] in float aPressure,
michael@0 374 [optional] in unsigned short aInputSourceArg,
michael@0 375 [optional] in long aPointerId,
michael@0 376 [optional] in long aWidth,
michael@0 377 [optional] in long aHeight,
michael@0 378 [optional] in long tiltX,
michael@0 379 [optional] in long tiltY,
michael@0 380 [optional] in boolean aIsPrimary,
michael@0 381 [optional] in boolean aIsSynthesized);
michael@0 382
michael@0 383 /** Synthesize a touch event. The event types supported are:
michael@0 384 * touchstart, touchend, touchmove, and touchcancel
michael@0 385 *
michael@0 386 * Events are sent in coordinates offset by aX and aY from the window.
michael@0 387 *
michael@0 388 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 389 * Will throw a DOM security error if called without chrome privileges.
michael@0 390 *
michael@0 391 * The event is dispatched via the toplevel window, so it could go to any
michael@0 392 * window under the toplevel window, in some cases it could never reach this
michael@0 393 * window at all.
michael@0 394 *
michael@0 395 * @param aType event type
michael@0 396 * @param xs array of offsets in CSS pixels for each touch to be sent
michael@0 397 * @param ys array of offsets in CSS pixels for each touch to be sent
michael@0 398 * @param rxs array of radii in CSS pixels for each touch to be sent
michael@0 399 * @param rys array of radii in CSS pixels for each touch to be sent
michael@0 400 * @param rotationAngles array of angles in degrees for each touch to be sent
michael@0 401 * @param forces array of forces (floats from 0 to 1) for each touch to be sent
michael@0 402 * @param count number of touches in this set
michael@0 403 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
michael@0 404 * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
michael@0 405 * during dispatch
michael@0 406 *
michael@0 407 * returns true if the page called prevent default on this touch event
michael@0 408 */
michael@0 409 boolean sendTouchEvent(in AString aType,
michael@0 410 [array, size_is(count)] in uint32_t aIdentifiers,
michael@0 411 [array, size_is(count)] in int32_t aXs,
michael@0 412 [array, size_is(count)] in int32_t aYs,
michael@0 413 [array, size_is(count)] in uint32_t aRxs,
michael@0 414 [array, size_is(count)] in uint32_t aRys,
michael@0 415 [array, size_is(count)] in float aRotationAngles,
michael@0 416 [array, size_is(count)] in float aForces,
michael@0 417 in uint32_t count,
michael@0 418 in long aModifiers,
michael@0 419 [optional] in boolean aIgnoreRootScrollFrame);
michael@0 420
michael@0 421 /** The same as sendMouseEvent but ensures that the event is dispatched to
michael@0 422 * this DOM window or one of its children.
michael@0 423 */
michael@0 424 [optional_argc]
michael@0 425 void sendMouseEventToWindow(in AString aType,
michael@0 426 in float aX,
michael@0 427 in float aY,
michael@0 428 in long aButton,
michael@0 429 in long aClickCount,
michael@0 430 in long aModifiers,
michael@0 431 [optional] in boolean aIgnoreRootScrollFrame,
michael@0 432 [optional] in float aPressure,
michael@0 433 [optional] in unsigned short aInputSourceArg,
michael@0 434 [optional] in boolean aIsSynthesized);
michael@0 435
michael@0 436 /** The same as sendTouchEvent but ensures that the event is dispatched to
michael@0 437 * this DOM window or one of its children.
michael@0 438 */
michael@0 439 boolean sendTouchEventToWindow(in AString aType,
michael@0 440 [array, size_is(count)] in uint32_t aIdentifiers,
michael@0 441 [array, size_is(count)] in int32_t aXs,
michael@0 442 [array, size_is(count)] in int32_t aYs,
michael@0 443 [array, size_is(count)] in uint32_t aRxs,
michael@0 444 [array, size_is(count)] in uint32_t aRys,
michael@0 445 [array, size_is(count)] in float aRotationAngles,
michael@0 446 [array, size_is(count)] in float aForces,
michael@0 447 in uint32_t count,
michael@0 448 in long aModifiers,
michael@0 449 [optional] in boolean aIgnoreRootScrollFrame);
michael@0 450
michael@0 451 /** Synthesize a wheel event for a window. The event types supported is only
michael@0 452 * wheel.
michael@0 453 *
michael@0 454 * Events are sent in coordinates offset by aX and aY from the window.
michael@0 455 *
michael@0 456 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 457 * Will throw a DOM security error if called without chrome privileges.
michael@0 458 *
michael@0 459 * @param aX x offset in CSS pixels
michael@0 460 * @param aY y offset in CSS pixels
michael@0 461 * @param aDeltaX deltaX value.
michael@0 462 * @param aDeltaY deltaY value.
michael@0 463 * @param aDeltaZ deltaZ value.
michael@0 464 * @param aDeltaMode deltaMode value which must be one of
michael@0 465 * nsIDOMWheelEvent::DOM_DELTA_*.
michael@0 466 * @param aModifiers modifiers pressed, using constants defined as
michael@0 467 * MODIFIER_*
michael@0 468 * @param aLineOrPageDeltaX If you set this value non-zero for
michael@0 469 * DOM_DELTA_PIXEL event, EventStateManager will
michael@0 470 * dispatch NS_MOUSE_SCROLL event for horizontal
michael@0 471 * scroll.
michael@0 472 * @param aLineOrPageDeltaY If you set this value non-zero for
michael@0 473 * DOM_DELTA_PIXEL event, EventStateManager will
michael@0 474 * dispatch NS_MOUSE_SCROLL event for vertical
michael@0 475 * scroll.
michael@0 476 * @param aOptions Set following flags.
michael@0 477 */
michael@0 478 const unsigned long WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE = 0x0001;
michael@0 479 const unsigned long WHEEL_EVENT_CAUSED_BY_MOMENTUM = 0x0002;
michael@0 480 const unsigned long WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS = 0x0004;
michael@0 481 // If any of the following flags is specified this method will throw an
michael@0 482 // exception in case the relevant overflowDelta has an unexpected value.
michael@0 483 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO = 0x0010;
michael@0 484 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE = 0x0020;
michael@0 485 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE = 0x0040;
michael@0 486 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO = 0x0100;
michael@0 487 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE = 0x0200;
michael@0 488 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE = 0x0400;
michael@0 489 void sendWheelEvent(in float aX,
michael@0 490 in float aY,
michael@0 491 in double aDeltaX,
michael@0 492 in double aDeltaY,
michael@0 493 in double aDeltaZ,
michael@0 494 in unsigned long aDeltaMode,
michael@0 495 in long aModifiers,
michael@0 496 in long aLineOrPageDeltaX,
michael@0 497 in long aLineOrPageDeltaY,
michael@0 498 in unsigned long aOptions);
michael@0 499
michael@0 500 /**
michael@0 501 * Synthesize a key event to the window. The event types supported are:
michael@0 502 * keydown, keyup, keypress
michael@0 503 *
michael@0 504 * Key events generally end up being sent to the focused node.
michael@0 505 *
michael@0 506 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 507 * Will throw a DOM security error if called without chrome privileges.
michael@0 508 *
michael@0 509 * @param aType event type
michael@0 510 * @param aKeyCode key code
michael@0 511 * @param aCharCode character code
michael@0 512 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
michael@0 513 * @param aAdditionalFlags special flags for the key event, see KEY_FLAG_*.
michael@0 514 *
michael@0 515 * @return false if the event had preventDefault() called on it,
michael@0 516 * true otherwise. In other words, true if and only if the
michael@0 517 * default action was taken.
michael@0 518 */
michael@0 519
michael@0 520 // If this is set, preventDefault() the event before dispatch.
michael@0 521 const unsigned long KEY_FLAG_PREVENT_DEFAULT = 0x0001;
michael@0 522
michael@0 523 // if one of these flags is set, the KeyboardEvent.location will be the value.
michael@0 524 // Otherwise, it will be computed from aKeyCode.
michael@0 525 const unsigned long KEY_FLAG_LOCATION_STANDARD = 0x0010;
michael@0 526 const unsigned long KEY_FLAG_LOCATION_LEFT = 0x0020;
michael@0 527 const unsigned long KEY_FLAG_LOCATION_RIGHT = 0x0040;
michael@0 528 const unsigned long KEY_FLAG_LOCATION_NUMPAD = 0x0080;
michael@0 529 const unsigned long KEY_FLAG_LOCATION_MOBILE = 0x0100;
michael@0 530 const unsigned long KEY_FLAG_LOCATION_JOYSTICK = 0x0200;
michael@0 531
michael@0 532 boolean sendKeyEvent(in AString aType,
michael@0 533 in long aKeyCode,
michael@0 534 in long aCharCode,
michael@0 535 in long aModifiers,
michael@0 536 [optional] in unsigned long aAdditionalFlags);
michael@0 537
michael@0 538 /**
michael@0 539 * See nsIWidget::SynthesizeNativeKeyEvent
michael@0 540 *
michael@0 541 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 542 * Will throw a DOM security error if called without chrome privileges.
michael@0 543 *
michael@0 544 * When you use this for tests, use the constants defined in NativeKeyCodes.js
michael@0 545 */
michael@0 546 void sendNativeKeyEvent(in long aNativeKeyboardLayout,
michael@0 547 in long aNativeKeyCode,
michael@0 548 in long aModifierFlags,
michael@0 549 in AString aCharacters,
michael@0 550 in AString aUnmodifiedCharacters);
michael@0 551
michael@0 552 /**
michael@0 553 * See nsIWidget::SynthesizeNativeMouseEvent
michael@0 554 *
michael@0 555 * Will be called on the widget that contains aElement.
michael@0 556 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 557 * Will throw a DOM security error if called without chrome privileges.
michael@0 558 */
michael@0 559 void sendNativeMouseEvent(in long aScreenX,
michael@0 560 in long aScreenY,
michael@0 561 in long aNativeMessage,
michael@0 562 in long aModifierFlags,
michael@0 563 in nsIDOMElement aElement);
michael@0 564
michael@0 565 /**
michael@0 566 * The values for sendNativeMouseScrollEvent's aAdditionalFlags.
michael@0 567 */
michael@0 568
michael@0 569 /**
michael@0 570 * If MOUSESCROLL_PREFER_WIDGET_AT_POINT is set, widget will dispatch
michael@0 571 * the event to a widget which is under the cursor. Otherwise, dispatch to
michael@0 572 * a default target on the platform. E.g., on Windows, it's focused window.
michael@0 573 */
michael@0 574 const unsigned long MOUSESCROLL_PREFER_WIDGET_AT_POINT = 0x00000001;
michael@0 575
michael@0 576 /**
michael@0 577 * The platform specific values of aAdditionalFlags. Must be over 0x00010000.
michael@0 578 */
michael@0 579
michael@0 580 /**
michael@0 581 * If MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL is set and aNativeMessage is
michael@0 582 * WM_VSCROLL or WM_HSCROLL, widget will set the window handle to the lParam
michael@0 583 * instead of NULL.
michael@0 584 */
michael@0 585 const unsigned long MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL = 0x00010000;
michael@0 586
michael@0 587 /**
michael@0 588 * See nsIWidget::SynthesizeNativeMouseScrollEvent
michael@0 589 *
michael@0 590 * Will be called on the widget that contains aElement.
michael@0 591 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 592 * Will throw a DOM security error if called without chrome privileges.
michael@0 593 *
michael@0 594 * NOTE: The synthesized native event may be fired asynchronously.
michael@0 595 *
michael@0 596 * @param aNativeMessage
michael@0 597 * On Windows: WM_MOUSEWHEEL (0x020A), WM_MOUSEHWHEEL(0x020E),
michael@0 598 * WM_VSCROLL (0x0115) or WM_HSCROLL (0x114).
michael@0 599 */
michael@0 600 void sendNativeMouseScrollEvent(in long aScreenX,
michael@0 601 in long aScreenY,
michael@0 602 in unsigned long aNativeMessage,
michael@0 603 in double aDeltaX,
michael@0 604 in double aDeltaY,
michael@0 605 in double aDeltaZ,
michael@0 606 in unsigned long aModifierFlags,
michael@0 607 in unsigned long aAdditionalFlags,
michael@0 608 in nsIDOMElement aElement);
michael@0 609
michael@0 610 /**
michael@0 611 * Touch states for sendNativeTouchPoint. These values match
michael@0 612 * nsIWidget's TouchPointerState.
michael@0 613 */
michael@0 614
michael@0 615 // The pointer is in a hover state above the digitizer
michael@0 616 const long TOUCH_HOVER = 0x01;
michael@0 617 // The pointer is in contact with the digitizer
michael@0 618 const long TOUCH_CONTACT = 0x02;
michael@0 619 // The pointer has been removed from the digitizer detection area
michael@0 620 const long TOUCH_REMOVE = 0x04;
michael@0 621 // The pointer has been canceled. Will cancel any pending os level
michael@0 622 // gestures that would be triggered as a result of completion of the
michael@0 623 // input sequence. This may not cancel moz platform related events
michael@0 624 // that might get tirggered by input already delivered.
michael@0 625 const long TOUCH_CANCEL = 0x08;
michael@0 626
michael@0 627 /**
michael@0 628 * Create a new or update an existing touch point on the digitizer.
michael@0 629 * To trigger os level gestures, individual touch points should
michael@0 630 * transition through a complete set of touch states which should be
michael@0 631 * sent as individual calls. For example:
michael@0 632 * tap - msg1:TOUCH_CONTACT, msg2:TOUCH_REMOVE
michael@0 633 * drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE
michael@0 634 * hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE
michael@0 635 *
michael@0 636 * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will
michael@0 637 * throw.
michael@0 638 *
michael@0 639 * @param aPointerId The touch point id to create or update.
michael@0 640 * @param aTouchState one or more of the touch states listed above
michael@0 641 * @param aScreenX, aScreenY screen coords of this event
michael@0 642 * @param aPressure 0.0 -> 1.0 float val indicating pressure
michael@0 643 * @param aOrientation 0 -> 359 degree value indicating the
michael@0 644 * orientation of the pointer. Use 90 for normal taps.
michael@0 645 */
michael@0 646 void sendNativeTouchPoint(in unsigned long aPointerId,
michael@0 647 in unsigned long aTouchState,
michael@0 648 in long aScreenX,
michael@0 649 in long aScreenY,
michael@0 650 in double aPressure,
michael@0 651 in unsigned long aOrientation);
michael@0 652
michael@0 653 /**
michael@0 654 * Simulates native touch based taps on the input digitizer. Events
michael@0 655 * triggered by this call are injected at the os level. Events do not
michael@0 656 * bypass widget level input processing and as such can be used to
michael@0 657 * test widget event logic and async pan-zoom controller functionality.
michael@0 658 * Cannot be accessed from an unprivileged context.
michael@0 659 *
michael@0 660 * Long taps (based on the aLongTap parameter) will be completed
michael@0 661 * asynchrnously after the call returns. Long tap delay is based on
michael@0 662 * the ui.click_hold_context_menus.delay pref or 1500 msec if pref
michael@0 663 * is not set.
michael@0 664 *
michael@0 665 * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will
michael@0 666 * throw.
michael@0 667 *
michael@0 668 * @param aScreenX, aScreenY screen coords of this event
michael@0 669 * @param aLongTap true if the tap should be long, false for a short
michael@0 670 * tap.
michael@0 671 */
michael@0 672 void sendNativeTouchTap(in long aScreenX,
michael@0 673 in long aScreenY,
michael@0 674 in boolean aLongTap);
michael@0 675
michael@0 676 /**
michael@0 677 * Cancel any existing touch points or long tap delays. Calling this is safe
michael@0 678 * even if you're sure there aren't any pointers recorded. You should call
michael@0 679 * this when tests shut down to reset the digitizer driver. Not doing so can
michael@0 680 * leave the digitizer in an undetermined state which can screw up subsequent
michael@0 681 * tests and native input.
michael@0 682 */
michael@0 683 void clearNativeTouchSequence();
michael@0 684
michael@0 685 /**
michael@0 686 * See nsIWidget::ActivateNativeMenuItemAt
michael@0 687 *
michael@0 688 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 689 * Will throw a DOM security error if called without chrome privileges.
michael@0 690 */
michael@0 691 void activateNativeMenuItemAt(in AString indexString);
michael@0 692
michael@0 693 /**
michael@0 694 * See nsIWidget::ForceUpdateNativeMenuAt
michael@0 695 *
michael@0 696 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 697 * Will throw a DOM security error if called without chrome privileges.
michael@0 698 */
michael@0 699 void forceUpdateNativeMenuAt(in AString indexString);
michael@0 700
michael@0 701 /**
michael@0 702 * Focus the element aElement. The element should be in the same document
michael@0 703 * that the window is displaying. Pass null to blur the element, if any,
michael@0 704 * that currently has focus, and focus the document.
michael@0 705 *
michael@0 706 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 707 * Will throw a DOM security error if called without chrome privileges.
michael@0 708 *
michael@0 709 * @param aElement the element to focus
michael@0 710 *
michael@0 711 * Do not use this method. Just use element.focus if available or
michael@0 712 * nsIFocusManager::SetFocus instead.
michael@0 713 *
michael@0 714 */
michael@0 715 void focus(in nsIDOMElement aElement);
michael@0 716
michael@0 717 /**
michael@0 718 * Force a garbage collection followed by a cycle collection.
michael@0 719 *
michael@0 720 * Will throw a DOM security error if called without chrome privileges in
michael@0 721 * non-debug builds. Available to all callers in debug builds.
michael@0 722 *
michael@0 723 * @param aListener listener that receives information about the CC graph
michael@0 724 * (see @mozilla.org/cycle-collector-logger;1 for a logger
michael@0 725 * component)
michael@0 726 * @param aExtraForgetSkippableCalls indicates how many times
michael@0 727 * nsCycleCollector_forgetSkippable will
michael@0 728 * be called before running cycle collection.
michael@0 729 * -1 prevents the default
michael@0 730 * nsCycleCollector_forgetSkippable call
michael@0 731 * which happens after garbage collection.
michael@0 732 */
michael@0 733 void garbageCollect([optional] in nsICycleCollectorListener aListener,
michael@0 734 [optional] in long aExtraForgetSkippableCalls);
michael@0 735
michael@0 736 /**
michael@0 737 * Force a cycle collection without garbage collection.
michael@0 738 *
michael@0 739 * Will throw a DOM security error if called without chrome privileges in
michael@0 740 * non-debug builds. Available to all callers in debug builds.
michael@0 741 *
michael@0 742 * @param aListener listener that receives information about the CC graph
michael@0 743 * (see @mozilla.org/cycle-collector-logger;1 for a logger
michael@0 744 * component)
michael@0 745 * @param aExtraForgetSkippableCalls indicates how many times
michael@0 746 * nsCycleCollector_forgetSkippable will
michael@0 747 * be called before running cycle collection.
michael@0 748 * -1 prevents the default
michael@0 749 * nsCycleCollector_forgetSkippable call
michael@0 750 * which happens after garbage collection.
michael@0 751 */
michael@0 752 void cycleCollect([optional] in nsICycleCollectorListener aListener,
michael@0 753 [optional] in long aExtraForgetSkippableCalls);
michael@0 754
michael@0 755 /**
michael@0 756 * Trigger whichever GC or CC timer is currently active and waiting to fire.
michael@0 757 * Don't do this too much for initiating heavy actions, like the start of a IGC.
michael@0 758 */
michael@0 759 void runNextCollectorTimer();
michael@0 760
michael@0 761 /** Synthesize a simple gesture event for a window. The event types
michael@0 762 * supported are: MozSwipeGestureStart, MozSwipeGestureUpdate,
michael@0 763 * MozSwipeGestureEnd, MozSwipeGesture, MozMagnifyGestureStart,
michael@0 764 * MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart,
michael@0 765 * MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture,
michael@0 766 * MozTapGesture, and MozEdgeUIGesture.
michael@0 767 *
michael@0 768 * Cannot be accessed from unprivileged context (not
michael@0 769 * content-accessible) Will throw a DOM security error if called
michael@0 770 * without chrome privileges.
michael@0 771 *
michael@0 772 * @param aType event type
michael@0 773 * @param aX x offset in CSS pixels
michael@0 774 * @param aY y offset in CSS pixels
michael@0 775 * @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
michael@0 776 * @param aDelta amount of magnification or rotation for magnify and rotation events
michael@0 777 * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
michael@0 778 * @param aClickCount For tap gestures, the number of taps.
michael@0 779 */
michael@0 780 void sendSimpleGestureEvent(in AString aType,
michael@0 781 in float aX,
michael@0 782 in float aY,
michael@0 783 in unsigned long aDirection,
michael@0 784 in double aDelta,
michael@0 785 in long aModifiers,
michael@0 786 [optional] in unsigned long aClickCount);
michael@0 787
michael@0 788 /**
michael@0 789 * Retrieve the element at point aX, aY in the window's document.
michael@0 790 *
michael@0 791 * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
michael@0 792 * frame when retrieving the element. If false, this method returns
michael@0 793 * null for coordinates outside of the viewport.
michael@0 794 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
michael@0 795 */
michael@0 796 nsIDOMElement elementFromPoint(in float aX,
michael@0 797 in float aY,
michael@0 798 in boolean aIgnoreRootScrollFrame,
michael@0 799 in boolean aFlushLayout);
michael@0 800
michael@0 801 /**
michael@0 802 * Retrieve all nodes that intersect a rect in the window's document.
michael@0 803 *
michael@0 804 * @param aX x reference for the rectangle in CSS pixels
michael@0 805 * @param aY y reference for the rectangle in CSS pixels
michael@0 806 * @param aTopSize How much to expand up the rectangle
michael@0 807 * @param aRightSize How much to expand right the rectangle
michael@0 808 * @param aBottomSize How much to expand down the rectangle
michael@0 809 * @param aLeftSize How much to expand left the rectangle
michael@0 810 * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
michael@0 811 * frame when retrieving the element. If false, this method returns
michael@0 812 * null for coordinates outside of the viewport.
michael@0 813 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
michael@0 814 */
michael@0 815 nsIDOMNodeList nodesFromRect(in float aX,
michael@0 816 in float aY,
michael@0 817 in float aTopSize,
michael@0 818 in float aRightSize,
michael@0 819 in float aBottomSize,
michael@0 820 in float aLeftSize,
michael@0 821 in boolean aIgnoreRootScrollFrame,
michael@0 822 in boolean aFlushLayout);
michael@0 823
michael@0 824
michael@0 825 /**
michael@0 826 * Get a list of nodes that have meaningful textual content to
michael@0 827 * be translated. The implementation of this algorithm is in flux
michael@0 828 * as we experiment and refine which approach works best.
michael@0 829 *
michael@0 830 * This method requires chrome privileges.
michael@0 831 */
michael@0 832 nsITranslationNodeList getTranslationNodes(in nsIDOMNode aRoot);
michael@0 833
michael@0 834 /**
michael@0 835 * Compare the two canvases, returning the number of differing pixels and
michael@0 836 * the maximum difference in a channel. This will throw an error if
michael@0 837 * the dimensions of the two canvases are different.
michael@0 838 *
michael@0 839 * This method requires chrome privileges.
michael@0 840 */
michael@0 841 uint32_t compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1,
michael@0 842 in nsIDOMHTMLCanvasElement aCanvas2,
michael@0 843 out unsigned long aMaxDifference);
michael@0 844
michael@0 845 /**
michael@0 846 * Returns true if a MozAfterPaint event has been queued but not yet
michael@0 847 * fired.
michael@0 848 */
michael@0 849 readonly attribute boolean isMozAfterPaintPending;
michael@0 850
michael@0 851 /**
michael@0 852 * Suppresses/unsuppresses user initiated event handling in window's document
michael@0 853 * and subdocuments.
michael@0 854 *
michael@0 855 * @throw NS_ERROR_DOM_SECURITY_ERR if called without chrome privileges and
michael@0 856 * NS_ERROR_FAILURE if window doesn't have a document.
michael@0 857 */
michael@0 858 void suppressEventHandling(in boolean aSuppress);
michael@0 859
michael@0 860 void clearMozAfterPaintEvents();
michael@0 861
michael@0 862 /**
michael@0 863 * Disable or enable non synthetic test mouse events on *all* windows.
michael@0 864 *
michael@0 865 * Cannot be accessed from unprivileged context (not content-accessible).
michael@0 866 * Will throw a DOM security error if called without chrome privileges.
michael@0 867 *
michael@0 868 * @param aDisable If true, disable all non synthetic test mouse events
michael@0 869 * on all windows. Otherwise, enable them.
michael@0 870 */
michael@0 871 void disableNonTestMouseEvents(in boolean aDisable);
michael@0 872
michael@0 873 /**
michael@0 874 * Returns the scroll position of the window's currently loaded document.
michael@0 875 *
michael@0 876 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
michael@0 877 * @see nsIDOMWindow::scrollX/Y
michael@0 878 */
michael@0 879 void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
michael@0 880
michael@0 881 /**
michael@0 882 * Returns the scroll position of the window's currently loaded document.
michael@0 883 *
michael@0 884 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
michael@0 885 * @see nsIDOMWindow::scrollX/Y
michael@0 886 */
michael@0 887 void getScrollXYFloat(in boolean aFlushLayout, out float aScrollX, out float aScrollY);
michael@0 888
michael@0 889 /**
michael@0 890 * Returns the scrollbar width of the window's scroll frame.
michael@0 891 *
michael@0 892 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
michael@0 893 */
michael@0 894 void getScrollbarSize(in boolean aFlushLayout, out long aWidth, out long aHeight);
michael@0 895
michael@0 896 /**
michael@0 897 * Returns the given element's bounds without flushing pending layout changes.
michael@0 898 */
michael@0 899 nsIDOMClientRect getBoundsWithoutFlushing(in nsIDOMElement aElement);
michael@0 900
michael@0 901 /**
michael@0 902 * Returns the bounds of the window's currently loaded document. This will
michael@0 903 * generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL
michael@0 904 * documents) may have a negative left value.
michael@0 905 */
michael@0 906 nsIDOMClientRect getRootBounds();
michael@0 907
michael@0 908 /**
michael@0 909 * Get IME open state. TRUE means 'Open', otherwise, 'Close'.
michael@0 910 * This property works only when IMEEnabled is IME_STATUS_ENABLED.
michael@0 911 */
michael@0 912 readonly attribute boolean IMEIsOpen;
michael@0 913
michael@0 914 /**
michael@0 915 * WARNING: These values must be same as nsIWidget's values.
michael@0 916 */
michael@0 917
michael@0 918 /**
michael@0 919 * DISABLED means users cannot use IME completely.
michael@0 920 * Note that this state is *not* same as |ime-mode: disabled;|.
michael@0 921 */
michael@0 922 const unsigned long IME_STATUS_DISABLED = 0;
michael@0 923
michael@0 924 /**
michael@0 925 * ENABLED means users can use all functions of IME. This state is same as
michael@0 926 * |ime-mode: normal;|.
michael@0 927 */
michael@0 928 const unsigned long IME_STATUS_ENABLED = 1;
michael@0 929
michael@0 930 /**
michael@0 931 * PASSWORD means users cannot use most functions of IME. But on GTK2,
michael@0 932 * users can use "Simple IM" which only supports dead key inputting.
michael@0 933 * The behavior is same as the behavior of the native password field.
michael@0 934 * This state is same as |ime-mode: disabled;|.
michael@0 935 */
michael@0 936 const unsigned long IME_STATUS_PASSWORD = 2;
michael@0 937
michael@0 938 /**
michael@0 939 * PLUGIN means a plug-in has focus. At this time we should not touch to
michael@0 940 * controlling the IME state.
michael@0 941 */
michael@0 942 const unsigned long IME_STATUS_PLUGIN = 3;
michael@0 943
michael@0 944 /**
michael@0 945 * Get IME status, see above IME_STATUS_* definitions.
michael@0 946 */
michael@0 947 readonly attribute unsigned long IMEStatus;
michael@0 948
michael@0 949 /**
michael@0 950 * Get the number of screen pixels per CSS pixel.
michael@0 951 */
michael@0 952 readonly attribute float screenPixelsPerCSSPixel;
michael@0 953
michael@0 954 /**
michael@0 955 * Get the current zoom factor.
michael@0 956 * This is _approximately_ the same as nsIMarkupDocumentViewer.fullZoom,
michael@0 957 * but takes into account Gecko's quantization of the zoom factor, which is
michael@0 958 * implemented by adjusting the (integer) number of appUnits per devPixel.
michael@0 959 */
michael@0 960 readonly attribute float fullZoom;
michael@0 961
michael@0 962 /**
michael@0 963 * Dispatches aEvent via the nsIPresShell object of the window's document.
michael@0 964 * The event is dispatched to aTarget, which should be an object
michael@0 965 * which implements nsIContent interface (#element, #text, etc).
michael@0 966 *
michael@0 967 * Cannot be accessed from unprivileged context (not
michael@0 968 * content-accessible) Will throw a DOM security error if called
michael@0 969 * without chrome privileges.
michael@0 970 *
michael@0 971 * @note Event handlers won't get aEvent as parameter, but a similar event.
michael@0 972 * Also, aEvent should not be reused.
michael@0 973 */
michael@0 974 boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget,
michael@0 975 in nsIDOMEvent aEvent,
michael@0 976 in boolean aTrusted);
michael@0 977
michael@0 978 /**
michael@0 979 * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that
michael@0 980 * the event is propagated only to chrome.
michael@0 981 * Event's .target property will be aTarget.
michael@0 982 * Returns the same value as what EventTarget.dispatchEvent does.
michael@0 983 */
michael@0 984 boolean dispatchEventToChromeOnly(in nsIDOMEventTarget aTarget,
michael@0 985 in nsIDOMEvent aEvent);
michael@0 986
michael@0 987 /**
michael@0 988 * Returns the real classname (possibly of the mostly-transparent security
michael@0 989 * wrapper) of aObj.
michael@0 990 */
michael@0 991 [implicit_jscontext] string getClassName(in jsval aObject);
michael@0 992
michael@0 993 /**
michael@0 994 * Generate a content command event.
michael@0 995 *
michael@0 996 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 997 * Will throw a DOM security error if called without chrome privileges.
michael@0 998 *
michael@0 999 * @param aType Type of command content event to send. Can be one of "cut",
michael@0 1000 * "copy", "paste", "delete", "undo", "redo", or "pasteTransferable".
michael@0 1001 * @param aTransferable an instance of nsITransferable when aType is
michael@0 1002 * "pasteTransferable"
michael@0 1003 */
michael@0 1004 void sendContentCommandEvent(in AString aType,
michael@0 1005 [optional] in nsITransferable aTransferable);
michael@0 1006
michael@0 1007 /**
michael@0 1008 * Synthesize a composition event to the window.
michael@0 1009 *
michael@0 1010 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 1011 * Will throw a DOM security error if called without chrome privileges.
michael@0 1012 *
michael@0 1013 * @param aType The event type: "compositionstart", "compositionend" or
michael@0 1014 * "compositionupdate".
michael@0 1015 * @param aData The data property value. Note that this isn't applied
michael@0 1016 * for compositionstart event because its value is the
michael@0 1017 * selected text which is automatically computed.
michael@0 1018 * @param aLocale The locale property value.
michael@0 1019 */
michael@0 1020 void sendCompositionEvent(in AString aType,
michael@0 1021 in AString aData,
michael@0 1022 in AString aLocale);
michael@0 1023
michael@0 1024 /**
michael@0 1025 * Creating synthesizer of composition string on the window.
michael@0 1026 *
michael@0 1027 * Cannot be accessed from unprivileged context (not content-accessible)
michael@0 1028 * Will throw a DOM security error if called without chrome privileges.
michael@0 1029 */
michael@0 1030 nsICompositionStringSynthesizer createCompositionStringSynthesizer();
michael@0 1031
michael@0 1032 /**
michael@0 1033 * If sendQueryContentEvent()'s aAdditionalFlags argument is
michael@0 1034 * QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK, plain text generated from content
michael@0 1035 * is created with "\n".
michael@0 1036 * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used.
michael@0 1037 * aOffset and aLength are offset and length in/of the plain text content.
michael@0 1038 * This flag also affects the result values such as offset, length and string.
michael@0 1039 */
michael@0 1040 const unsigned long QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK = 0x0000;
michael@0 1041 const unsigned long QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK = 0x0001;
michael@0 1042
michael@0 1043 /**
michael@0 1044 * Synthesize a query content event. Note that the result value returned here
michael@0 1045 * is in LayoutDevice pixels rather than CSS pixels.
michael@0 1046 *
michael@0 1047 * @param aType One of the following const values. And see also each comment
michael@0 1048 * for the other parameters and the result.
michael@0 1049 * @param aAdditionalFlags See the description of QUERY_CONTENT_FLAG_*.
michael@0 1050 */
michael@0 1051 nsIQueryContentEventResult sendQueryContentEvent(
michael@0 1052 in unsigned long aType,
michael@0 1053 in unsigned long aOffset,
michael@0 1054 in unsigned long aLength,
michael@0 1055 in long aX,
michael@0 1056 in long aY,
michael@0 1057 [optional] in unsigned long aAdditionalFlags);
michael@0 1058
michael@0 1059 // NOTE: following values are same as NS_QUERY_* in BasicEvents.h
michael@0 1060
michael@0 1061 /**
michael@0 1062 * QUERY_SELECTED_TEXT queries the first selection range's information.
michael@0 1063 *
michael@0 1064 * @param aOffset Not used.
michael@0 1065 * @param aLength Not used.
michael@0 1066 * @param aX Not used.
michael@0 1067 * @param aY Not used.
michael@0 1068 *
michael@0 1069 * @return offset, reversed and text properties of the result are available.
michael@0 1070 */
michael@0 1071 const unsigned long QUERY_SELECTED_TEXT = 3200;
michael@0 1072
michael@0 1073 /**
michael@0 1074 * QUERY_TEXT_CONTENT queries the text at the specified range.
michael@0 1075 *
michael@0 1076 * @param aOffset The first character's offset. 0 is the first character.
michael@0 1077 * @param aLength The length of getting text. If the aLength is too long,
michael@0 1078 * the result text is shorter than this value.
michael@0 1079 * @param aX Not used.
michael@0 1080 * @param aY Not used.
michael@0 1081 *
michael@0 1082 * @return text property of the result is available.
michael@0 1083 */
michael@0 1084 const unsigned long QUERY_TEXT_CONTENT = 3201;
michael@0 1085
michael@0 1086 /**
michael@0 1087 * QUERY_CARET_RECT queries the (collapsed) caret rect of the offset.
michael@0 1088 * If the actual caret is there at the specified offset, this returns the
michael@0 1089 * actual caret rect. Otherwise, this guesses the caret rect from the
michael@0 1090 * metrics of the text.
michael@0 1091 *
michael@0 1092 * @param aOffset The caret offset. 0 is the left side of the first
michael@0 1093 * caracter in LTR text.
michael@0 1094 * @param aLength Not used.
michael@0 1095 * @param aX Not used.
michael@0 1096 * @param aY Not used.
michael@0 1097 *
michael@0 1098 * @return left, top, width and height properties of the result are available.
michael@0 1099 * The left and the top properties are offset in the client area of
michael@0 1100 * the DOM window.
michael@0 1101 */
michael@0 1102 const unsigned long QUERY_CARET_RECT = 3203;
michael@0 1103
michael@0 1104 /**
michael@0 1105 * QUERY_TEXT_RECT queries the specified text's rect.
michael@0 1106 *
michael@0 1107 * @param aOffset The first character's offset. 0 is the first character.
michael@0 1108 * @param aLength The length of getting text. If the aLength is too long,
michael@0 1109 * the extra length is ignored.
michael@0 1110 * @param aX Not used.
michael@0 1111 * @param aY Not used.
michael@0 1112 *
michael@0 1113 * @return left, top, width and height properties of the result are available.
michael@0 1114 * The left and the top properties are offset in the client area of
michael@0 1115 * the DOM window.
michael@0 1116 */
michael@0 1117 const unsigned long QUERY_TEXT_RECT = 3204;
michael@0 1118
michael@0 1119 /**
michael@0 1120 * QUERY_TEXT_RECT queries the focused editor's rect.
michael@0 1121 *
michael@0 1122 * @param aOffset Not used.
michael@0 1123 * @param aLength Not used.
michael@0 1124 * @param aX Not used.
michael@0 1125 * @param aY Not used.
michael@0 1126 *
michael@0 1127 * @return left, top, width and height properties of the result are available.
michael@0 1128 */
michael@0 1129 const unsigned long QUERY_EDITOR_RECT = 3205;
michael@0 1130
michael@0 1131 /**
michael@0 1132 * QUERY_CHARACTER_AT_POINT queries the character information at the
michael@0 1133 * specified point. The point is offset in the window.
michael@0 1134 * NOTE: If there are some panels at the point, this method send the query
michael@0 1135 * event to the panel's widget automatically.
michael@0 1136 *
michael@0 1137 * @param aOffset Not used.
michael@0 1138 * @param aLength Not used.
michael@0 1139 * @param aX X offset in the widget.
michael@0 1140 * @param aY Y offset in the widget.
michael@0 1141 *
michael@0 1142 * @return offset, notFound, left, top, width and height properties of the
michael@0 1143 * result are available.
michael@0 1144 */
michael@0 1145 const unsigned long QUERY_CHARACTER_AT_POINT = 3208;
michael@0 1146
michael@0 1147 /**
michael@0 1148 * Called when the remote child frame has changed its fullscreen state,
michael@0 1149 * when entering fullscreen, and when the origin which is fullscreen changes.
michael@0 1150 * aFrameElement is the iframe element which contains the child-process
michael@0 1151 * fullscreen document, and aNewOrigin is the origin of the new fullscreen
michael@0 1152 * document.
michael@0 1153 */
michael@0 1154 void remoteFrameFullscreenChanged(in nsIDOMElement aFrameElement,
michael@0 1155 in AString aNewOrigin);
michael@0 1156
michael@0 1157 /**
michael@0 1158 * Called when the remote frame has popped all fullscreen elements off its
michael@0 1159 * stack, so that the operation can complete on the parent side.
michael@0 1160 */
michael@0 1161 void remoteFrameFullscreenReverted();
michael@0 1162
michael@0 1163 /**
michael@0 1164 * Called when the child frame has fully exit fullscreen, so that the parent
michael@0 1165 * process can also fully exit.
michael@0 1166 */
michael@0 1167 void exitFullscreen();
michael@0 1168
michael@0 1169 /**
michael@0 1170 * If sendQueryContentEvent()'s aAdditionalFlags argument is
michael@0 1171 * SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK, aOffset and aLength are offset
michael@0 1172 * and length in/of plain text generated from content is created with "\n".
michael@0 1173 * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used.
michael@0 1174 */
michael@0 1175 const unsigned long SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK = 0x0000;
michael@0 1176 const unsigned long SELECTION_SET_FLAG_USE_XP_LINE_BREAK = 0x0001;
michael@0 1177
michael@0 1178 /**
michael@0 1179 * If SELECTION_SET_FLAG_REVERSE is set, the selection is set from
michael@0 1180 * |aOffset + aLength| to |aOffset|. Otherwise, it's set from |aOffset| to
michael@0 1181 * |aOffset + aLength|.
michael@0 1182 */
michael@0 1183 const unsigned long SELECTION_SET_FLAG_REVERSE = 0x0002;
michael@0 1184
michael@0 1185 /**
michael@0 1186 * Synthesize a selection set event to the window.
michael@0 1187 *
michael@0 1188 * This sets the selection as the specified information.
michael@0 1189 *
michael@0 1190 * @param aOffset The caret offset of the selection start.
michael@0 1191 * @param aLength The length of the selection. If this is too long, the
michael@0 1192 * extra length is ignored.
michael@0 1193 * @param aAdditionalFlags See the description of SELECTION_SET_FLAG_*.
michael@0 1194 * @return True, if succeeded. Otherwise, false.
michael@0 1195 */
michael@0 1196 boolean sendSelectionSetEvent(in unsigned long aOffset,
michael@0 1197 in unsigned long aLength,
michael@0 1198 [optional] in unsigned long aAdditionalFlags);
michael@0 1199
michael@0 1200 /* Selection behaviors - mirror nsIFrame's nsSelectionAmount constants */
michael@0 1201 const unsigned long SELECT_CHARACTER = 0;
michael@0 1202 const unsigned long SELECT_CLUSTER = 1;
michael@0 1203 const unsigned long SELECT_WORD = 2;
michael@0 1204 const unsigned long SELECT_LINE = 3;
michael@0 1205 const unsigned long SELECT_BEGINLINE = 4;
michael@0 1206 const unsigned long SELECT_ENDLINE = 5;
michael@0 1207 const unsigned long SELECT_PARAGRAPH = 6;
michael@0 1208 const unsigned long SELECT_WORDNOSPACE = 7;
michael@0 1209
michael@0 1210 /**
michael@0 1211 * Select content at a client point based on a selection behavior if the
michael@0 1212 * underlying content is selectable. Selection will accumulate with any
michael@0 1213 * existing selection, callers should clear selection prior if needed.
michael@0 1214 * May fire selection changed events. Calls nsFrame's SelectByTypeAtPoint.
michael@0 1215 *
michael@0 1216 * @param aX, aY The selection point in client coordinates.
michael@0 1217 * @param aSelectType The selection behavior requested.
michael@0 1218 * @return True if a selection occured, false otherwise.
michael@0 1219 * @throw NS_ERROR_DOM_SECURITY_ERR, NS_ERROR_UNEXPECTED for utils
michael@0 1220 * issues, and NS_ERROR_INVALID_ARG for coordinates that are outside
michael@0 1221 * this window.
michael@0 1222 */
michael@0 1223 boolean selectAtPoint(in float aX,
michael@0 1224 in float aY,
michael@0 1225 in unsigned long aSelectBehavior);
michael@0 1226
michael@0 1227 /**
michael@0 1228 * Perform the equivalent of:
michael@0 1229 * window.getComputedStyle(aElement, aPseudoElement).
michael@0 1230 * getPropertyValue(aPropertyName)
michael@0 1231 * except that, when the link whose presence in history is allowed to
michael@0 1232 * influence aElement's style is visited, get the value the property
michael@0 1233 * would have if allowed all properties to change as a result of
michael@0 1234 * :visited selectors (except for cases where getComputedStyle uses
michael@0 1235 * data from the frame).
michael@0 1236 *
michael@0 1237 * This is easier to implement than adding our property restrictions
michael@0 1238 * to this API, and is sufficient for the present testing
michael@0 1239 * requirements (which are essentially testing 'color').
michael@0 1240 */
michael@0 1241 AString getVisitedDependentComputedStyle(in nsIDOMElement aElement,
michael@0 1242 in AString aPseudoElement,
michael@0 1243 in AString aPropertyName);
michael@0 1244
michael@0 1245 /**
michael@0 1246 * Returns the parent of obj.
michael@0 1247 *
michael@0 1248 * @param obj The JavaScript object whose parent is to be gotten.
michael@0 1249 * @return the parent.
michael@0 1250 */
michael@0 1251 [implicit_jscontext] jsval getParent(in jsval obj);
michael@0 1252
michael@0 1253 /**
michael@0 1254 * Get the id of the outer window of this window. This will never throw.
michael@0 1255 */
michael@0 1256 readonly attribute unsigned long long outerWindowID;
michael@0 1257
michael@0 1258 /**
michael@0 1259 * Get the id of the current inner window of this window. If there
michael@0 1260 * is no current inner window, throws NS_ERROR_NOT_AVAILABLE.
michael@0 1261 */
michael@0 1262 readonly attribute unsigned long long currentInnerWindowID;
michael@0 1263
michael@0 1264 /**
michael@0 1265 * Put the window into a state where scripts are frozen and events
michael@0 1266 * suppressed, for use when the window has launched a modal prompt.
michael@0 1267 */
michael@0 1268 void enterModalState();
michael@0 1269
michael@0 1270 /**
michael@0 1271 * Resume normal window state, where scripts can run and events are
michael@0 1272 * delivered.
michael@0 1273 */
michael@0 1274 void leaveModalState();
michael@0 1275
michael@0 1276 /**
michael@0 1277 * Is the window is in a modal state? [See enterModalState()]
michael@0 1278 */
michael@0 1279 [noscript] boolean isInModalState();
michael@0 1280
michael@0 1281 /**
michael@0 1282 * Suspend/resume timeouts on this window and its descendant windows.
michael@0 1283 */
michael@0 1284 void suspendTimeouts();
michael@0 1285 void resumeTimeouts();
michael@0 1286
michael@0 1287 /**
michael@0 1288 * What type of layer manager the widget associated with this window is
michael@0 1289 * using. "Basic" is unaccelerated; other types are accelerated. Throws an
michael@0 1290 * error if there is no widget associated with this window.
michael@0 1291 */
michael@0 1292 readonly attribute AString layerManagerType;
michael@0 1293
michael@0 1294 /**
michael@0 1295 * True if the layer manager for the widget associated with this window is
michael@0 1296 * forwarding layers to a remote compositor, false otherwise. Throws an
michael@0 1297 * error if there is no widget associated with this window.
michael@0 1298 */
michael@0 1299 readonly attribute boolean layerManagerRemote;
michael@0 1300
michael@0 1301 /**
michael@0 1302 * Record (and return) frame-intervals for frames which were presented
michael@0 1303 * between calling StartFrameTimeRecording and StopFrameTimeRecording.
michael@0 1304 *
michael@0 1305 * - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late
michael@0 1306 * (elements were overwritten since Start), result is considered invalid and hence empty.
michael@0 1307 * - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent).
michael@0 1308 * Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize.
michael@0 1309 * - Note: the first frame-interval may be longer than expected because last frame
michael@0 1310 * might have been presented some time before calling StartFrameTimeRecording.
michael@0 1311 */
michael@0 1312
michael@0 1313 /**
michael@0 1314 * Returns a handle which represents current recording start position.
michael@0 1315 */
michael@0 1316 void startFrameTimeRecording([retval] out unsigned long startIndex);
michael@0 1317
michael@0 1318 /**
michael@0 1319 * Returns number of recorded frames since startIndex was issued,
michael@0 1320 * and allocates+populates 2 arraye with the recorded data.
michael@0 1321 * - Allocation is infallible. Should be released even if size is 0.
michael@0 1322 */
michael@0 1323 void stopFrameTimeRecording(in unsigned long startIndex,
michael@0 1324 [optional] out unsigned long frameCount,
michael@0 1325 [retval, array, size_is(frameCount)] out float frameIntervals);
michael@0 1326
michael@0 1327 /**
michael@0 1328 * Signals that we're begining to tab switch. This is used by painting code to
michael@0 1329 * determine total tab switch time.
michael@0 1330 */
michael@0 1331 void beginTabSwitch();
michael@0 1332
michael@0 1333 /**
michael@0 1334 * The DPI of the display
michael@0 1335 */
michael@0 1336 readonly attribute float displayDPI;
michael@0 1337
michael@0 1338 /**
michael@0 1339 * Return the outer window with the given ID, if any. Can return null.
michael@0 1340 * @deprecated Use nsIWindowMediator.getOuterWindowWithId. See bug 865664.
michael@0 1341 */
michael@0 1342 nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID);
michael@0 1343
michael@0 1344 /**
michael@0 1345 * Return this window's frame element.
michael@0 1346 * Ignores all chrome/content or mozbrowser boundaries.
michael@0 1347 */
michael@0 1348 readonly attribute nsIDOMElement containerElement;
michael@0 1349
michael@0 1350 [noscript] void RenderDocument(in nsConstRect aRect,
michael@0 1351 in uint32_t aFlags,
michael@0 1352 in nscolor aBackgroundColor,
michael@0 1353 in gfxContext aThebesContext);
michael@0 1354
michael@0 1355 /**
michael@0 1356 * advanceTimeAndRefresh allows the caller to take over the refresh
michael@0 1357 * driver timing for a window. A call to advanceTimeAndRefresh does
michael@0 1358 * three things:
michael@0 1359 * (1) It marks the refresh driver for this presentation so that it
michael@0 1360 * no longer refreshes on its own, but is instead driven entirely
michael@0 1361 * by the caller (except for the refresh that happens when a
michael@0 1362 * document comes out of the bfcache).
michael@0 1363 * (2) It advances the refresh driver's current refresh time by the
michael@0 1364 * argument given. Negative advances are permitted.
michael@0 1365 * (3) It does a refresh (i.e., notifies refresh observers) at that
michael@0 1366 * new time.
michael@0 1367 *
michael@0 1368 * Note that this affects other connected docshells of the same type
michael@0 1369 * in the same docshell tree, such as parent frames.
michael@0 1370 *
michael@0 1371 * When callers have completed their use of advanceTimeAndRefresh,
michael@0 1372 * they must call restoreNormalRefresh.
michael@0 1373 */
michael@0 1374 void advanceTimeAndRefresh(in long long aMilliseconds);
michael@0 1375
michael@0 1376 /**
michael@0 1377 * Undoes the effects of advanceTimeAndRefresh.
michael@0 1378 */
michael@0 1379 void restoreNormalRefresh();
michael@0 1380
michael@0 1381 /**
michael@0 1382 * Reports whether the current state is test-controlled refreshes
michael@0 1383 * (see advanceTimeAndRefresh and restoreNormalRefresh above).
michael@0 1384 */
michael@0 1385 readonly attribute bool isTestControllingRefreshes;
michael@0 1386
michael@0 1387 /**
michael@0 1388 * Set async scroll offset on an element. The next composite will render
michael@0 1389 * with that offset if async scrolling is enabled, and then the offset
michael@0 1390 * will be removed. Only call this while test-controlled refreshes is enabled.
michael@0 1391 */
michael@0 1392 void setAsyncScrollOffset(in nsIDOMNode aNode, in int32_t aX, in int32_t aY);
michael@0 1393
michael@0 1394 /**
michael@0 1395 * Method for testing nsStyleAnimation::ComputeDistance.
michael@0 1396 *
michael@0 1397 * Returns the distance between the two values as reported by
michael@0 1398 * nsStyleAnimation::ComputeDistance for the given element and
michael@0 1399 * property.
michael@0 1400 */
michael@0 1401 double computeAnimationDistance(in nsIDOMElement element,
michael@0 1402 in AString property,
michael@0 1403 in AString value1,
michael@0 1404 in AString value2);
michael@0 1405
michael@0 1406 /**
michael@0 1407 * Wrap an nsIFile in an nsIDOMFile
michael@0 1408 */
michael@0 1409 nsIDOMFile wrapDOMFile(in nsIFile aFile);
michael@0 1410
michael@0 1411 /**
michael@0 1412 * Get the type of the currently focused html input, if any.
michael@0 1413 */
michael@0 1414 readonly attribute string focusedInputType;
michael@0 1415
michael@0 1416 /**
michael@0 1417 * Given a view ID from the compositor process, retrieve the element
michael@0 1418 * associated with a view. For scrollpanes for documents, the root
michael@0 1419 * element of the document is returned.
michael@0 1420 */
michael@0 1421 nsIDOMElement findElementWithViewId(in nsViewID aId);
michael@0 1422
michael@0 1423 /**
michael@0 1424 * Find the view ID for a given element. This is the reverse of
michael@0 1425 * findElementWithViewId().
michael@0 1426 */
michael@0 1427 nsViewID getViewId(in nsIDOMElement aElement);
michael@0 1428
michael@0 1429 /**
michael@0 1430 * Checks the layer tree for this window and returns true
michael@0 1431 * if all layers have transforms that are translations by integers,
michael@0 1432 * no leaf layers overlap, and the union of the leaf layers is exactly
michael@0 1433 * the bounds of the window. Always returns true in non-DEBUG builds.
michael@0 1434 */
michael@0 1435 boolean leafLayersPartitionWindow();
michael@0 1436
michael@0 1437 /**
michael@0 1438 * true if the (current inner) window may have event listeners for touch events.
michael@0 1439 */
michael@0 1440 readonly attribute boolean mayHaveTouchEventListeners;
michael@0 1441
michael@0 1442 /**
michael@0 1443 * Check if any ThebesLayer painting has been done for this element,
michael@0 1444 * clears the painted flags if they have.
michael@0 1445 */
michael@0 1446 boolean checkAndClearPaintedState(in nsIDOMElement aElement);
michael@0 1447
michael@0 1448 /**
michael@0 1449 * Internal file constructor intended for testing of File objects.
michael@0 1450 * Example of constructor usage:
michael@0 1451 * getFile("myfile.txt", [b1, "foo"], { type: "text/plain" })
michael@0 1452 */
michael@0 1453 [optional_argc, implicit_jscontext]
michael@0 1454 nsIDOMFile getFile(in DOMString aName, [optional] in jsval aBlobParts,
michael@0 1455 [optional] in jsval aParameters);
michael@0 1456
michael@0 1457 /**
michael@0 1458 * Internal blob constructor intended for testing of Blob objects.
michael@0 1459 * Example of constructor usage:
michael@0 1460 * getBlob([b1, "foo"], { type: "text/plain" })
michael@0 1461 */
michael@0 1462 [optional_argc, implicit_jscontext]
michael@0 1463 nsIDOMBlob getBlob([optional] in jsval aBlobParts,
michael@0 1464 [optional] in jsval aParameters);
michael@0 1465
michael@0 1466 /**
michael@0 1467 * Get internal id of the stored blob, file or file handle.
michael@0 1468 */
michael@0 1469 [implicit_jscontext] long long getFileId(in jsval aFile);
michael@0 1470
michael@0 1471 /**
michael@0 1472 * Get file ref count info for given database and file id.
michael@0 1473 *
michael@0 1474 */
michael@0 1475 [implicit_jscontext]
michael@0 1476 boolean getFileReferences(in AString aDatabaseName, in long long aId,
michael@0 1477 [optional] in jsval aOptions,
michael@0 1478 [optional] out long aRefCnt,
michael@0 1479 [optional] out long aDBRefCnt,
michael@0 1480 [optional] out long aSliceRefCnt);
michael@0 1481
michael@0 1482 /**
michael@0 1483 * Return whether incremental GC has been disabled due to a binary add-on.
michael@0 1484 */
michael@0 1485 [implicit_jscontext]
michael@0 1486 boolean isIncrementalGCEnabled();
michael@0 1487
michael@0 1488 /**
michael@0 1489 * Begin opcode-level profiling of all JavaScript execution in the window's
michael@0 1490 * runtime.
michael@0 1491 */
michael@0 1492 [implicit_jscontext]
michael@0 1493 void startPCCountProfiling();
michael@0 1494
michael@0 1495 /**
michael@0 1496 * Stop opcode-level profiling of JavaScript execution in the runtime, and
michael@0 1497 * collect all counts for use by getPCCount methods.
michael@0 1498 */
michael@0 1499 [implicit_jscontext]
michael@0 1500 void stopPCCountProfiling();
michael@0 1501
michael@0 1502 /**
michael@0 1503 * Purge collected PC counters.
michael@0 1504 */
michael@0 1505 [implicit_jscontext]
michael@0 1506 void purgePCCounts();
michael@0 1507
michael@0 1508 /**
michael@0 1509 * Get the number of scripts with opcode-level profiling information.
michael@0 1510 */
michael@0 1511 [implicit_jscontext]
michael@0 1512 long getPCCountScriptCount();
michael@0 1513
michael@0 1514 /**
michael@0 1515 * Get a JSON string for a short summary of a script and the PC counts
michael@0 1516 * accumulated for it.
michael@0 1517 */
michael@0 1518 [implicit_jscontext]
michael@0 1519 AString getPCCountScriptSummary(in long script);
michael@0 1520
michael@0 1521 /**
michael@0 1522 * Get a JSON string with full information about a profiled script,
michael@0 1523 * including the decompilation of the script and placement of decompiled
michael@0 1524 * operations within it, and PC counts for each operation.
michael@0 1525 */
michael@0 1526 [implicit_jscontext]
michael@0 1527 AString getPCCountScriptContents(in long script);
michael@0 1528
michael@0 1529 /**
michael@0 1530 * Returns true if painting is suppressed for this window and false
michael@0 1531 * otherwise.
michael@0 1532 */
michael@0 1533 readonly attribute boolean paintingSuppressed;
michael@0 1534
michael@0 1535 /**
michael@0 1536 * Returns an array of plugins on the page for opt-in activation.
michael@0 1537 *
michael@0 1538 * Cannot be accessed from unprivileged context (not content-accessible).
michael@0 1539 * Will throw a DOM security error if called without chrome privileges.
michael@0 1540 *
michael@0 1541 */
michael@0 1542 [implicit_jscontext]
michael@0 1543 readonly attribute jsval plugins;
michael@0 1544
michael@0 1545 /**
michael@0 1546 * Set the scrollport size for the purposes of clamping scroll positions for
michael@0 1547 * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels.
michael@0 1548 *
michael@0 1549 * The caller of this method must have chrome privileges.
michael@0 1550 */
michael@0 1551 void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
michael@0 1552
michael@0 1553 /**
michael@0 1554 * Set margins for the layout of fixed position elements in the content
michael@0 1555 * document. These are used on mobile, where the viewable area can be
michael@0 1556 * temporarily obscured by the browser chrome. In this situation, we're ok
michael@0 1557 * with scrollable page content being obscured, but fixed position content
michael@0 1558 * cannot be revealed without removing the obscuring chrome, so we use these
michael@0 1559 * margins so that it can remain visible.
michael@0 1560 *
michael@0 1561 * The caller of this method must have chrome privileges.
michael@0 1562 */
michael@0 1563 void setContentDocumentFixedPositionMargins(in float aTop, in float aRight,
michael@0 1564 in float aBottom, in float aLeft);
michael@0 1565
michael@0 1566 /**
michael@0 1567 * These are used to control whether dialogs (alert, prompt, confirm) are
michael@0 1568 * allowed.
michael@0 1569 */
michael@0 1570 void disableDialogs();
michael@0 1571 void enableDialogs();
michael@0 1572 bool areDialogsEnabled();
michael@0 1573
michael@0 1574 const unsigned long AGENT_SHEET = 0;
michael@0 1575 const unsigned long USER_SHEET = 1;
michael@0 1576 const unsigned long AUTHOR_SHEET = 2;
michael@0 1577 /**
michael@0 1578 * Synchronously loads a style sheet from |sheetURI| and adds it to the list
michael@0 1579 * of additional style sheets of the document.
michael@0 1580 *
michael@0 1581 * These additional style sheets are very much like user/agent sheets loaded
michael@0 1582 * with loadAndRegisterSheet. The only difference is that they are applied only
michael@0 1583 * on the document owned by this window.
michael@0 1584 *
michael@0 1585 * Sheets added via this API take effect immediately on the document.
michael@0 1586 */
michael@0 1587 void loadSheet(in nsIURI sheetURI,
michael@0 1588 in unsigned long type);
michael@0 1589
michael@0 1590 /**
michael@0 1591 * Remove the document style sheet at |sheetURI| from the list of additional
michael@0 1592 * style sheets of the document. The removal takes effect immediately.
michael@0 1593 */
michael@0 1594 void removeSheet(in nsIURI sheetURI,
michael@0 1595 in unsigned long type);
michael@0 1596
michael@0 1597 /**
michael@0 1598 * Returns true if a user input is being handled.
michael@0 1599 *
michael@0 1600 * This calls EventStateManager::IsHandlingUserInput().
michael@0 1601 */
michael@0 1602 readonly attribute boolean isHandlingUserInput;
michael@0 1603
michael@0 1604 /**
michael@0 1605 * After calling the method, the window for which this DOMWindowUtils
michael@0 1606 * was created can be closed using scripts.
michael@0 1607 */
michael@0 1608 void allowScriptsToClose();
michael@0 1609
michael@0 1610 /**
michael@0 1611 * Is the parent window's main widget visible? If it isn't, we probably
michael@0 1612 * don't want to display any dialogs etc it may request. This corresponds
michael@0 1613 * to the visibility check in nsWindowWatcher::OpenWindowInternal().
michael@0 1614 *
michael@0 1615 * Will throw a DOM security error if called without chrome privileges or
michael@0 1616 * NS_ERROR_NOT_AVAILABLE in the unlikely event that the parent window's
michael@0 1617 * main widget can't be reached.
michael@0 1618 */
michael@0 1619 readonly attribute boolean isParentWindowMainWidgetVisible;
michael@0 1620
michael@0 1621 /**
michael@0 1622 * In certain cases the event handling of nodes, form controls in practice,
michael@0 1623 * may be disabled. Such cases are for example the existence of disabled
michael@0 1624 * attribute or -moz-user-input: none/disabled.
michael@0 1625 */
michael@0 1626 boolean isNodeDisabledForEvents(in nsIDOMNode aNode);
michael@0 1627
michael@0 1628 /**
michael@0 1629 * Setting paintFlashing to true will flash newly painted area.
michael@0 1630 */
michael@0 1631 attribute boolean paintFlashing;
michael@0 1632
michael@0 1633 /**
michael@0 1634 * Allows running of a "synchronous section", in the form of an nsIRunnable
michael@0 1635 * once the event loop has reached a "stable state". We've reached a stable
michael@0 1636 * state when the currently executing task/event has finished, see:
michael@0 1637 * http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#synchronous-section
michael@0 1638 * In practice this runs aRunnable once the currently executing event
michael@0 1639 * finishes. If called multiple times per task/event, all the runnables will
michael@0 1640 * be executed, in the order in which runInStableState() was called.
michael@0 1641 *
michael@0 1642 * XXX - This can wreak havoc if you're not using this for very simple
michael@0 1643 * purposes, eg testing or setting a flag.
michael@0 1644 */
michael@0 1645 void runInStableState(in nsIRunnable runnable);
michael@0 1646
michael@0 1647 /**
michael@0 1648 * Run the given runnable before the next iteration of the event loop (this
michael@0 1649 * includes native events too). If a nested loop is spawned within the current
michael@0 1650 * event then the runnable will not be run until that loop has terminated.
michael@0 1651 *
michael@0 1652 * XXX - This can wreak havoc if you're not using this for very simple
michael@0 1653 * purposes, eg testing or setting a flag.
michael@0 1654 */
michael@0 1655 void runBeforeNextEvent(in nsIRunnable runnable);
michael@0 1656
michael@0 1657 /*
michael@0 1658 * Returns the value of a given property animated on the compositor thread.
michael@0 1659 * If the property is NOT currently being animated on the compositor thread,
michael@0 1660 * returns an empty string.
michael@0 1661 */
michael@0 1662 AString getOMTAStyle(in nsIDOMElement aElement, in AString aProperty);
michael@0 1663
michael@0 1664 /*
michael@0 1665 * Returns the value of a given property. If the property is animated off
michael@0 1666 * the main thread, this function will fetch the correct value from the
michael@0 1667 * compositor.
michael@0 1668 */
michael@0 1669 AString getOMTAOrComputedStyle(in nsIDOMElement aElement,
michael@0 1670 in AString aProperty);
michael@0 1671
michael@0 1672 /**
michael@0 1673 * With this it's possible to mute all the MediaElements in this window.
michael@0 1674 * We have audioMuted and audioVolume to preserve the volume across
michael@0 1675 * mute/umute.
michael@0 1676 */
michael@0 1677 attribute boolean audioMuted;
michael@0 1678
michael@0 1679 /**
michael@0 1680 * range: greater or equal to 0. The real volume level is affected by the
michael@0 1681 * volume of all ancestor windows.
michael@0 1682 */
michael@0 1683 attribute float audioVolume;
michael@0 1684 };
michael@0 1685
michael@0 1686 [scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
michael@0 1687 interface nsITranslationNodeList : nsISupports {
michael@0 1688 readonly attribute unsigned long length;
michael@0 1689 nsIDOMNode item(in unsigned long index);
michael@0 1690
michael@0 1691 // A translation root is a block element, or an inline element
michael@0 1692 // which its parent is not a translation node.
michael@0 1693 boolean isTranslationRootAtIndex(in unsigned long index);
michael@0 1694 };

mercurial