michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * nsIDOMWindowUtils is intended for infrequently-used methods related michael@0: * to the current nsIDOMWindow. Some of the methods may require michael@0: * elevated privileges; the method implementations should contain the michael@0: * necessary security checks. Access this interface by calling michael@0: * getInterface on a DOMWindow. michael@0: */ michael@0: michael@0: %{C++ michael@0: #include "nsColor.h" michael@0: class gfxContext; michael@0: class nsRect; michael@0: %} michael@0: michael@0: [ref] native nsConstRect(const nsRect); michael@0: native nscolor(nscolor); michael@0: [ptr] native gfxContext(gfxContext); michael@0: typedef unsigned long long nsViewID; michael@0: michael@0: interface nsICycleCollectorListener; michael@0: interface nsIDOMNode; michael@0: interface nsIDOMNodeList; michael@0: interface nsIDOMElement; michael@0: interface nsIDOMHTMLCanvasElement; michael@0: interface nsIDOMEvent; michael@0: interface nsITransferable; michael@0: interface nsIQueryContentEventResult; michael@0: interface nsIDOMWindow; michael@0: interface nsIDOMBlob; michael@0: interface nsIDOMFile; michael@0: interface nsIFile; michael@0: interface nsIDOMClientRect; michael@0: interface nsIURI; michael@0: interface nsIDOMEventTarget; michael@0: interface nsIRunnable; michael@0: interface nsICompositionStringSynthesizer; michael@0: interface nsITranslationNodeList; michael@0: michael@0: [scriptable, uuid(d4ed34fc-9c07-4cef-b9e1-623794558db3)] michael@0: interface nsIDOMWindowUtils : nsISupports { michael@0: michael@0: /** michael@0: * Image animation mode of the window. When this attribute's value michael@0: * is changed, the implementation should set all images in the window michael@0: * to the given value. That is, when set to kDontAnimMode, all images michael@0: * will stop animating. The attribute's value must be one of the michael@0: * animationMode values from imgIContainer. michael@0: * @note Images may individually override the window's setting after michael@0: * the window's mode is set. Therefore images given different modes michael@0: * since the last setting of the window's mode may behave michael@0: * out of line with the window's overall mode. michael@0: * @note The attribute's value is the window's overall mode. It may michael@0: * for example continue to report kDontAnimMode after all images michael@0: * have subsequently been individually animated. michael@0: * @note Only images immediately in this window are affected; michael@0: * this is not recursive to subwindows. michael@0: * @see imgIContainer michael@0: */ michael@0: attribute unsigned short imageAnimationMode; michael@0: michael@0: /** michael@0: * Whether the charset of the window's current document has been forced by michael@0: * the user. michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: */ michael@0: readonly attribute boolean docCharsetIsForced; michael@0: michael@0: /** michael@0: * Get current cursor type from this window michael@0: * @return the current value of nsCursor michael@0: */ michael@0: short getCursorType(); michael@0: michael@0: /** michael@0: * Function to get metadata associated with the window's current document michael@0: * @param aName the name of the metadata. This should be all lowercase. michael@0: * @return the value of the metadata, or the empty string if it's not set michael@0: * michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: */ michael@0: AString getDocumentMetadata(in AString aName); michael@0: michael@0: /** michael@0: * Force an immediate redraw of this window. The parameter specifies michael@0: * the number of times to redraw, and the return value is the length, michael@0: * in milliseconds, that the redraws took. If aCount is not specified michael@0: * or is 0, it is taken to be 1. michael@0: */ michael@0: unsigned long redraw([optional] in unsigned long aCount); michael@0: michael@0: /** michael@0: * Set the CSS viewport to be |widthPx| x |heightPx| in units of CSS michael@0: * pixels, regardless of the size of the enclosing widget/view. michael@0: * This will trigger reflow. michael@0: * michael@0: * The caller of this method must have chrome privileges. michael@0: */ michael@0: void setCSSViewport(in float aWidthPx, in float aHeightPx); michael@0: michael@0: /** michael@0: * Information retrieved from the tag. michael@0: * See nsContentUtils::GetViewportInfo for more information. michael@0: */ michael@0: void getViewportInfo(in uint32_t aDisplayWidth, in uint32_t aDisplayHeight, michael@0: out double aDefaultZoom, out boolean aAllowZoom, michael@0: out double aMinZoom, out double aMaxZoom, michael@0: out uint32_t aWidth, out uint32_t aHeight, michael@0: out boolean aAutoSize); michael@0: michael@0: /** michael@0: * For any scrollable element, this allows you to override the michael@0: * visible region and draw more than what is visible, which is michael@0: * useful for asynchronous drawing. The "displayport" will be michael@0: * in units of CSS pixels, michael@0: * regardless of the size of the enclosing container. This michael@0: * will *not* trigger reflow. michael@0: * michael@0: * For the root scroll area, pass in the root document element. michael@0: * For scrollable elements, pass in the container element (for michael@0: * instance, the element with overflow: scroll). michael@0: * michael@0: * is relative to the top-left of what would normally be michael@0: * the visible area of the element. This means that the pixels michael@0: * rendered to the displayport take scrolling into account, michael@0: * for example. michael@0: * michael@0: * It's legal to set a displayport that extends beyond the overflow michael@0: * area in any direction (left/right/top/bottom). michael@0: * michael@0: * It's also legal to set a displayport that extends beyond the michael@0: * area's bounds. No pixels are rendered outside the area bounds. michael@0: * michael@0: * The caller of this method must have chrome privileges. michael@0: * michael@0: * Calling this will always force a recomposite, so it should be michael@0: * avoided if at all possible. Client code should do checks before michael@0: * calling this so that duplicate sets are not made with the same michael@0: * displayport. michael@0: * michael@0: * aPriority is recorded along with the displayport rectangle. If this michael@0: * method is called with a lower priority than the current priority, the michael@0: * call is ignored. michael@0: */ michael@0: void setDisplayPortForElement(in float aXPx, in float aYPx, michael@0: in float aWidthPx, in float aHeightPx, michael@0: in nsIDOMElement aElement, michael@0: in uint32_t aPriority); michael@0: /** michael@0: * An alternate way to represent a displayport rect as a set of margins and a michael@0: * base rect to apply those margins to. A consumer of pixels may ask for as michael@0: * many extra pixels as it would like in each direction. Layout then sets michael@0: * the base rect to the "visible rect" of the element, which is just the michael@0: * subrect of the element that is drawn (it does not take in account content michael@0: * covering the element). michael@0: * michael@0: * If both a displayport rect and displayport margins with corresponding base michael@0: * rect are set with the same priority then the margins will take precendence. michael@0: * michael@0: * Specifying an alignment value will ensure that after the base rect has michael@0: * been expanded by the displayport margins, it will be further expanded so michael@0: * that each edge is located at a multiple of the "alignment" value. michael@0: * michael@0: * Note that both the margin values and alignment are treated as values in michael@0: * LayerPixels. Refer to layout/base/Units.h for a description of this unit. michael@0: * The base rect values are in app units. michael@0: */ michael@0: void setDisplayPortMarginsForElement(in float aLeftMargin, michael@0: in float aTopMargin, michael@0: in float aRightMargin, michael@0: in float aBottomMargin, michael@0: in uint32_t aAlignmentX, michael@0: in uint32_t aAlignmentY, michael@0: in nsIDOMElement aElement, michael@0: in uint32_t aPriority); michael@0: michael@0: void setDisplayPortBaseForElement(in int32_t aX, michael@0: in int32_t aY, michael@0: in int32_t aWidth, michael@0: in int32_t aHeight, michael@0: in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * When a display port is set, this allows a sub-section of that michael@0: * display port to be marked as 'critical'. In this scenario, the michael@0: * area outside of this rectangle may be rendered at a lower michael@0: * detail (for example, by reducing its resolution), or not rendered michael@0: * at all under some circumstances. michael@0: * This call will have no effect if a display port has not been set. michael@0: */ michael@0: void setCriticalDisplayPortForElement(in float aXPx, in float aYPx, michael@0: in float aWidthPx, in float aHeightPx, michael@0: in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Get/set the resolution at which rescalable web content is drawn. michael@0: * Currently this is only (some) thebes content. michael@0: * michael@0: * Setting a new resolution does *not* trigger reflow. This API is michael@0: * entirely separate from textZoom and fullZoom; a resolution scale michael@0: * can be applied together with both textZoom and fullZoom. michael@0: * michael@0: * The effect of is API for gfx code to allocate more or fewer michael@0: * pixels for rescalable content by a factor of |resolution| in michael@0: * either or both dimensions. setResolution() together with michael@0: * setDisplayport() can be used to implement a non-reflowing michael@0: * scale-zoom in concert with another entity that can draw with a michael@0: * scale. For example, to scale a content |window| inside a michael@0: * by a factor of 2.0 michael@0: * michael@0: * window.setDisplayport(x, y, oldW / 2.0, oldH / 2.0); michael@0: * window.setResolution(2.0, 2.0); michael@0: * // elsewhere michael@0: * browser.setViewportScale(2.0, 2.0); michael@0: * michael@0: * The caller of this method must have chrome privileges. michael@0: */ michael@0: void setResolution(in float aXResolution, in float aYResolution); michael@0: michael@0: void getResolution(out float aXResolution, out float aYResolution); michael@0: michael@0: /** michael@0: * Whether the resolution has been set by the user. michael@0: * This gives a way to check whether the provided resolution is the default michael@0: * value or restored from a previous session. michael@0: * michael@0: * Can only be accessed with chrome privileges. michael@0: */ michael@0: readonly attribute boolean isResolutionSet; michael@0: michael@0: /** michael@0: * Whether the next paint should be flagged as the first paint for a document. michael@0: * This gives a way to track the next paint that occurs after the flag is michael@0: * set. The flag gets cleared after the next paint. michael@0: * michael@0: * Can only be accessed with chrome privileges. michael@0: */ michael@0: attribute boolean isFirstPaint; michael@0: michael@0: void getPresShellId(out uint32_t aPresShellId); michael@0: michael@0: /** michael@0: * Following modifiers are for sent*Event() except sendNative*Event(). michael@0: * NOTE: MODIFIER_ALT, MODIFIER_CONTROL, MODIFIER_SHIFT and MODIFIER_META michael@0: * are must be same values as nsIDOMNSEvent::*_MASK for backward michael@0: * compatibility. michael@0: */ michael@0: const long MODIFIER_ALT = 0x0001; michael@0: const long MODIFIER_CONTROL = 0x0002; michael@0: const long MODIFIER_SHIFT = 0x0004; michael@0: const long MODIFIER_META = 0x0008; michael@0: const long MODIFIER_ALTGRAPH = 0x0010; michael@0: const long MODIFIER_CAPSLOCK = 0x0020; michael@0: const long MODIFIER_FN = 0x0040; michael@0: const long MODIFIER_NUMLOCK = 0x0080; michael@0: const long MODIFIER_SCROLLLOCK = 0x0100; michael@0: const long MODIFIER_SYMBOLLOCK = 0x0200; michael@0: const long MODIFIER_OS = 0x0400; michael@0: michael@0: /** Synthesize a mouse event. The event types supported are: michael@0: * mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu, michael@0: * MozMouseHitTest michael@0: * michael@0: * Events are sent in coordinates offset by aX and aY from the window. michael@0: * michael@0: * Note that additional events may be fired as a result of this call. For michael@0: * instance, typically a click event will be fired as a result of a michael@0: * mousedown and mouseup in sequence. michael@0: * michael@0: * Normally at this level of events, the mouseover and mouseout events are michael@0: * only fired when the window is entered or exited. For inter-element michael@0: * mouseover and mouseout events, a movemove event fired on the new element michael@0: * should be sufficient to generate the correct over and out events as well. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * The event is dispatched via the toplevel window, so it could go to any michael@0: * window under the toplevel window, in some cases it could never reach this michael@0: * window at all. michael@0: * michael@0: * @param aType event type michael@0: * @param aX x offset in CSS pixels michael@0: * @param aY y offset in CSS pixels michael@0: * @param aButton button to synthesize michael@0: * @param aClickCount number of clicks that have been performed michael@0: * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* michael@0: * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds michael@0: * during dispatch michael@0: * @param aPressure touch input pressure: 0.0 -> 1.0 michael@0: * @param aInputSourceArg input source, see nsIDOMMouseEvent for values, michael@0: * defaults to mouse input. michael@0: * @param aIsSynthesized controls nsIDOMEvent.isSynthesized value michael@0: * that helps identifying test related events, michael@0: * defaults to true michael@0: * michael@0: * returns true if the page called prevent default on this event michael@0: */ michael@0: [optional_argc] michael@0: boolean sendMouseEvent(in AString aType, michael@0: in float aX, michael@0: in float aY, michael@0: in long aButton, michael@0: in long aClickCount, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame, michael@0: [optional] in float aPressure, michael@0: [optional] in unsigned short aInputSourceArg, michael@0: [optional] in boolean aIsSynthesized); michael@0: michael@0: michael@0: /** Synthesize a pointer event. The event types supported are: michael@0: * pointerdown, pointerup, pointermove, pointerover, pointerout michael@0: * michael@0: * Events are sent in coordinates offset by aX and aY from the window. michael@0: * michael@0: * Note that additional events may be fired as a result of this call. For michael@0: * instance, typically a click event will be fired as a result of a michael@0: * mousedown and mouseup in sequence. michael@0: * michael@0: * Normally at this level of events, the pointerover and pointerout events are michael@0: * only fired when the window is entered or exited. For inter-element michael@0: * pointerover and pointerout events, a movemove event fired on the new element michael@0: * should be sufficient to generate the correct over and out events as well. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * The event is dispatched via the toplevel window, so it could go to any michael@0: * window under the toplevel window, in some cases it could never reach this michael@0: * window at all. michael@0: * michael@0: * @param aType event type michael@0: * @param aX x offset in CSS pixels michael@0: * @param aY y offset in CSS pixels michael@0: * @param aButton button to synthesize michael@0: * @param aClickCount number of clicks that have been performed michael@0: * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* michael@0: * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds michael@0: * during dispatch michael@0: * @param aPressure touch input pressure: 0.0 -> 1.0 michael@0: * @param aInputSourceArg input source, see nsIDOMMouseEvent for values, michael@0: * defaults to mouse input. michael@0: * @param aPointerId A unique identifier for the pointer causing the event. default is 0 michael@0: * @param aWidth The width (magnitude on the X axis), default is 0 michael@0: * @param aHeight The height (magnitude on the Y axis), default is 0 michael@0: * @param aTilt The plane angle between the Y-Z plane michael@0: * and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis. default is 0 michael@0: * @param aTiltX The plane angle between the X-Z plane michael@0: * and the plane containing both the transducer (e.g. pen stylus) axis and the X axis. default is 0 michael@0: * @param aIsPrimary Indicates if the pointer represents the primary pointer of this pointer type. michael@0: * @param aIsSynthesized controls nsIDOMEvent.isSynthesized value michael@0: * that helps identifying test related events, michael@0: * defaults to true michael@0: * michael@0: * returns true if the page called prevent default on this event michael@0: */ michael@0: michael@0: [optional_argc] michael@0: boolean sendPointerEvent(in AString aType, michael@0: in float aX, michael@0: in float aY, michael@0: in long aButton, michael@0: in long aClickCount, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame, michael@0: [optional] in float aPressure, michael@0: [optional] in unsigned short aInputSourceArg, michael@0: [optional] in long aPointerId, michael@0: [optional] in long aWidth, michael@0: [optional] in long aHeight, michael@0: [optional] in long tiltX, michael@0: [optional] in long tiltY, michael@0: [optional] in boolean aIsPrimary, michael@0: [optional] in boolean aIsSynthesized); michael@0: michael@0: /** Synthesize a touch event. The event types supported are: michael@0: * touchstart, touchend, touchmove, and touchcancel michael@0: * michael@0: * Events are sent in coordinates offset by aX and aY from the window. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * The event is dispatched via the toplevel window, so it could go to any michael@0: * window under the toplevel window, in some cases it could never reach this michael@0: * window at all. michael@0: * michael@0: * @param aType event type michael@0: * @param xs array of offsets in CSS pixels for each touch to be sent michael@0: * @param ys array of offsets in CSS pixels for each touch to be sent michael@0: * @param rxs array of radii in CSS pixels for each touch to be sent michael@0: * @param rys array of radii in CSS pixels for each touch to be sent michael@0: * @param rotationAngles array of angles in degrees for each touch to be sent michael@0: * @param forces array of forces (floats from 0 to 1) for each touch to be sent michael@0: * @param count number of touches in this set michael@0: * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* michael@0: * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds michael@0: * during dispatch michael@0: * michael@0: * returns true if the page called prevent default on this touch event michael@0: */ michael@0: boolean sendTouchEvent(in AString aType, michael@0: [array, size_is(count)] in uint32_t aIdentifiers, michael@0: [array, size_is(count)] in int32_t aXs, michael@0: [array, size_is(count)] in int32_t aYs, michael@0: [array, size_is(count)] in uint32_t aRxs, michael@0: [array, size_is(count)] in uint32_t aRys, michael@0: [array, size_is(count)] in float aRotationAngles, michael@0: [array, size_is(count)] in float aForces, michael@0: in uint32_t count, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame); michael@0: michael@0: /** The same as sendMouseEvent but ensures that the event is dispatched to michael@0: * this DOM window or one of its children. michael@0: */ michael@0: [optional_argc] michael@0: void sendMouseEventToWindow(in AString aType, michael@0: in float aX, michael@0: in float aY, michael@0: in long aButton, michael@0: in long aClickCount, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame, michael@0: [optional] in float aPressure, michael@0: [optional] in unsigned short aInputSourceArg, michael@0: [optional] in boolean aIsSynthesized); michael@0: michael@0: /** The same as sendTouchEvent but ensures that the event is dispatched to michael@0: * this DOM window or one of its children. michael@0: */ michael@0: boolean sendTouchEventToWindow(in AString aType, michael@0: [array, size_is(count)] in uint32_t aIdentifiers, michael@0: [array, size_is(count)] in int32_t aXs, michael@0: [array, size_is(count)] in int32_t aYs, michael@0: [array, size_is(count)] in uint32_t aRxs, michael@0: [array, size_is(count)] in uint32_t aRys, michael@0: [array, size_is(count)] in float aRotationAngles, michael@0: [array, size_is(count)] in float aForces, michael@0: in uint32_t count, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame); michael@0: michael@0: /** Synthesize a wheel event for a window. The event types supported is only michael@0: * wheel. michael@0: * michael@0: * Events are sent in coordinates offset by aX and aY from the window. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aX x offset in CSS pixels michael@0: * @param aY y offset in CSS pixels michael@0: * @param aDeltaX deltaX value. michael@0: * @param aDeltaY deltaY value. michael@0: * @param aDeltaZ deltaZ value. michael@0: * @param aDeltaMode deltaMode value which must be one of michael@0: * nsIDOMWheelEvent::DOM_DELTA_*. michael@0: * @param aModifiers modifiers pressed, using constants defined as michael@0: * MODIFIER_* michael@0: * @param aLineOrPageDeltaX If you set this value non-zero for michael@0: * DOM_DELTA_PIXEL event, EventStateManager will michael@0: * dispatch NS_MOUSE_SCROLL event for horizontal michael@0: * scroll. michael@0: * @param aLineOrPageDeltaY If you set this value non-zero for michael@0: * DOM_DELTA_PIXEL event, EventStateManager will michael@0: * dispatch NS_MOUSE_SCROLL event for vertical michael@0: * scroll. michael@0: * @param aOptions Set following flags. michael@0: */ michael@0: const unsigned long WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE = 0x0001; michael@0: const unsigned long WHEEL_EVENT_CAUSED_BY_MOMENTUM = 0x0002; michael@0: const unsigned long WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS = 0x0004; michael@0: // If any of the following flags is specified this method will throw an michael@0: // exception in case the relevant overflowDelta has an unexpected value. michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO = 0x0010; michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE = 0x0020; michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE = 0x0040; michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO = 0x0100; michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE = 0x0200; michael@0: const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE = 0x0400; michael@0: void sendWheelEvent(in float aX, michael@0: in float aY, michael@0: in double aDeltaX, michael@0: in double aDeltaY, michael@0: in double aDeltaZ, michael@0: in unsigned long aDeltaMode, michael@0: in long aModifiers, michael@0: in long aLineOrPageDeltaX, michael@0: in long aLineOrPageDeltaY, michael@0: in unsigned long aOptions); michael@0: michael@0: /** michael@0: * Synthesize a key event to the window. The event types supported are: michael@0: * keydown, keyup, keypress michael@0: * michael@0: * Key events generally end up being sent to the focused node. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aType event type michael@0: * @param aKeyCode key code michael@0: * @param aCharCode character code michael@0: * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* michael@0: * @param aAdditionalFlags special flags for the key event, see KEY_FLAG_*. michael@0: * michael@0: * @return false if the event had preventDefault() called on it, michael@0: * true otherwise. In other words, true if and only if the michael@0: * default action was taken. michael@0: */ michael@0: michael@0: // If this is set, preventDefault() the event before dispatch. michael@0: const unsigned long KEY_FLAG_PREVENT_DEFAULT = 0x0001; michael@0: michael@0: // if one of these flags is set, the KeyboardEvent.location will be the value. michael@0: // Otherwise, it will be computed from aKeyCode. michael@0: const unsigned long KEY_FLAG_LOCATION_STANDARD = 0x0010; michael@0: const unsigned long KEY_FLAG_LOCATION_LEFT = 0x0020; michael@0: const unsigned long KEY_FLAG_LOCATION_RIGHT = 0x0040; michael@0: const unsigned long KEY_FLAG_LOCATION_NUMPAD = 0x0080; michael@0: const unsigned long KEY_FLAG_LOCATION_MOBILE = 0x0100; michael@0: const unsigned long KEY_FLAG_LOCATION_JOYSTICK = 0x0200; michael@0: michael@0: boolean sendKeyEvent(in AString aType, michael@0: in long aKeyCode, michael@0: in long aCharCode, michael@0: in long aModifiers, michael@0: [optional] in unsigned long aAdditionalFlags); michael@0: michael@0: /** michael@0: * See nsIWidget::SynthesizeNativeKeyEvent michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * When you use this for tests, use the constants defined in NativeKeyCodes.js michael@0: */ michael@0: void sendNativeKeyEvent(in long aNativeKeyboardLayout, michael@0: in long aNativeKeyCode, michael@0: in long aModifierFlags, michael@0: in AString aCharacters, michael@0: in AString aUnmodifiedCharacters); michael@0: michael@0: /** michael@0: * See nsIWidget::SynthesizeNativeMouseEvent michael@0: * michael@0: * Will be called on the widget that contains aElement. michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: */ michael@0: void sendNativeMouseEvent(in long aScreenX, michael@0: in long aScreenY, michael@0: in long aNativeMessage, michael@0: in long aModifierFlags, michael@0: in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * The values for sendNativeMouseScrollEvent's aAdditionalFlags. michael@0: */ michael@0: michael@0: /** michael@0: * If MOUSESCROLL_PREFER_WIDGET_AT_POINT is set, widget will dispatch michael@0: * the event to a widget which is under the cursor. Otherwise, dispatch to michael@0: * a default target on the platform. E.g., on Windows, it's focused window. michael@0: */ michael@0: const unsigned long MOUSESCROLL_PREFER_WIDGET_AT_POINT = 0x00000001; michael@0: michael@0: /** michael@0: * The platform specific values of aAdditionalFlags. Must be over 0x00010000. michael@0: */ michael@0: michael@0: /** michael@0: * If MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL is set and aNativeMessage is michael@0: * WM_VSCROLL or WM_HSCROLL, widget will set the window handle to the lParam michael@0: * instead of NULL. michael@0: */ michael@0: const unsigned long MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL = 0x00010000; michael@0: michael@0: /** michael@0: * See nsIWidget::SynthesizeNativeMouseScrollEvent michael@0: * michael@0: * Will be called on the widget that contains aElement. michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * NOTE: The synthesized native event may be fired asynchronously. michael@0: * michael@0: * @param aNativeMessage michael@0: * On Windows: WM_MOUSEWHEEL (0x020A), WM_MOUSEHWHEEL(0x020E), michael@0: * WM_VSCROLL (0x0115) or WM_HSCROLL (0x114). michael@0: */ michael@0: void sendNativeMouseScrollEvent(in long aScreenX, michael@0: in long aScreenY, michael@0: in unsigned long aNativeMessage, michael@0: in double aDeltaX, michael@0: in double aDeltaY, michael@0: in double aDeltaZ, michael@0: in unsigned long aModifierFlags, michael@0: in unsigned long aAdditionalFlags, michael@0: in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Touch states for sendNativeTouchPoint. These values match michael@0: * nsIWidget's TouchPointerState. michael@0: */ michael@0: michael@0: // The pointer is in a hover state above the digitizer michael@0: const long TOUCH_HOVER = 0x01; michael@0: // The pointer is in contact with the digitizer michael@0: const long TOUCH_CONTACT = 0x02; michael@0: // The pointer has been removed from the digitizer detection area michael@0: const long TOUCH_REMOVE = 0x04; michael@0: // The pointer has been canceled. Will cancel any pending os level michael@0: // gestures that would be triggered as a result of completion of the michael@0: // input sequence. This may not cancel moz platform related events michael@0: // that might get tirggered by input already delivered. michael@0: const long TOUCH_CANCEL = 0x08; michael@0: michael@0: /** michael@0: * Create a new or update an existing touch point on the digitizer. michael@0: * To trigger os level gestures, individual touch points should michael@0: * transition through a complete set of touch states which should be michael@0: * sent as individual calls. For example: michael@0: * tap - msg1:TOUCH_CONTACT, msg2:TOUCH_REMOVE michael@0: * drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE michael@0: * hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE michael@0: * michael@0: * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will michael@0: * throw. michael@0: * michael@0: * @param aPointerId The touch point id to create or update. michael@0: * @param aTouchState one or more of the touch states listed above michael@0: * @param aScreenX, aScreenY screen coords of this event michael@0: * @param aPressure 0.0 -> 1.0 float val indicating pressure michael@0: * @param aOrientation 0 -> 359 degree value indicating the michael@0: * orientation of the pointer. Use 90 for normal taps. michael@0: */ michael@0: void sendNativeTouchPoint(in unsigned long aPointerId, michael@0: in unsigned long aTouchState, michael@0: in long aScreenX, michael@0: in long aScreenY, michael@0: in double aPressure, michael@0: in unsigned long aOrientation); michael@0: michael@0: /** michael@0: * Simulates native touch based taps on the input digitizer. Events michael@0: * triggered by this call are injected at the os level. Events do not michael@0: * bypass widget level input processing and as such can be used to michael@0: * test widget event logic and async pan-zoom controller functionality. michael@0: * Cannot be accessed from an unprivileged context. michael@0: * michael@0: * Long taps (based on the aLongTap parameter) will be completed michael@0: * asynchrnously after the call returns. Long tap delay is based on michael@0: * the ui.click_hold_context_menus.delay pref or 1500 msec if pref michael@0: * is not set. michael@0: * michael@0: * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will michael@0: * throw. michael@0: * michael@0: * @param aScreenX, aScreenY screen coords of this event michael@0: * @param aLongTap true if the tap should be long, false for a short michael@0: * tap. michael@0: */ michael@0: void sendNativeTouchTap(in long aScreenX, michael@0: in long aScreenY, michael@0: in boolean aLongTap); michael@0: michael@0: /** michael@0: * Cancel any existing touch points or long tap delays. Calling this is safe michael@0: * even if you're sure there aren't any pointers recorded. You should call michael@0: * this when tests shut down to reset the digitizer driver. Not doing so can michael@0: * leave the digitizer in an undetermined state which can screw up subsequent michael@0: * tests and native input. michael@0: */ michael@0: void clearNativeTouchSequence(); michael@0: michael@0: /** michael@0: * See nsIWidget::ActivateNativeMenuItemAt michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: */ michael@0: void activateNativeMenuItemAt(in AString indexString); michael@0: michael@0: /** michael@0: * See nsIWidget::ForceUpdateNativeMenuAt michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: */ michael@0: void forceUpdateNativeMenuAt(in AString indexString); michael@0: michael@0: /** michael@0: * Focus the element aElement. The element should be in the same document michael@0: * that the window is displaying. Pass null to blur the element, if any, michael@0: * that currently has focus, and focus the document. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aElement the element to focus michael@0: * michael@0: * Do not use this method. Just use element.focus if available or michael@0: * nsIFocusManager::SetFocus instead. michael@0: * michael@0: */ michael@0: void focus(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Force a garbage collection followed by a cycle collection. michael@0: * michael@0: * Will throw a DOM security error if called without chrome privileges in michael@0: * non-debug builds. Available to all callers in debug builds. michael@0: * michael@0: * @param aListener listener that receives information about the CC graph michael@0: * (see @mozilla.org/cycle-collector-logger;1 for a logger michael@0: * component) michael@0: * @param aExtraForgetSkippableCalls indicates how many times michael@0: * nsCycleCollector_forgetSkippable will michael@0: * be called before running cycle collection. michael@0: * -1 prevents the default michael@0: * nsCycleCollector_forgetSkippable call michael@0: * which happens after garbage collection. michael@0: */ michael@0: void garbageCollect([optional] in nsICycleCollectorListener aListener, michael@0: [optional] in long aExtraForgetSkippableCalls); michael@0: michael@0: /** michael@0: * Force a cycle collection without garbage collection. michael@0: * michael@0: * Will throw a DOM security error if called without chrome privileges in michael@0: * non-debug builds. Available to all callers in debug builds. michael@0: * michael@0: * @param aListener listener that receives information about the CC graph michael@0: * (see @mozilla.org/cycle-collector-logger;1 for a logger michael@0: * component) michael@0: * @param aExtraForgetSkippableCalls indicates how many times michael@0: * nsCycleCollector_forgetSkippable will michael@0: * be called before running cycle collection. michael@0: * -1 prevents the default michael@0: * nsCycleCollector_forgetSkippable call michael@0: * which happens after garbage collection. michael@0: */ michael@0: void cycleCollect([optional] in nsICycleCollectorListener aListener, michael@0: [optional] in long aExtraForgetSkippableCalls); michael@0: michael@0: /** michael@0: * Trigger whichever GC or CC timer is currently active and waiting to fire. michael@0: * Don't do this too much for initiating heavy actions, like the start of a IGC. michael@0: */ michael@0: void runNextCollectorTimer(); michael@0: michael@0: /** Synthesize a simple gesture event for a window. The event types michael@0: * supported are: MozSwipeGestureStart, MozSwipeGestureUpdate, michael@0: * MozSwipeGestureEnd, MozSwipeGesture, MozMagnifyGestureStart, michael@0: * MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart, michael@0: * MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, michael@0: * MozTapGesture, and MozEdgeUIGesture. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not michael@0: * content-accessible) Will throw a DOM security error if called michael@0: * without chrome privileges. michael@0: * michael@0: * @param aType event type michael@0: * @param aX x offset in CSS pixels michael@0: * @param aY y offset in CSS pixels michael@0: * @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent michael@0: * @param aDelta amount of magnification or rotation for magnify and rotation events michael@0: * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent michael@0: * @param aClickCount For tap gestures, the number of taps. michael@0: */ michael@0: void sendSimpleGestureEvent(in AString aType, michael@0: in float aX, michael@0: in float aY, michael@0: in unsigned long aDirection, michael@0: in double aDelta, michael@0: in long aModifiers, michael@0: [optional] in unsigned long aClickCount); michael@0: michael@0: /** michael@0: * Retrieve the element at point aX, aY in the window's document. michael@0: * michael@0: * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll michael@0: * frame when retrieving the element. If false, this method returns michael@0: * null for coordinates outside of the viewport. michael@0: * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. michael@0: */ michael@0: nsIDOMElement elementFromPoint(in float aX, michael@0: in float aY, michael@0: in boolean aIgnoreRootScrollFrame, michael@0: in boolean aFlushLayout); michael@0: michael@0: /** michael@0: * Retrieve all nodes that intersect a rect in the window's document. michael@0: * michael@0: * @param aX x reference for the rectangle in CSS pixels michael@0: * @param aY y reference for the rectangle in CSS pixels michael@0: * @param aTopSize How much to expand up the rectangle michael@0: * @param aRightSize How much to expand right the rectangle michael@0: * @param aBottomSize How much to expand down the rectangle michael@0: * @param aLeftSize How much to expand left the rectangle michael@0: * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll michael@0: * frame when retrieving the element. If false, this method returns michael@0: * null for coordinates outside of the viewport. michael@0: * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. michael@0: */ michael@0: nsIDOMNodeList nodesFromRect(in float aX, michael@0: in float aY, michael@0: in float aTopSize, michael@0: in float aRightSize, michael@0: in float aBottomSize, michael@0: in float aLeftSize, michael@0: in boolean aIgnoreRootScrollFrame, michael@0: in boolean aFlushLayout); michael@0: michael@0: michael@0: /** michael@0: * Get a list of nodes that have meaningful textual content to michael@0: * be translated. The implementation of this algorithm is in flux michael@0: * as we experiment and refine which approach works best. michael@0: * michael@0: * This method requires chrome privileges. michael@0: */ michael@0: nsITranslationNodeList getTranslationNodes(in nsIDOMNode aRoot); michael@0: michael@0: /** michael@0: * Compare the two canvases, returning the number of differing pixels and michael@0: * the maximum difference in a channel. This will throw an error if michael@0: * the dimensions of the two canvases are different. michael@0: * michael@0: * This method requires chrome privileges. michael@0: */ michael@0: uint32_t compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1, michael@0: in nsIDOMHTMLCanvasElement aCanvas2, michael@0: out unsigned long aMaxDifference); michael@0: michael@0: /** michael@0: * Returns true if a MozAfterPaint event has been queued but not yet michael@0: * fired. michael@0: */ michael@0: readonly attribute boolean isMozAfterPaintPending; michael@0: michael@0: /** michael@0: * Suppresses/unsuppresses user initiated event handling in window's document michael@0: * and subdocuments. michael@0: * michael@0: * @throw NS_ERROR_DOM_SECURITY_ERR if called without chrome privileges and michael@0: * NS_ERROR_FAILURE if window doesn't have a document. michael@0: */ michael@0: void suppressEventHandling(in boolean aSuppress); michael@0: michael@0: void clearMozAfterPaintEvents(); michael@0: michael@0: /** michael@0: * Disable or enable non synthetic test mouse events on *all* windows. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible). michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aDisable If true, disable all non synthetic test mouse events michael@0: * on all windows. Otherwise, enable them. michael@0: */ michael@0: void disableNonTestMouseEvents(in boolean aDisable); michael@0: michael@0: /** michael@0: * Returns the scroll position of the window's currently loaded document. michael@0: * michael@0: * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. michael@0: * @see nsIDOMWindow::scrollX/Y michael@0: */ michael@0: void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY); michael@0: michael@0: /** michael@0: * Returns the scroll position of the window's currently loaded document. michael@0: * michael@0: * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. michael@0: * @see nsIDOMWindow::scrollX/Y michael@0: */ michael@0: void getScrollXYFloat(in boolean aFlushLayout, out float aScrollX, out float aScrollY); michael@0: michael@0: /** michael@0: * Returns the scrollbar width of the window's scroll frame. michael@0: * michael@0: * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. michael@0: */ michael@0: void getScrollbarSize(in boolean aFlushLayout, out long aWidth, out long aHeight); michael@0: michael@0: /** michael@0: * Returns the given element's bounds without flushing pending layout changes. michael@0: */ michael@0: nsIDOMClientRect getBoundsWithoutFlushing(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Returns the bounds of the window's currently loaded document. This will michael@0: * generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL michael@0: * documents) may have a negative left value. michael@0: */ michael@0: nsIDOMClientRect getRootBounds(); michael@0: michael@0: /** michael@0: * Get IME open state. TRUE means 'Open', otherwise, 'Close'. michael@0: * This property works only when IMEEnabled is IME_STATUS_ENABLED. michael@0: */ michael@0: readonly attribute boolean IMEIsOpen; michael@0: michael@0: /** michael@0: * WARNING: These values must be same as nsIWidget's values. michael@0: */ michael@0: michael@0: /** michael@0: * DISABLED means users cannot use IME completely. michael@0: * Note that this state is *not* same as |ime-mode: disabled;|. michael@0: */ michael@0: const unsigned long IME_STATUS_DISABLED = 0; michael@0: michael@0: /** michael@0: * ENABLED means users can use all functions of IME. This state is same as michael@0: * |ime-mode: normal;|. michael@0: */ michael@0: const unsigned long IME_STATUS_ENABLED = 1; michael@0: michael@0: /** michael@0: * PASSWORD means users cannot use most functions of IME. But on GTK2, michael@0: * users can use "Simple IM" which only supports dead key inputting. michael@0: * The behavior is same as the behavior of the native password field. michael@0: * This state is same as |ime-mode: disabled;|. michael@0: */ michael@0: const unsigned long IME_STATUS_PASSWORD = 2; michael@0: michael@0: /** michael@0: * PLUGIN means a plug-in has focus. At this time we should not touch to michael@0: * controlling the IME state. michael@0: */ michael@0: const unsigned long IME_STATUS_PLUGIN = 3; michael@0: michael@0: /** michael@0: * Get IME status, see above IME_STATUS_* definitions. michael@0: */ michael@0: readonly attribute unsigned long IMEStatus; michael@0: michael@0: /** michael@0: * Get the number of screen pixels per CSS pixel. michael@0: */ michael@0: readonly attribute float screenPixelsPerCSSPixel; michael@0: michael@0: /** michael@0: * Get the current zoom factor. michael@0: * This is _approximately_ the same as nsIMarkupDocumentViewer.fullZoom, michael@0: * but takes into account Gecko's quantization of the zoom factor, which is michael@0: * implemented by adjusting the (integer) number of appUnits per devPixel. michael@0: */ michael@0: readonly attribute float fullZoom; michael@0: michael@0: /** michael@0: * Dispatches aEvent via the nsIPresShell object of the window's document. michael@0: * The event is dispatched to aTarget, which should be an object michael@0: * which implements nsIContent interface (#element, #text, etc). michael@0: * michael@0: * Cannot be accessed from unprivileged context (not michael@0: * content-accessible) Will throw a DOM security error if called michael@0: * without chrome privileges. michael@0: * michael@0: * @note Event handlers won't get aEvent as parameter, but a similar event. michael@0: * Also, aEvent should not be reused. michael@0: */ michael@0: boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget, michael@0: in nsIDOMEvent aEvent, michael@0: in boolean aTrusted); michael@0: michael@0: /** michael@0: * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that michael@0: * the event is propagated only to chrome. michael@0: * Event's .target property will be aTarget. michael@0: * Returns the same value as what EventTarget.dispatchEvent does. michael@0: */ michael@0: boolean dispatchEventToChromeOnly(in nsIDOMEventTarget aTarget, michael@0: in nsIDOMEvent aEvent); michael@0: michael@0: /** michael@0: * Returns the real classname (possibly of the mostly-transparent security michael@0: * wrapper) of aObj. michael@0: */ michael@0: [implicit_jscontext] string getClassName(in jsval aObject); michael@0: michael@0: /** michael@0: * Generate a content command event. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aType Type of command content event to send. Can be one of "cut", michael@0: * "copy", "paste", "delete", "undo", "redo", or "pasteTransferable". michael@0: * @param aTransferable an instance of nsITransferable when aType is michael@0: * "pasteTransferable" michael@0: */ michael@0: void sendContentCommandEvent(in AString aType, michael@0: [optional] in nsITransferable aTransferable); michael@0: michael@0: /** michael@0: * Synthesize a composition event to the window. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: * @param aType The event type: "compositionstart", "compositionend" or michael@0: * "compositionupdate". michael@0: * @param aData The data property value. Note that this isn't applied michael@0: * for compositionstart event because its value is the michael@0: * selected text which is automatically computed. michael@0: * @param aLocale The locale property value. michael@0: */ michael@0: void sendCompositionEvent(in AString aType, michael@0: in AString aData, michael@0: in AString aLocale); michael@0: michael@0: /** michael@0: * Creating synthesizer of composition string on the window. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible) michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: */ michael@0: nsICompositionStringSynthesizer createCompositionStringSynthesizer(); michael@0: michael@0: /** michael@0: * If sendQueryContentEvent()'s aAdditionalFlags argument is michael@0: * QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK, plain text generated from content michael@0: * is created with "\n". michael@0: * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used. michael@0: * aOffset and aLength are offset and length in/of the plain text content. michael@0: * This flag also affects the result values such as offset, length and string. michael@0: */ michael@0: const unsigned long QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK = 0x0000; michael@0: const unsigned long QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK = 0x0001; michael@0: michael@0: /** michael@0: * Synthesize a query content event. Note that the result value returned here michael@0: * is in LayoutDevice pixels rather than CSS pixels. michael@0: * michael@0: * @param aType One of the following const values. And see also each comment michael@0: * for the other parameters and the result. michael@0: * @param aAdditionalFlags See the description of QUERY_CONTENT_FLAG_*. michael@0: */ michael@0: nsIQueryContentEventResult sendQueryContentEvent( michael@0: in unsigned long aType, michael@0: in unsigned long aOffset, michael@0: in unsigned long aLength, michael@0: in long aX, michael@0: in long aY, michael@0: [optional] in unsigned long aAdditionalFlags); michael@0: michael@0: // NOTE: following values are same as NS_QUERY_* in BasicEvents.h michael@0: michael@0: /** michael@0: * QUERY_SELECTED_TEXT queries the first selection range's information. michael@0: * michael@0: * @param aOffset Not used. michael@0: * @param aLength Not used. michael@0: * @param aX Not used. michael@0: * @param aY Not used. michael@0: * michael@0: * @return offset, reversed and text properties of the result are available. michael@0: */ michael@0: const unsigned long QUERY_SELECTED_TEXT = 3200; michael@0: michael@0: /** michael@0: * QUERY_TEXT_CONTENT queries the text at the specified range. michael@0: * michael@0: * @param aOffset The first character's offset. 0 is the first character. michael@0: * @param aLength The length of getting text. If the aLength is too long, michael@0: * the result text is shorter than this value. michael@0: * @param aX Not used. michael@0: * @param aY Not used. michael@0: * michael@0: * @return text property of the result is available. michael@0: */ michael@0: const unsigned long QUERY_TEXT_CONTENT = 3201; michael@0: michael@0: /** michael@0: * QUERY_CARET_RECT queries the (collapsed) caret rect of the offset. michael@0: * If the actual caret is there at the specified offset, this returns the michael@0: * actual caret rect. Otherwise, this guesses the caret rect from the michael@0: * metrics of the text. michael@0: * michael@0: * @param aOffset The caret offset. 0 is the left side of the first michael@0: * caracter in LTR text. michael@0: * @param aLength Not used. michael@0: * @param aX Not used. michael@0: * @param aY Not used. michael@0: * michael@0: * @return left, top, width and height properties of the result are available. michael@0: * The left and the top properties are offset in the client area of michael@0: * the DOM window. michael@0: */ michael@0: const unsigned long QUERY_CARET_RECT = 3203; michael@0: michael@0: /** michael@0: * QUERY_TEXT_RECT queries the specified text's rect. michael@0: * michael@0: * @param aOffset The first character's offset. 0 is the first character. michael@0: * @param aLength The length of getting text. If the aLength is too long, michael@0: * the extra length is ignored. michael@0: * @param aX Not used. michael@0: * @param aY Not used. michael@0: * michael@0: * @return left, top, width and height properties of the result are available. michael@0: * The left and the top properties are offset in the client area of michael@0: * the DOM window. michael@0: */ michael@0: const unsigned long QUERY_TEXT_RECT = 3204; michael@0: michael@0: /** michael@0: * QUERY_TEXT_RECT queries the focused editor's rect. michael@0: * michael@0: * @param aOffset Not used. michael@0: * @param aLength Not used. michael@0: * @param aX Not used. michael@0: * @param aY Not used. michael@0: * michael@0: * @return left, top, width and height properties of the result are available. michael@0: */ michael@0: const unsigned long QUERY_EDITOR_RECT = 3205; michael@0: michael@0: /** michael@0: * QUERY_CHARACTER_AT_POINT queries the character information at the michael@0: * specified point. The point is offset in the window. michael@0: * NOTE: If there are some panels at the point, this method send the query michael@0: * event to the panel's widget automatically. michael@0: * michael@0: * @param aOffset Not used. michael@0: * @param aLength Not used. michael@0: * @param aX X offset in the widget. michael@0: * @param aY Y offset in the widget. michael@0: * michael@0: * @return offset, notFound, left, top, width and height properties of the michael@0: * result are available. michael@0: */ michael@0: const unsigned long QUERY_CHARACTER_AT_POINT = 3208; michael@0: michael@0: /** michael@0: * Called when the remote child frame has changed its fullscreen state, michael@0: * when entering fullscreen, and when the origin which is fullscreen changes. michael@0: * aFrameElement is the iframe element which contains the child-process michael@0: * fullscreen document, and aNewOrigin is the origin of the new fullscreen michael@0: * document. michael@0: */ michael@0: void remoteFrameFullscreenChanged(in nsIDOMElement aFrameElement, michael@0: in AString aNewOrigin); michael@0: michael@0: /** michael@0: * Called when the remote frame has popped all fullscreen elements off its michael@0: * stack, so that the operation can complete on the parent side. michael@0: */ michael@0: void remoteFrameFullscreenReverted(); michael@0: michael@0: /** michael@0: * Called when the child frame has fully exit fullscreen, so that the parent michael@0: * process can also fully exit. michael@0: */ michael@0: void exitFullscreen(); michael@0: michael@0: /** michael@0: * If sendQueryContentEvent()'s aAdditionalFlags argument is michael@0: * SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK, aOffset and aLength are offset michael@0: * and length in/of plain text generated from content is created with "\n". michael@0: * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used. michael@0: */ michael@0: const unsigned long SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK = 0x0000; michael@0: const unsigned long SELECTION_SET_FLAG_USE_XP_LINE_BREAK = 0x0001; michael@0: michael@0: /** michael@0: * If SELECTION_SET_FLAG_REVERSE is set, the selection is set from michael@0: * |aOffset + aLength| to |aOffset|. Otherwise, it's set from |aOffset| to michael@0: * |aOffset + aLength|. michael@0: */ michael@0: const unsigned long SELECTION_SET_FLAG_REVERSE = 0x0002; michael@0: michael@0: /** michael@0: * Synthesize a selection set event to the window. michael@0: * michael@0: * This sets the selection as the specified information. michael@0: * michael@0: * @param aOffset The caret offset of the selection start. michael@0: * @param aLength The length of the selection. If this is too long, the michael@0: * extra length is ignored. michael@0: * @param aAdditionalFlags See the description of SELECTION_SET_FLAG_*. michael@0: * @return True, if succeeded. Otherwise, false. michael@0: */ michael@0: boolean sendSelectionSetEvent(in unsigned long aOffset, michael@0: in unsigned long aLength, michael@0: [optional] in unsigned long aAdditionalFlags); michael@0: michael@0: /* Selection behaviors - mirror nsIFrame's nsSelectionAmount constants */ michael@0: const unsigned long SELECT_CHARACTER = 0; michael@0: const unsigned long SELECT_CLUSTER = 1; michael@0: const unsigned long SELECT_WORD = 2; michael@0: const unsigned long SELECT_LINE = 3; michael@0: const unsigned long SELECT_BEGINLINE = 4; michael@0: const unsigned long SELECT_ENDLINE = 5; michael@0: const unsigned long SELECT_PARAGRAPH = 6; michael@0: const unsigned long SELECT_WORDNOSPACE = 7; michael@0: michael@0: /** michael@0: * Select content at a client point based on a selection behavior if the michael@0: * underlying content is selectable. Selection will accumulate with any michael@0: * existing selection, callers should clear selection prior if needed. michael@0: * May fire selection changed events. Calls nsFrame's SelectByTypeAtPoint. michael@0: * michael@0: * @param aX, aY The selection point in client coordinates. michael@0: * @param aSelectType The selection behavior requested. michael@0: * @return True if a selection occured, false otherwise. michael@0: * @throw NS_ERROR_DOM_SECURITY_ERR, NS_ERROR_UNEXPECTED for utils michael@0: * issues, and NS_ERROR_INVALID_ARG for coordinates that are outside michael@0: * this window. michael@0: */ michael@0: boolean selectAtPoint(in float aX, michael@0: in float aY, michael@0: in unsigned long aSelectBehavior); michael@0: michael@0: /** michael@0: * Perform the equivalent of: michael@0: * window.getComputedStyle(aElement, aPseudoElement). michael@0: * getPropertyValue(aPropertyName) michael@0: * except that, when the link whose presence in history is allowed to michael@0: * influence aElement's style is visited, get the value the property michael@0: * would have if allowed all properties to change as a result of michael@0: * :visited selectors (except for cases where getComputedStyle uses michael@0: * data from the frame). michael@0: * michael@0: * This is easier to implement than adding our property restrictions michael@0: * to this API, and is sufficient for the present testing michael@0: * requirements (which are essentially testing 'color'). michael@0: */ michael@0: AString getVisitedDependentComputedStyle(in nsIDOMElement aElement, michael@0: in AString aPseudoElement, michael@0: in AString aPropertyName); michael@0: michael@0: /** michael@0: * Returns the parent of obj. michael@0: * michael@0: * @param obj The JavaScript object whose parent is to be gotten. michael@0: * @return the parent. michael@0: */ michael@0: [implicit_jscontext] jsval getParent(in jsval obj); michael@0: michael@0: /** michael@0: * Get the id of the outer window of this window. This will never throw. michael@0: */ michael@0: readonly attribute unsigned long long outerWindowID; michael@0: michael@0: /** michael@0: * Get the id of the current inner window of this window. If there michael@0: * is no current inner window, throws NS_ERROR_NOT_AVAILABLE. michael@0: */ michael@0: readonly attribute unsigned long long currentInnerWindowID; michael@0: michael@0: /** michael@0: * Put the window into a state where scripts are frozen and events michael@0: * suppressed, for use when the window has launched a modal prompt. michael@0: */ michael@0: void enterModalState(); michael@0: michael@0: /** michael@0: * Resume normal window state, where scripts can run and events are michael@0: * delivered. michael@0: */ michael@0: void leaveModalState(); michael@0: michael@0: /** michael@0: * Is the window is in a modal state? [See enterModalState()] michael@0: */ michael@0: [noscript] boolean isInModalState(); michael@0: michael@0: /** michael@0: * Suspend/resume timeouts on this window and its descendant windows. michael@0: */ michael@0: void suspendTimeouts(); michael@0: void resumeTimeouts(); michael@0: michael@0: /** michael@0: * What type of layer manager the widget associated with this window is michael@0: * using. "Basic" is unaccelerated; other types are accelerated. Throws an michael@0: * error if there is no widget associated with this window. michael@0: */ michael@0: readonly attribute AString layerManagerType; michael@0: michael@0: /** michael@0: * True if the layer manager for the widget associated with this window is michael@0: * forwarding layers to a remote compositor, false otherwise. Throws an michael@0: * error if there is no widget associated with this window. michael@0: */ michael@0: readonly attribute boolean layerManagerRemote; michael@0: michael@0: /** michael@0: * Record (and return) frame-intervals for frames which were presented michael@0: * between calling StartFrameTimeRecording and StopFrameTimeRecording. michael@0: * michael@0: * - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late michael@0: * (elements were overwritten since Start), result is considered invalid and hence empty. michael@0: * - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent). michael@0: * Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize. michael@0: * - Note: the first frame-interval may be longer than expected because last frame michael@0: * might have been presented some time before calling StartFrameTimeRecording. michael@0: */ michael@0: michael@0: /** michael@0: * Returns a handle which represents current recording start position. michael@0: */ michael@0: void startFrameTimeRecording([retval] out unsigned long startIndex); michael@0: michael@0: /** michael@0: * Returns number of recorded frames since startIndex was issued, michael@0: * and allocates+populates 2 arraye with the recorded data. michael@0: * - Allocation is infallible. Should be released even if size is 0. michael@0: */ michael@0: void stopFrameTimeRecording(in unsigned long startIndex, michael@0: [optional] out unsigned long frameCount, michael@0: [retval, array, size_is(frameCount)] out float frameIntervals); michael@0: michael@0: /** michael@0: * Signals that we're begining to tab switch. This is used by painting code to michael@0: * determine total tab switch time. michael@0: */ michael@0: void beginTabSwitch(); michael@0: michael@0: /** michael@0: * The DPI of the display michael@0: */ michael@0: readonly attribute float displayDPI; michael@0: michael@0: /** michael@0: * Return the outer window with the given ID, if any. Can return null. michael@0: * @deprecated Use nsIWindowMediator.getOuterWindowWithId. See bug 865664. michael@0: */ michael@0: nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID); michael@0: michael@0: /** michael@0: * Return this window's frame element. michael@0: * Ignores all chrome/content or mozbrowser boundaries. michael@0: */ michael@0: readonly attribute nsIDOMElement containerElement; michael@0: michael@0: [noscript] void RenderDocument(in nsConstRect aRect, michael@0: in uint32_t aFlags, michael@0: in nscolor aBackgroundColor, michael@0: in gfxContext aThebesContext); michael@0: michael@0: /** michael@0: * advanceTimeAndRefresh allows the caller to take over the refresh michael@0: * driver timing for a window. A call to advanceTimeAndRefresh does michael@0: * three things: michael@0: * (1) It marks the refresh driver for this presentation so that it michael@0: * no longer refreshes on its own, but is instead driven entirely michael@0: * by the caller (except for the refresh that happens when a michael@0: * document comes out of the bfcache). michael@0: * (2) It advances the refresh driver's current refresh time by the michael@0: * argument given. Negative advances are permitted. michael@0: * (3) It does a refresh (i.e., notifies refresh observers) at that michael@0: * new time. michael@0: * michael@0: * Note that this affects other connected docshells of the same type michael@0: * in the same docshell tree, such as parent frames. michael@0: * michael@0: * When callers have completed their use of advanceTimeAndRefresh, michael@0: * they must call restoreNormalRefresh. michael@0: */ michael@0: void advanceTimeAndRefresh(in long long aMilliseconds); michael@0: michael@0: /** michael@0: * Undoes the effects of advanceTimeAndRefresh. michael@0: */ michael@0: void restoreNormalRefresh(); michael@0: michael@0: /** michael@0: * Reports whether the current state is test-controlled refreshes michael@0: * (see advanceTimeAndRefresh and restoreNormalRefresh above). michael@0: */ michael@0: readonly attribute bool isTestControllingRefreshes; michael@0: michael@0: /** michael@0: * Set async scroll offset on an element. The next composite will render michael@0: * with that offset if async scrolling is enabled, and then the offset michael@0: * will be removed. Only call this while test-controlled refreshes is enabled. michael@0: */ michael@0: void setAsyncScrollOffset(in nsIDOMNode aNode, in int32_t aX, in int32_t aY); michael@0: michael@0: /** michael@0: * Method for testing nsStyleAnimation::ComputeDistance. michael@0: * michael@0: * Returns the distance between the two values as reported by michael@0: * nsStyleAnimation::ComputeDistance for the given element and michael@0: * property. michael@0: */ michael@0: double computeAnimationDistance(in nsIDOMElement element, michael@0: in AString property, michael@0: in AString value1, michael@0: in AString value2); michael@0: michael@0: /** michael@0: * Wrap an nsIFile in an nsIDOMFile michael@0: */ michael@0: nsIDOMFile wrapDOMFile(in nsIFile aFile); michael@0: michael@0: /** michael@0: * Get the type of the currently focused html input, if any. michael@0: */ michael@0: readonly attribute string focusedInputType; michael@0: michael@0: /** michael@0: * Given a view ID from the compositor process, retrieve the element michael@0: * associated with a view. For scrollpanes for documents, the root michael@0: * element of the document is returned. michael@0: */ michael@0: nsIDOMElement findElementWithViewId(in nsViewID aId); michael@0: michael@0: /** michael@0: * Find the view ID for a given element. This is the reverse of michael@0: * findElementWithViewId(). michael@0: */ michael@0: nsViewID getViewId(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Checks the layer tree for this window and returns true michael@0: * if all layers have transforms that are translations by integers, michael@0: * no leaf layers overlap, and the union of the leaf layers is exactly michael@0: * the bounds of the window. Always returns true in non-DEBUG builds. michael@0: */ michael@0: boolean leafLayersPartitionWindow(); michael@0: michael@0: /** michael@0: * true if the (current inner) window may have event listeners for touch events. michael@0: */ michael@0: readonly attribute boolean mayHaveTouchEventListeners; michael@0: michael@0: /** michael@0: * Check if any ThebesLayer painting has been done for this element, michael@0: * clears the painted flags if they have. michael@0: */ michael@0: boolean checkAndClearPaintedState(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Internal file constructor intended for testing of File objects. michael@0: * Example of constructor usage: michael@0: * getFile("myfile.txt", [b1, "foo"], { type: "text/plain" }) michael@0: */ michael@0: [optional_argc, implicit_jscontext] michael@0: nsIDOMFile getFile(in DOMString aName, [optional] in jsval aBlobParts, michael@0: [optional] in jsval aParameters); michael@0: michael@0: /** michael@0: * Internal blob constructor intended for testing of Blob objects. michael@0: * Example of constructor usage: michael@0: * getBlob([b1, "foo"], { type: "text/plain" }) michael@0: */ michael@0: [optional_argc, implicit_jscontext] michael@0: nsIDOMBlob getBlob([optional] in jsval aBlobParts, michael@0: [optional] in jsval aParameters); michael@0: michael@0: /** michael@0: * Get internal id of the stored blob, file or file handle. michael@0: */ michael@0: [implicit_jscontext] long long getFileId(in jsval aFile); michael@0: michael@0: /** michael@0: * Get file ref count info for given database and file id. michael@0: * michael@0: */ michael@0: [implicit_jscontext] michael@0: boolean getFileReferences(in AString aDatabaseName, in long long aId, michael@0: [optional] in jsval aOptions, michael@0: [optional] out long aRefCnt, michael@0: [optional] out long aDBRefCnt, michael@0: [optional] out long aSliceRefCnt); michael@0: michael@0: /** michael@0: * Return whether incremental GC has been disabled due to a binary add-on. michael@0: */ michael@0: [implicit_jscontext] michael@0: boolean isIncrementalGCEnabled(); michael@0: michael@0: /** michael@0: * Begin opcode-level profiling of all JavaScript execution in the window's michael@0: * runtime. michael@0: */ michael@0: [implicit_jscontext] michael@0: void startPCCountProfiling(); michael@0: michael@0: /** michael@0: * Stop opcode-level profiling of JavaScript execution in the runtime, and michael@0: * collect all counts for use by getPCCount methods. michael@0: */ michael@0: [implicit_jscontext] michael@0: void stopPCCountProfiling(); michael@0: michael@0: /** michael@0: * Purge collected PC counters. michael@0: */ michael@0: [implicit_jscontext] michael@0: void purgePCCounts(); michael@0: michael@0: /** michael@0: * Get the number of scripts with opcode-level profiling information. michael@0: */ michael@0: [implicit_jscontext] michael@0: long getPCCountScriptCount(); michael@0: michael@0: /** michael@0: * Get a JSON string for a short summary of a script and the PC counts michael@0: * accumulated for it. michael@0: */ michael@0: [implicit_jscontext] michael@0: AString getPCCountScriptSummary(in long script); michael@0: michael@0: /** michael@0: * Get a JSON string with full information about a profiled script, michael@0: * including the decompilation of the script and placement of decompiled michael@0: * operations within it, and PC counts for each operation. michael@0: */ michael@0: [implicit_jscontext] michael@0: AString getPCCountScriptContents(in long script); michael@0: michael@0: /** michael@0: * Returns true if painting is suppressed for this window and false michael@0: * otherwise. michael@0: */ michael@0: readonly attribute boolean paintingSuppressed; michael@0: michael@0: /** michael@0: * Returns an array of plugins on the page for opt-in activation. michael@0: * michael@0: * Cannot be accessed from unprivileged context (not content-accessible). michael@0: * Will throw a DOM security error if called without chrome privileges. michael@0: * michael@0: */ michael@0: [implicit_jscontext] michael@0: readonly attribute jsval plugins; michael@0: michael@0: /** michael@0: * Set the scrollport size for the purposes of clamping scroll positions for michael@0: * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels. michael@0: * michael@0: * The caller of this method must have chrome privileges. michael@0: */ michael@0: void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight); michael@0: michael@0: /** michael@0: * Set margins for the layout of fixed position elements in the content michael@0: * document. These are used on mobile, where the viewable area can be michael@0: * temporarily obscured by the browser chrome. In this situation, we're ok michael@0: * with scrollable page content being obscured, but fixed position content michael@0: * cannot be revealed without removing the obscuring chrome, so we use these michael@0: * margins so that it can remain visible. michael@0: * michael@0: * The caller of this method must have chrome privileges. michael@0: */ michael@0: void setContentDocumentFixedPositionMargins(in float aTop, in float aRight, michael@0: in float aBottom, in float aLeft); michael@0: michael@0: /** michael@0: * These are used to control whether dialogs (alert, prompt, confirm) are michael@0: * allowed. michael@0: */ michael@0: void disableDialogs(); michael@0: void enableDialogs(); michael@0: bool areDialogsEnabled(); michael@0: michael@0: const unsigned long AGENT_SHEET = 0; michael@0: const unsigned long USER_SHEET = 1; michael@0: const unsigned long AUTHOR_SHEET = 2; michael@0: /** michael@0: * Synchronously loads a style sheet from |sheetURI| and adds it to the list michael@0: * of additional style sheets of the document. michael@0: * michael@0: * These additional style sheets are very much like user/agent sheets loaded michael@0: * with loadAndRegisterSheet. The only difference is that they are applied only michael@0: * on the document owned by this window. michael@0: * michael@0: * Sheets added via this API take effect immediately on the document. michael@0: */ michael@0: void loadSheet(in nsIURI sheetURI, michael@0: in unsigned long type); michael@0: michael@0: /** michael@0: * Remove the document style sheet at |sheetURI| from the list of additional michael@0: * style sheets of the document. The removal takes effect immediately. michael@0: */ michael@0: void removeSheet(in nsIURI sheetURI, michael@0: in unsigned long type); michael@0: michael@0: /** michael@0: * Returns true if a user input is being handled. michael@0: * michael@0: * This calls EventStateManager::IsHandlingUserInput(). michael@0: */ michael@0: readonly attribute boolean isHandlingUserInput; michael@0: michael@0: /** michael@0: * After calling the method, the window for which this DOMWindowUtils michael@0: * was created can be closed using scripts. michael@0: */ michael@0: void allowScriptsToClose(); michael@0: michael@0: /** michael@0: * Is the parent window's main widget visible? If it isn't, we probably michael@0: * don't want to display any dialogs etc it may request. This corresponds michael@0: * to the visibility check in nsWindowWatcher::OpenWindowInternal(). michael@0: * michael@0: * Will throw a DOM security error if called without chrome privileges or michael@0: * NS_ERROR_NOT_AVAILABLE in the unlikely event that the parent window's michael@0: * main widget can't be reached. michael@0: */ michael@0: readonly attribute boolean isParentWindowMainWidgetVisible; michael@0: michael@0: /** michael@0: * In certain cases the event handling of nodes, form controls in practice, michael@0: * may be disabled. Such cases are for example the existence of disabled michael@0: * attribute or -moz-user-input: none/disabled. michael@0: */ michael@0: boolean isNodeDisabledForEvents(in nsIDOMNode aNode); michael@0: michael@0: /** michael@0: * Setting paintFlashing to true will flash newly painted area. michael@0: */ michael@0: attribute boolean paintFlashing; michael@0: michael@0: /** michael@0: * Allows running of a "synchronous section", in the form of an nsIRunnable michael@0: * once the event loop has reached a "stable state". We've reached a stable michael@0: * state when the currently executing task/event has finished, see: michael@0: * http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#synchronous-section michael@0: * In practice this runs aRunnable once the currently executing event michael@0: * finishes. If called multiple times per task/event, all the runnables will michael@0: * be executed, in the order in which runInStableState() was called. michael@0: * michael@0: * XXX - This can wreak havoc if you're not using this for very simple michael@0: * purposes, eg testing or setting a flag. michael@0: */ michael@0: void runInStableState(in nsIRunnable runnable); michael@0: michael@0: /** michael@0: * Run the given runnable before the next iteration of the event loop (this michael@0: * includes native events too). If a nested loop is spawned within the current michael@0: * event then the runnable will not be run until that loop has terminated. michael@0: * michael@0: * XXX - This can wreak havoc if you're not using this for very simple michael@0: * purposes, eg testing or setting a flag. michael@0: */ michael@0: void runBeforeNextEvent(in nsIRunnable runnable); michael@0: michael@0: /* michael@0: * Returns the value of a given property animated on the compositor thread. michael@0: * If the property is NOT currently being animated on the compositor thread, michael@0: * returns an empty string. michael@0: */ michael@0: AString getOMTAStyle(in nsIDOMElement aElement, in AString aProperty); michael@0: michael@0: /* michael@0: * Returns the value of a given property. If the property is animated off michael@0: * the main thread, this function will fetch the correct value from the michael@0: * compositor. michael@0: */ michael@0: AString getOMTAOrComputedStyle(in nsIDOMElement aElement, michael@0: in AString aProperty); michael@0: michael@0: /** michael@0: * With this it's possible to mute all the MediaElements in this window. michael@0: * We have audioMuted and audioVolume to preserve the volume across michael@0: * mute/umute. michael@0: */ michael@0: attribute boolean audioMuted; michael@0: michael@0: /** michael@0: * range: greater or equal to 0. The real volume level is affected by the michael@0: * volume of all ancestor windows. michael@0: */ michael@0: attribute float audioVolume; michael@0: }; michael@0: michael@0: [scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)] michael@0: interface nsITranslationNodeList : nsISupports { michael@0: readonly attribute unsigned long length; michael@0: nsIDOMNode item(in unsigned long index); michael@0: michael@0: // A translation root is a block element, or an inline element michael@0: // which its parent is not a translation node. michael@0: boolean isTranslationRootAtIndex(in unsigned long index); michael@0: };