1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"domstubs.idl"
10 * nsIDOMWindowUtils is intended for infrequently-used methods related
11 * to the current nsIDOMWindow. Some of the methods may require
12 * elevated privileges; the method implementations should contain the
13 * necessary security checks. Access this interface by calling
14 * getInterface on a DOMWindow.
16 * WARNING: Do not use 'out jsval' parameters in this file.
17 * SpecialPowers, which is used to access nsIDOMWindowUtils
18 * in plain mochitests, does not know how to handle them.
19 * (Use 'jsval' return values instead.)
28 [ref] native nsConstRect
(const nsRect
);
29 native nscolor
(nscolor
);
30 [ptr] native gfxContext
(gfxContext
);
33 interface nsICycleCollectorListener
;
34 interface nsIPreloadedStyleSheet
;
35 interface nsITransferable
;
36 interface nsIQueryContentEventResult
;
37 interface nsIDOMWindow
;
40 interface nsIRunnable
;
41 interface nsITranslationNodeList
;
42 interface nsIJSRAIIHelper
;
43 interface nsIContentPermissionRequest
;
44 interface nsIObserver
;
55 [builtinclass
, scriptable
, uuid(4d6732ca
-9da7
-4176-b8a1
-8dde15cd0bf9
)]
56 interface nsIDOMWindowUtils
: nsISupports
{
59 * Image animation mode of the window. When this attribute's value
60 * is changed, the implementation should set all images in the window
61 * to the given value. That is, when set to kDontAnimMode, all images
62 * will stop animating. The attribute's value must be one of the
63 * animationMode values from imgIContainer.
64 * @note Images may individually override the window's setting after
65 * the window's mode is set. Therefore images given different modes
66 * since the last setting of the window's mode may behave
67 * out of line with the window's overall mode.
68 * @note The attribute's value is the window's overall mode. It may
69 * for example continue to report kDontAnimMode after all images
70 * have subsequently been individually animated.
71 * @note Only images immediately in this window are affected;
72 * this is not recursive to subwindows.
75 attribute
unsigned short imageAnimationMode
;
78 * Whether the charset of the window's current document has been forced by
80 * Cannot be accessed from unprivileged context (not content-accessible)
82 readonly attribute
boolean docCharsetIsForced
;
85 * Return the conversion of a physical millimeter in CSS pixels.
87 readonly attribute
float physicalMillimeterInCSSPixels
;
90 * Function to get metadata associated with the window's current document
91 * @param aName the name of the metadata. This should be all lowercase.
92 * @return the value of the metadata, or the empty string if it's not set
94 * Will throw a DOM security error if called without chrome privileges.
96 AString getDocumentMetadata
(in AString aName
);
99 * Relative to the top-level document.
101 * @param aX 0, if there's no such location.
102 * @param aY 0, if there's no such location.
104 void getLastOverWindowPointerLocationInCSSPixels
(out float aX
, out float aY
);
107 * Force a synchronous layer transaction for this window if necessary.
110 void updateLayerTree
();
113 * Get the last used layer transaction id for this window's refresh driver.
115 readonly attribute
unsigned long long lastTransactionId
;
118 * Information retrieved from the <meta name="viewport"> tag.
119 * See Document::GetViewportInfo for more information.
121 void getViewportInfo
(in uint32_t aDisplayWidth
, in uint32_t aDisplayHeight
,
122 out double aDefaultZoom
, out boolean aAllowZoom
,
123 out double aMinZoom
, out double aMaxZoom
,
124 out uint32_t aWidth
, out uint32_t aHeight
,
125 out boolean aAutoSize
);
127 * Information retrieved from the viewport-fit value of <meta name="viewport">
130 AString getViewportFitInfo
();
133 * Information about the window size in device pixels.
135 void getDocumentViewerSize
(out uint32_t aDisplayWidth
, out uint32_t aDisplayHeight
);
138 * For any scrollable element, this allows you to override the default
139 * scroll behaviour and force autodir (which allows a mousewheel to
140 * horizontally scroll regions that only scroll on that one axis).
142 * See the documentation for mousewheel.autodir.enabled and
143 * mousewheel.autodir.honourroot for a more thorough explanation of
144 * what these behaviours do.
146 void setMousewheelAutodir
(in Element aElement
, in boolean aEnabled
, in boolean aHonourRoot
);
149 * For any scrollable element, this allows you to override the
150 * visible region and draw more than what is visible, which is
151 * useful for asynchronous drawing. The "displayport" will be
152 * <xPx, yPx, widthPx, heightPx> in units of CSS pixels,
153 * regardless of the size of the enclosing container. This
154 * will *not* trigger reflow.
156 * For the root scroll area, pass in the root document element.
157 * For scrollable elements, pass in the container element (for
158 * instance, the element with overflow: scroll).
160 * <x, y> is relative to the top-left of what would normally be
161 * the visible area of the element. This means that the pixels
162 * rendered to the displayport take scrolling into account,
165 * It's legal to set a displayport that extends beyond the overflow
166 * area in any direction (left/right/top/bottom).
168 * It's also legal to set a displayport that extends beyond the
169 * area's bounds. No pixels are rendered outside the area bounds.
171 * The caller of this method must have chrome privileges.
173 * Calling this will always force a recomposite, so it should be
174 * avoided if at all possible. Client code should do checks before
175 * calling this so that duplicate sets are not made with the same
178 * aPriority is recorded along with the displayport rectangle. If this
179 * method is called with a lower priority than the current priority, the
182 void setDisplayPortForElement
(in float aXPx
, in float aYPx
,
183 in float aWidthPx
, in float aHeightPx
,
185 in uint32_t aPriority
);
187 * An alternate way to represent a displayport rect as a set of margins and a
188 * base rect to apply those margins to. A consumer of pixels may ask for as
189 * many extra pixels as it would like in each direction. Layout then sets
190 * the base rect to the "visible rect" of the element, which is just the
191 * subrect of the element that is drawn (it does not take in account content
192 * covering the element).
194 * If both a displayport rect and displayport margins with corresponding base
195 * rect are set with the same priority then the margins will take precendence.
197 * Specifying an alignment value will ensure that after the base rect has
198 * been expanded by the displayport margins, it will be further expanded so
199 * that each edge is located at a multiple of the "alignment" value.
201 * Note that both the margin values and alignment are treated as values in
202 * ScreenPixels. Refer to layout/base/Units.h for a description of this unit.
203 * The base rect values are in app units.
205 void setDisplayPortMarginsForElement
(in float aLeftMargin
,
207 in float aRightMargin
,
208 in float aBottomMargin
,
210 in uint32_t aPriority
);
212 void setDisplayPortBaseForElement
(in int32_t aX
,
216 in Element aElement
);
219 * If |aElement| is a scroll container, returns the amount of layout
220 * space taken up by its scrollbars (that is, the width of the vertical
221 * scrollbar and the height of the horizontal scrollbar) in CSS pixels;
222 * otherwise returns zero.
224 * Note that on some platforms, scrollbars don't take up layout space
225 * ("overlay scrollbars"). On such platforms, the returned sizes are
228 * Layout scrollbars that normally take up space but were only shown to
229 * scroll the visual viewport inside the layout viewport (the layout viewport
230 * cannot be scrolled) do not take up space but they still return their size
231 * from this function.
233 void getScrollbarSizes
(in Element aElement
,
234 out uint32_t aVerticalScrollbarWidth
,
235 out uint32_t aHorizontalScrollbarHeight
);
238 * Get/set the resolution at which rescalable web content is drawn for
241 * Setting a new resolution does *not* trigger reflow. This API is
242 * entirely separate from textZoom and fullZoom; a resolution scale
243 * can be applied together with both textZoom and fullZoom.
245 * The effect of this API is for gfx code to allocate more or fewer
246 * pixels for rescalable content by a factor of |resolution| in
249 * In addition, the content is scaled by the amount of the resolution,
250 * so that it is displayed at a correspondingly larger or smaller size,
251 * without the need for the caller to set an additional transform.
253 * The purpose of this API is to allow tests to simulate many of the effects
254 * a non-reflowing scale-zoom, e.g. for pinch-zoom on mobile platforms, and
255 * should be only used for testing purposes.
257 * The caller of this method must have chrome privileges.
259 * This is intended to be used by test code only!
261 void setResolutionAndScaleTo
(in float aResolution
);
263 float getResolution
();
266 * Set a resolution on the presShell which is the "restored" from history.
267 * The display dimensions are compared to their current values and used
268 * to scale the resolution value if necessary, e.g. if the device was
269 * rotated between saving and restoring of the session data.
270 * This resolution should be used when painting for the first time. Calling
271 * this too late may have no effect.
273 void setRestoreResolution
(in float aResolution
,
274 in uint32_t aDisplayWidth
,
275 in uint32_t aDisplayHeight
);
278 * Whether the next paint should be flagged as the first paint for a document.
279 * This gives a way to track the next paint that occurs after the flag is
280 * set. The flag gets cleared after the next paint.
282 * Can only be accessed with chrome privileges.
284 attribute
boolean isFirstPaint
;
286 uint32_t getPresShellId
();
289 * Returns whether a given header and value is a CORS-safelisted request
290 * header per https://fetch.spec.whatwg.org/#cors-safelisted-request-header
292 boolean isCORSSafelistedRequestHeader
(in ACString name
, in ACString value
);
295 * Following modifiers are for sent*Event() except sendNative*Event().
296 * NOTE: MODIFIER_ALT, MODIFIER_CONTROL, MODIFIER_SHIFT and MODIFIER_META
297 * are must be same values as Event_Binding::*_MASK for backward
300 const long MODIFIER_ALT
= 0x0001;
301 const long MODIFIER_CONTROL
= 0x0002;
302 const long MODIFIER_SHIFT
= 0x0004;
303 const long MODIFIER_META
= 0x0008;
304 const long MODIFIER_ALTGRAPH
= 0x0010;
305 const long MODIFIER_CAPSLOCK
= 0x0020;
306 const long MODIFIER_FN
= 0x0040;
307 const long MODIFIER_FNLOCK
= 0x0080;
308 const long MODIFIER_NUMLOCK
= 0x0100;
309 const long MODIFIER_SCROLLLOCK
= 0x0200;
310 const long MODIFIER_SYMBOL
= 0x0400;
311 const long MODIFIER_SYMBOLLOCK
= 0x0800;
313 /** Synthesize a mouse event. The event types supported are:
314 * mousedown, mouseup, mousemove, mouseover, mouseout, mousecancel,
315 * contextmenu, MozMouseHittest
317 * Events are sent in coordinates offset by aX and aY from the window.
319 * Note that additional events may be fired as a result of this call. For
320 * instance, typically a click event will be fired as a result of a
321 * mousedown and mouseup in sequence.
323 * Normally at this level of events, the mouseover and mouseout events are
324 * only fired when the window is entered or exited. For inter-element
325 * mouseover and mouseout events, a movemove event fired on the new element
326 * should be sufficient to generate the correct over and out events as well.
328 * Cannot be accessed from unprivileged context (not content-accessible)
329 * Will throw a DOM security error if called without chrome privileges.
331 * The event is dispatched via the toplevel window, so it could go to any
332 * window under the toplevel window, in some cases it could never reach this
335 * NOTE: mousecancel is used to represent the vanishing of an input device
336 * such as a pen leaving its digitizer by synthesizing a WidgetMouseEvent,
337 * whose mMessage is eMouseExitFromWidget and mExitFrom is
338 * WidgetMouseEvent::eTopLevel.
340 * @param aType event type
341 * @param aX x offset in CSS pixels
342 * @param aY y offset in CSS pixels
343 * @param aButton button to synthesize
344 * @param aClickCount number of clicks that have been performed
345 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
346 * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
348 * @param aPressure touch input pressure: 0.0 -> 1.0
349 * @param aInputSourceArg input source, see MouseEvent for values,
350 * defaults to mouse input.
351 * @param aIsDOMEventSynthesized controls Event.isSynthesized value
352 * that helps identifying test related events,
354 * @param aIsWidgetEventSynthesized controls WidgetMouseEvent.mReason value
355 * defaults to false (WidgetMouseEvent::eReal)
356 * @param aIdentifier A unique identifier for the pointer causing the event,
357 * defaulting to nsIDOMWindowUtils::DEFAULT_MOUSE_POINTER_ID.
359 * returns true if the page called prevent default on this event
361 [optional_argc
, can_run_script
]
362 boolean sendMouseEvent
(in AString aType
,
368 [optional] in boolean aIgnoreRootScrollFrame
,
369 [optional] in float aPressure
,
370 [optional] in unsigned short aInputSourceArg
,
371 [optional] in boolean aIsDOMEventSynthesized
,
372 [optional] in boolean aIsWidgetEventSynthesized
,
373 [optional] in long aButtons
,
374 [optional] in unsigned long aIdentifier
);
376 /** Synthesize a touch event. The event types supported are:
377 * touchstart, touchend, touchmove, and touchcancel
379 * Events are sent in coordinates offset by aX and aY from the window.
381 * Cannot be accessed from unprivileged context (not content-accessible)
382 * Will throw a DOM security error if called without chrome privileges.
384 * The event is dispatched via the toplevel window, so it could go to any
385 * window under the toplevel window, in some cases it could never reach this
388 * @param aType event type
389 * @param xs array of offsets in CSS pixels for each touch to be sent
390 * @param ys array of offsets in CSS pixels for each touch to be sent
391 * @param rxs array of radii in CSS pixels for each touch to be sent
392 * @param rys array of radii in CSS pixels for each touch to be sent
393 * @param rotationAngles array of angles in degrees for each touch to be sent
394 * @param forces array of forces (floats from 0 to 1) for each touch to be sent
395 * @param tiltXs array of tiltX for each touch to be sent
396 * @param tiltYs array of tiltY for each touch to be sent
397 * @param twists array of twist for each touch to be sent
398 * @param count number of touches in this set
399 * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
400 * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
403 * returns true if the page called prevent default on this touch event
406 boolean sendTouchEvent
(in AString aType
,
407 in Array
<uint32_t
> aIdentifiers
,
408 in Array
<int32_t
> aXs
,
409 in Array
<int32_t
> aYs
,
410 in Array
<uint32_t
> aRxs
,
411 in Array
<uint32_t
> aRys
,
412 in Array
<float> aRotationAngles
,
413 in Array
<float> aForces
,
414 in Array
<long> aTiltXs
,
415 in Array
<long> aTiltYs
,
416 in Array
<long> aTwists
,
418 [optional] in boolean aIgnoreRootScrollFrame
);
420 /** The same as sendMouseEvent but ensures that the event is dispatched to
421 * this DOM window or one of its children.
423 [optional_argc
, can_run_script
]
424 void sendMouseEventToWindow
(in AString aType
,
430 [optional] in boolean aIgnoreRootScrollFrame
,
431 [optional] in float aPressure
,
432 [optional] in unsigned short aInputSourceArg
,
433 [optional] in boolean aIsDOMEventSynthesized
,
434 [optional] in boolean aIsWidgetEventSynthesized
,
435 [optional] in long aButtons
,
436 [optional] in unsigned long aIdentifier
);
438 /** The same as sendTouchEvent but ensures that the event is dispatched to
439 * this DOM window or one of its children.
442 boolean sendTouchEventToWindow
(in AString aType
,
443 in Array
<uint32_t
> aIdentifiers
,
444 in Array
<int32_t
> aXs
,
445 in Array
<int32_t
> aYs
,
446 in Array
<uint32_t
> aRxs
,
447 in Array
<uint32_t
> aRys
,
448 in Array
<float> aRotationAngles
,
449 in Array
<float> aForces
,
450 in Array
<long> aTiltXs
,
451 in Array
<long> aTiltYs
,
452 in Array
<long> aTwists
,
454 [optional] in boolean aIgnoreRootScrollFrame
);
456 /** Synthesize a wheel event for a window. The event types supported is only
459 * Events are sent in coordinates offset by aX and aY from the window.
461 * Cannot be accessed from unprivileged context (not content-accessible)
462 * Will throw a DOM security error if called without chrome privileges.
464 * @param aX x offset in CSS pixels
465 * @param aY y offset in CSS pixels
466 * @param aDeltaX deltaX value.
467 * @param aDeltaY deltaY value.
468 * @param aDeltaZ deltaZ value.
469 * @param aDeltaMode deltaMode value which must be one of the
470 * WheelEvent DOM_DELTA_* constants.
471 * @param aModifiers modifiers pressed, using constants defined as
473 * @param aLineOrPageDeltaX If you set this value non-zero for
474 * DOM_DELTA_PIXEL event, EventStateManager will
475 * dispatch NS_MOUSE_SCROLL event for horizontal
477 * @param aLineOrPageDeltaY If you set this value non-zero for
478 * DOM_DELTA_PIXEL event, EventStateManager will
479 * dispatch NS_MOUSE_SCROLL event for vertical
481 * @param aOptions Set following flags.
483 const unsigned long WHEEL_EVENT_CAUSED_BY_NO_LINE_OR_PAGE_DELTA_DEVICE
= 0x0001;
484 const unsigned long WHEEL_EVENT_CAUSED_BY_MOMENTUM
= 0x0002;
485 const unsigned long WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS
= 0x0004;
486 // If any of the following flags is specified this method will throw an
487 // exception in case the relevant overflowDelta has an unexpected value.
488 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO
= 0x0010;
489 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE
= 0x0020;
490 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE
= 0x0040;
491 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO
= 0x0100;
492 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE
= 0x0200;
493 const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE
= 0x0400;
494 void sendWheelEvent
(in float aX
,
499 in unsigned long aDeltaMode
,
501 in long aLineOrPageDeltaX
,
502 in long aLineOrPageDeltaY
,
503 in unsigned long aOptions
);
506 * Native modifiers for sendNativeKeyEvent and sendNativeMouseEvent.
507 * TODO: The other sendNative*Event should take these values instead.
509 const unsigned long NATIVE_MODIFIER_CAPS_LOCK
= 0x00000001;
510 const unsigned long NATIVE_MODIFIER_NUM_LOCK
= 0x00000002;
511 const unsigned long NATIVE_MODIFIER_SHIFT_LEFT
= 0x00000100;
512 const unsigned long NATIVE_MODIFIER_SHIFT_RIGHT
= 0x00000200;
513 const unsigned long NATIVE_MODIFIER_CONTROL_LEFT
= 0x00000400;
514 const unsigned long NATIVE_MODIFIER_CONTROL_RIGHT
= 0x00000800;
515 const unsigned long NATIVE_MODIFIER_ALT_LEFT
= 0x00001000;
516 const unsigned long NATIVE_MODIFIER_ALT_RIGHT
= 0x00002000;
517 const unsigned long NATIVE_MODIFIER_COMMAND_LEFT
= 0x00004000;
518 const unsigned long NATIVE_MODIFIER_COMMAND_RIGHT
= 0x00008000;
519 const unsigned long NATIVE_MODIFIER_HELP
= 0x00010000;
520 // On Windows, AltGraph key emulates the AltRight key on specific keyboard
521 // layouts. Therefore, this shouldn't be used without `synthesizeNativeKey`.
522 const unsigned long NATIVE_MODIFIER_ALT_GRAPH
= 0x00020000;
523 // Available only on macOS.
524 const unsigned long NATIVE_MODIFIER_FUNCTION
= 0x00100000;
525 // Available only on macOS. When pressing a key in numeric key pad, this
527 const unsigned long NATIVE_MODIFIER_NUMERIC_KEY_PAD
= 0x01000000;
530 * See nsIWidget::SynthesizeNativeKeyEvent
532 * Cannot be accessed from unprivileged context (not content-accessible)
533 * Will throw a DOM security error if called without chrome privileges.
535 * When you use this for tests, use the constants defined in NativeKeyCodes.js
537 * NOTE: The synthesized native event will be fired asynchronously, and upon
538 * completion the observer, if provided, will be notified with a "keyevent"
541 void sendNativeKeyEvent
(in long aNativeKeyboardLayout
,
542 in long aNativeKeyCode
,
543 in unsigned long aModifierFlags
,
544 in AString aCharacters
,
545 in AString aUnmodifiedCharacters
,
546 [optional] in nsIObserver aObserver
);
549 * See nsIWidget::SynthesizeNativeMouseEvent
551 * Will be called on the widget that contains aElement.
552 * Cannot be accessed from unprivileged context (not content-accessible)
553 * Will throw a DOM security error if called without chrome privileges.
555 * @param aScreenX X offset in the screen in device pixels.
556 * @param aScreenY Y offset in the screen in derive pixels.
557 * @param aNativeMessage One of NATIVE_MOUSE_MESSAGE_*
558 * @param aButton Same as `MouseEvent.button` value.
559 * @param aModifierFlags See nsIWidget's native modifier flags.
560 * @param aElementOnWidget An element which is on a widget.
561 * @param aObserver The synthesized native event will be fired
562 * asynchronously, and upon completion the observer, if
563 * provided, will be notified with a "mouseevent" topic.
565 const unsigned long NATIVE_MOUSE_MESSAGE_BUTTON_DOWN
= 0x00000001;
566 const unsigned long NATIVE_MOUSE_MESSAGE_BUTTON_UP
= 0x00000002;
567 const unsigned long NATIVE_MOUSE_MESSAGE_MOVE
= 0x00000003;
568 const unsigned long NATIVE_MOUSE_MESSAGE_ENTER_WINDOW
= 0x00000004;
569 const unsigned long NATIVE_MOUSE_MESSAGE_LEAVE_WINDOW
= 0x00000005;
570 void sendNativeMouseEvent
(in long aScreenX
,
572 in unsigned long aNativeMessage
,
574 in unsigned long aModifierFlags
,
575 in Element aElementOnWidget
,
576 [optional] in nsIObserver aObserver
);
579 * Suppress animations that are applied to a window by OS when
580 * resizing, moving, changing size mode, ...
582 void suppressAnimation
(in boolean aSuppress
);
585 * The values for sendNativeMouseScrollEvent's aAdditionalFlags.
589 * If MOUSESCROLL_PREFER_WIDGET_AT_POINT is set, widget will dispatch
590 * the event to a widget which is under the cursor. Otherwise, dispatch to
591 * a default target on the platform. E.g., on Windows, it's focused window.
593 const unsigned long MOUSESCROLL_PREFER_WIDGET_AT_POINT
= 0x00000001;
596 * Interpret the scroll delta values as lines rather than pixels.
598 const unsigned long MOUSESCROLL_SCROLL_LINES
= 0x00000002;
601 * The platform specific values of aAdditionalFlags. Must be over 0x00010000.
605 * If MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL is set and aNativeMessage is
606 * WM_VSCROLL or WM_HSCROLL, widget will set the window handle to the lParam
609 const unsigned long MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL
= 0x00010000;
612 * See nsIWidget::SynthesizeNativeMouseScrollEvent
614 * Will be called on the widget that contains aElement.
615 * Cannot be accessed from unprivileged context (not content-accessible)
616 * Will throw a DOM security error if called without chrome privileges.
618 * NOTE: The synthesized native event will be fired asynchronously, and upon
619 * completion the observer, if provided, will be notified with a
620 * "mousescrollevent" topic.
622 * @param aNativeMessage
623 * On Windows: WM_MOUSEWHEEL (0x020A), WM_MOUSEHWHEEL(0x020E),
624 * WM_VSCROLL (0x0115) or WM_HSCROLL (0x114).
626 void sendNativeMouseScrollEvent
(in long aScreenX
,
628 in unsigned long aNativeMessage
,
632 in unsigned long aModifierFlags
,
633 in unsigned long aAdditionalFlags
,
635 [optional] in nsIObserver aObserver
);
638 * Touch states for sendNativeTouchPoint. These values match
639 * nsIWidget's TouchPointerState.
642 // The pointer is in a hover state above the digitizer
643 const long TOUCH_HOVER
= 0x01;
644 // The pointer is in contact with the digitizer
645 const long TOUCH_CONTACT
= 0x02;
646 // The pointer has been removed from the digitizer detection area
647 const long TOUCH_REMOVE
= 0x04;
648 // The pointer has been canceled. Will cancel any pending os level
649 // gestures that would be triggered as a result of completion of the
650 // input sequence. This may not cancel moz platform related events
651 // that might get tirggered by input already delivered.
652 const long TOUCH_CANCEL
= 0x08;
655 * Phase states for sendNativeTouchPadPinch.
657 const long PHASE_BEGIN
= 0;
658 const long PHASE_UPDATE
= 1;
659 const long PHASE_END
= 2;
662 * Create a new or update an existing touch point on the digitizer.
663 * To trigger os level gestures, individual touch points should
664 * transition through a complete set of touch states which should be
665 * sent as individual calls. For example:
666 * tap - msg1:TOUCH_CONTACT, msg2:TOUCH_REMOVE
667 * drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE
668 * hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE
670 * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will throw.
672 * NOTE: The synthesized native event will be fired asynchronously, and upon
673 * completion the observer, if provided, will be notified with a "touchpoint"
676 * @param aPointerId The touch point id to create or update.
677 * @param aTouchState one or more of the touch states listed above
678 * @param aScreenX, aScreenY screen coords of this event
679 * @param aPressure 0.0 -> 1.0 float val indicating pressure
680 * @param aOrientation 0 -> 359 degree value indicating the
681 * orientation of the pointer. Use 90 for normal taps.
683 void sendNativeTouchPoint
(in unsigned long aPointerId
,
684 in unsigned long aTouchState
,
688 in unsigned long aOrientation
,
689 [optional] in nsIObserver aObserver
);
691 * These values indicate touchpad pinch phase states :
695 * Widget support: Linux GTK 3.18+.
696 * @param aEventPhase The touchpad pinch phase using states listed above.
697 * @param aScale Events with PHASE_UPDATE will change the zoom level by
698 * the ratio between the scale of the current event and the scale of the last event.
699 * @param aScreenX, aScreenY screen coords of the focus point of this event.
700 * @param aModifierFlags is expected to contain native modifier values.
702 void sendNativeTouchpadPinch
(in unsigned long aEventPhase
,
706 in long aModifierFlags
);
709 * Simulates native touch based taps on the input digitizer. Events
710 * triggered by this call are injected at the os level. Events do not
711 * bypass widget level input processing and as such can be used to
712 * test widget event logic and async pan-zoom controller functionality.
713 * Cannot be accessed from an unprivileged context.
715 * Long taps (based on the aLongTap parameter) will be completed
716 * asynchrnously after the call returns. Long tap delay is based on
717 * the ui.click_hold_context_menus.delay pref or 1500 msec if pref
720 * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will
723 * NOTE: The synthesized native event will be fired asynchronously, and upon
724 * completion the observer, if provided, will be notified, with a "touchtap"
727 * @param aScreenX, aScreenY screen coords of this event
728 * @param aLongTap true if the tap should be long, false for a short
731 void sendNativeTouchTap
(in long aScreenX
,
734 [optional] in nsIObserver aObserver
);
737 * Create a new or update an existing pen input on the digitizer.
739 * Widget support: Windows 10 1809+. Other widgets will throw.
741 * NOTE: The synthesized native event will be fired asynchronously, and upon
742 * completion the observer, if provided, will be notified with a "peninput"
745 * @param aPointerId The touch point id to create or update.
746 * @param aPointerState one or more of the TOUCH_* listed above
747 * @param aScreenX x screen coord of this event
748 * @param aScreenY y screen coord of this event
749 * @param aPressure 0.0 -> 1.0 float val indicating pressure
750 * @param aRotation 0 -> 359 degree value indicating the rotation of the
751 * pointer. Use 0 for normal taps.
752 * @param aTiltX -90 -> 90 degree value indicating the tilt along the x-axis
753 * of the pointer. Use 0 for normal taps.
754 * @param aTiltY -90 -> 90 degree value indicating the tilt along the y-axis
755 * of the pointer. Use 0 for normal taps.
756 * @param aButton Same as MouseEvent::button.
758 void sendNativePenInput
(in unsigned long aPointerId
,
759 in unsigned long aPointerState
,
763 in unsigned long aRotation
,
767 [optional] in nsIObserver aObserver
);
770 * Cancel any existing touch points or long tap delays. Calling this is safe
771 * even if you're sure there aren't any pointers recorded. You should call
772 * this when tests shut down to reset the digitizer driver. Not doing so can
773 * leave the digitizer in an undetermined state which can screw up subsequent
774 * tests and native input.
776 * NOTE: The synthesized native event will be fired asynchronously, and upon
777 * completion the observer, if provided, will be notified with a "cleartouch"
780 void clearNativeTouchSequence
([optional] in nsIObserver aObserver
);
783 * Send a native event as if the user double tapped the touchpad with two
786 * Widget support: macOS.
787 * @param aScreenX, aScreenY screen coords of the focus point of this event.
788 * @param aModifierFlags is expected to contain native modifier values.
790 void sendNativeTouchpadDoubleTap
(in long aScreenX
,
792 in long aModifierFlags
);
795 * Send a native event as if the user panned on the touchpad with two
798 * NOTE: The synthesized native event will be fired asynchronously, and upon
799 * completion the observer, if provided, will be notified with a
800 * "touchpadpanevent" topic.
802 * Widget support: Windows.
803 * @param aScreenX, aScreenY screen coords of the focus point of this event.
804 * @param aDeltaX, aDeltaY the amount of delta in the pan.
805 * @param aModifierFlags is expected to contain native modifier values.
807 void sendNativeTouchpadPan
(in unsigned long aEventPhase
,
812 in long aModifierFlags
,
813 [optional] in nsIObserver aObserver
);
816 * Clears the SharedStyleSheetCache.
818 void clearSharedStyleSheetCache
();
821 * Returns the number of stylesheets that have been parsed on this document.
822 * Useful to test caching.
824 readonly attribute
unsigned long parsedStyleSheets
;
827 * See nsIWidget::ActivateNativeMenuItemAt
829 * Cannot be accessed from unprivileged context (not content-accessible)
830 * Will throw a DOM security error if called without chrome privileges.
832 void activateNativeMenuItemAt
(in AString indexString
);
835 * See nsIWidget::ForceUpdateNativeMenuAt
837 * Cannot be accessed from unprivileged context (not content-accessible)
838 * Will throw a DOM security error if called without chrome privileges.
840 void forceUpdateNativeMenuAt
(in AString indexString
);
843 * Returns the current selection as plaintext. Note that the result may be
844 * different from the result of sendQueryContentEvent(QUERY_SELECTED_TEXT).
845 * This result is computed by native API with transferable data. In other
846 * words, when the OS treats the selection as plaintext, it treats current
847 * selection as this result.
849 AString GetSelectionAsPlaintext
();
852 * Force a garbage collection followed by a cycle collection.
854 * Will throw a DOM security error if called without chrome privileges in
855 * non-debug builds. Available to all callers in debug builds.
857 * @param aListener listener that receives information about the CC graph
859 void garbageCollect
([optional] in nsICycleCollectorListener aListener
);
862 * Force a cycle collection without garbage collection.
864 * Will throw a DOM security error if called without chrome privileges in
865 * non-debug builds. Available to all callers in debug builds.
867 * @param aListener listener that receives information about the CC graph
869 void cycleCollect
([optional] in nsICycleCollectorListener aListener
);
872 * Trigger whichever GC or CC timer is currently active and waiting to fire.
873 * Don't do this too much for initiating heavy actions, like the start of a IGC.
875 * @param aReason the reason for the GC, from js/public/GCAPI.h. Defaults to
878 void runNextCollectorTimer
([optional] in ACString aReason
);
881 * "Poke" the GC: set a timer to run a GC soon (usually 4 seconds), unless
882 * another GC timer has already been set. This is used for testing.
884 * @param aReason the reason for the GC, from js/public/GCAPI.h. Defaults to
887 void pokeGC
([optional] in ACString aReason
);
889 /** Synthesize a simple gesture event for a window. The event types
890 * supported are: MozSwipeGestureMayStart, MozSwipeGestureStart,
891 * MozSwipeGestureUpdate, MozSwipeGestureEnd, MozSwipeGesture,
892 * MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture,
893 * MozRotateGestureStart, MozRotateGestureUpdate, MozRotateGesture,
894 * MozPressTapGesture, MozTapGesture, and MozEdgeUIGesture.
896 * Cannot be accessed from unprivileged context (not
897 * content-accessible) Will throw a DOM security error if called
898 * without chrome privileges.
900 * @param aType event type
901 * @param aX x offset in CSS pixels
902 * @param aY y offset in CSS pixels
903 * @param aDirection direction, using constants defined in SimpleGestureEvent.webidl
904 * @param aDelta amount of magnification or rotation for magnify and rotation events
905 * @param aModifiers modifiers pressed, using constants defined in Event.webidl
906 * @param aClickCount For tap gestures, the number of taps.
908 void sendSimpleGestureEvent
(in AString aType
,
911 in unsigned long aDirection
,
914 [optional] in unsigned long aClickCount
);
917 * Retrieve the element at point aX, aY in the window's document.
919 * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
920 * frame when retrieving the element. If false, this method returns
921 * null for coordinates outside of the viewport.
922 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
924 Element elementFromPoint
(in float aX
,
926 in boolean aIgnoreRootScrollFrame
,
927 in boolean aFlushLayout
);
930 * Retrieve all nodes that intersect a rect in the window's document.
932 * @param aX x reference for the rectangle in CSS pixels
933 * @param aY y reference for the rectangle in CSS pixels
934 * @param aTopSize How much to expand up the rectangle
935 * @param aRightSize How much to expand right the rectangle
936 * @param aBottomSize How much to expand down the rectangle
937 * @param aLeftSize How much to expand left the rectangle
938 * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
939 * frame when retrieving the element. If false, this method returns
940 * null for coordinates outside of the viewport.
941 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
942 * @param aOnlyVisible Set to true if you only want nodes that pass a visibility
944 * @param aTransparencyThreshold Only has an effect if aOnlyVisible is true.
945 * Returns what amount of transparency is considered "opaque enough"
946 * to consider elements "not visible". The default is effectively "1"
947 * (so, only opaque elements will stop an element from being
950 NodeList nodesFromRect
(in float aX
,
954 in float aBottomSize
,
956 in boolean aIgnoreRootScrollFrame
,
957 in boolean aFlushLayout
,
958 in boolean aOnlyVisible
,
959 [optional] in float aTransparencyThreshold
);
963 * Get a list of nodes that have meaningful textual content to
964 * be translated. The implementation of this algorithm is in flux
965 * as we experiment and refine which approach works best.
967 * This method requires chrome privileges.
969 nsITranslationNodeList getTranslationNodes
(in Node aRoot
);
972 * Compare the two canvases, returning the number of differing pixels and
973 * the maximum difference in a channel. This will throw an error if
974 * the dimensions of the two canvases are different.
976 * This method requires chrome privileges.
978 uint32_t compareCanvases
(in nsISupports aCanvas1
,
979 in nsISupports aCanvas2
,
980 out unsigned long aMaxDifference
);
983 * Returns true if a MozAfterPaint event has been queued but not yet
986 readonly attribute
boolean isMozAfterPaintPending
;
989 * Returns true if the InputTaskManager is suspended.
991 readonly attribute
boolean isInputTaskManagerSuspended
;
994 * Suppresses/unsuppresses user initiated event handling in window's document
997 * @throw NS_ERROR_DOM_SECURITY_ERR if called without chrome privileges and
998 * NS_ERROR_FAILURE if window doesn't have a document.
1000 void suppressEventHandling
(in boolean aSuppress
);
1003 * Disable or enable non synthetic test mouse events on *all* windows.
1005 * Cannot be accessed from unprivileged context (not content-accessible).
1006 * Will throw a DOM security error if called without chrome privileges.
1008 * @param aDisable If true, disable all non synthetic test mouse events
1009 * on all windows. Otherwise, enable them.
1011 void disableNonTestMouseEvents
(in boolean aDisable
);
1014 * Returns the scroll position of the window's currently loaded document.
1016 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
1017 * @see nsIDOMWindow::scrollX/Y
1019 void getScrollXY
(in boolean aFlushLayout
, out long aScrollX
, out long aScrollY
);
1022 * Returns the scroll position of the window's currently loaded document.
1024 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
1025 * @see nsIDOMWindow::scrollX/Y
1027 void getScrollXYFloat
(in boolean aFlushLayout
, out float aScrollX
, out float aScrollY
);
1030 * Returns the scrollbar width of the window's scroll frame.
1032 * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
1034 void getScrollbarSize
(in boolean aFlushLayout
, out long aWidth
, out long aHeight
);
1037 * Returns the given element's bounds without flushing pending layout changes.
1039 DOMRect getBoundsWithoutFlushing
(in Element aElement
);
1042 * Scroll the visual viewport to the given coordinates, relative to the
1044 * Only applicable to the window associated with the root content document.
1045 * Note: this does not take effect right away. Rather, the visual scroll
1046 * request is sent to APZ with the next transaction, and will be
1047 * reflected in the main thread with the subsequent APZ repaint request.
1048 * Please see the caveats mentioned at PresShell::ScrollToVisual(), and
1049 * request APZ review if adding a new call to this.
1051 const long UPDATE_TYPE_RESTORE
= 0;
1052 const long UPDATE_TYPE_MAIN_THREAD
= 1;
1053 const long SCROLL_MODE_INSTANT
= 0;
1054 const long SCROLL_MODE_SMOOTH
= 1;
1055 void scrollToVisual
(in float aOffsetX
, in float aOffsetY
,
1056 in long aUpdateType
, in long aScrollMode
);
1059 * Returns the offset of the window's visual viewport relative to the
1062 void getVisualViewportOffsetRelativeToLayoutViewport
(out float aOffsetX
,
1063 out float aOffsetY
);
1066 * Returns the scroll position of the window's visual viewport.
1068 void getVisualViewportOffset
(out long aOffsetX
, out long aOffsetY
);
1071 * Transforms the passed in rect from layout relative coords (relative to
1072 * this document) to be is visual coords.
1074 DOMRect transformRectLayoutToVisual
(in float aX
, in float aY
,
1075 in float aWidth
, in float aHeight
);
1078 * Transform a rectangle given in coordinates relative to this document
1079 * into CSS coordinates relative to the screen.
1081 DOMRect toScreenRectInCSSUnits
(in float aX
, in float aY
,
1082 in float aWidth
, in float aHeight
);
1085 * Transform a rectangle given in coordinates relative to this document
1088 DOMRect toScreenRect
(in float aX
, in float aY
,
1089 in float aWidth
, in float aHeight
);
1092 * Transform a rectangle given in coordinates relative to the top level
1093 * parent process widget to the local widget. This window should be in a
1096 DOMRect convertFromParentProcessWidgetToLocal
(in float aX
,
1102 * Sets the maximum height of the dynamic toolbar in Screen pixel units.
1105 void setDynamicToolbarMaxHeight
(in uint32_t aHeightInScreen
);
1107 const long FLUSH_NONE
= -1;
1108 const long FLUSH_STYLE
= 0;
1109 const long FLUSH_LAYOUT
= 1;
1110 const long FLUSH_DISPLAY
= 2;
1113 * Returns true if a flush of the given type is needed.
1115 bool needsFlush
(in long aFlushtype
);
1118 * Flush pending layout-type notification without flushing throttled
1121 void flushLayoutWithoutThrottledAnimations
();
1124 * Returns the bounds of the window's currently loaded document. This will
1125 * generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL
1126 * documents) may have a negative left value.
1128 DOMRect getRootBounds
();
1131 * Get IME open state. TRUE means 'Open', otherwise, 'Close'.
1132 * This property works only when IMEEnabled is IME_STATUS_ENABLED.
1134 readonly attribute
boolean IMEIsOpen
;
1137 * WARNING: These values must be same as nsIWidget's values.
1141 * DISABLED means users cannot use IME completely.
1142 * Note that this state is *not* same as |ime-mode: disabled;|.
1144 const unsigned long IME_STATUS_DISABLED
= 0;
1147 * ENABLED means users can use all functions of IME. This state is same as
1148 * |ime-mode: normal;|.
1150 const unsigned long IME_STATUS_ENABLED
= 1;
1153 * PASSWORD means users cannot use most functions of IME. But on GTK2,
1154 * users can use "Simple IM" which only supports dead key inputting.
1155 * The behavior is same as the behavior of the native password field.
1156 * This state is same as |ime-mode: disabled;|.
1158 const unsigned long IME_STATUS_PASSWORD
= 2;
1161 * Get IME status, see above IME_STATUS_* definitions.
1163 readonly attribute
unsigned long IMEStatus
;
1166 * Get the document URI which may be retrieved by native IME.
1168 readonly attribute nsIURI inputContextURI
;
1171 * Get whether current input context (including IME status) in the widget
1172 * is set by content or not.
1174 const unsigned long INPUT_CONTEXT_ORIGIN_MAIN
= 0;
1175 const unsigned long INPUT_CONTEXT_ORIGIN_CONTENT
= 1;
1176 readonly attribute
unsigned long inputContextOrigin
;
1179 * Get a root node which is observed by IMEContentObserver.
1181 readonly attribute Node nodeObservedByIMEContentObserver
;
1184 * Dispatches aEvent as a synthesized trusted event for tests via the
1185 * PresShell object of the window's document.
1186 * The event is dispatched to aTarget, which should be an object
1187 * which implements nsIContent interface (#element, #text, etc).
1189 * Cannot be accessed from unprivileged context (not
1190 * content-accessible) Will throw a DOM security error if called
1191 * without chrome privileges.
1193 * @note Event handlers won't get aEvent as parameter, but a similar event.
1194 * Also, aEvent should not be reused.
1197 boolean dispatchDOMEventViaPresShellForTesting
(in Node aTarget
,
1201 * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that
1202 * the event is propagated only to chrome.
1203 * Event's .target property will be aTarget.
1204 * Returns the same value as what EventTarget.dispatchEvent does.
1206 boolean dispatchEventToChromeOnly
(in EventTarget aTarget
,
1210 * Returns the real classname (possibly of the mostly-transparent security
1213 [implicit_jscontext
] string getClassName
(in jsval aObject
);
1216 * Generate a content command event.
1218 * Cannot be accessed from unprivileged context (not content-accessible)
1219 * Will throw a DOM security error if called without chrome privileges.
1221 * @param aType Type of command content event to send. Can be one of "cut",
1222 * "copy", "paste", "delete", "undo", "redo", "insertText" or
1223 * "pasteTransferable".
1224 * @param aTransferable an instance of nsITransferable when aType is
1225 * "pasteTransferable"
1226 * @param aString The string to be inserted into focused editor when aType is
1229 void sendContentCommandEvent
(in AString aType
,
1230 [optional] in nsITransferable aTransferable
,
1231 [optional] in AString aString
);
1234 * If sendQueryContentEvent()'s aAdditionalFlags argument is
1235 * QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK, plain text generated from content
1236 * is created with "\n".
1237 * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used.
1238 * aOffset and aLength are offset and length in/of the plain text content.
1239 * This flag also affects the result values such as offset, length and string.
1241 const unsigned long QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK
= 0x0000;
1242 const unsigned long QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK
= 0x0001;
1245 * sendQueryContentEvent()'s aAdditionalFlags may have one of following
1246 * flags when aType is QUERY_SELECTED_TEXT. If one of them is set,
1247 * the result is the first range of the selection type. See also
1248 * nsISelectionController::SELECTION_*.
1250 const unsigned long QUERY_CONTENT_FLAG_SELECTION_SPELLCHECK
= 0x0002;
1251 const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_RAWINPUT
= 0x0004;
1252 const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDRAWTEXT
= 0x0008;
1253 const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_CONVERTEDTEXT
= 0x0010;
1254 const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDCONVERTEDTEXT
=
1256 const unsigned long QUERY_CONTENT_FLAG_SELECTION_ACCESSIBILITY
= 0x0040;
1257 const unsigned long QUERY_CONTENT_FLAG_SELECTION_FIND
= 0x0080;
1258 const unsigned long QUERY_CONTENT_FLAG_SELECTION_URLSECONDARY
= 0x0100;
1259 const unsigned long QUERY_CONTENT_FLAG_SELECTION_URLSTRIKEOUT
= 0x0200;
1262 * One of sendQueryContentEvent()'s aAdditionalFlags. If this is specified,
1263 * aOffset is relative to start of selection or composition.
1264 * Note that this is supported only when QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK
1265 * is not specified for now.
1267 const unsigned long QUERY_CONTENT_FLAG_OFFSET_RELATIVE_TO_INSERTION_POINT
=
1271 * Synthesize a query content event. Note that the result value returned here
1272 * is in LayoutDevice pixels rather than CSS pixels.
1274 * @param aType One of the following const values. And see also each comment
1275 * for the other parameters and the result.
1276 * @param aAdditionalFlags See the description of QUERY_CONTENT_FLAG_*.
1278 nsIQueryContentEventResult sendQueryContentEvent
(
1279 in unsigned long aType
,
1280 in long long aOffset
,
1281 in unsigned long aLength
,
1284 [optional] in unsigned long aAdditionalFlags
);
1287 * QUERY_SELECTED_TEXT queries the first selection range's information.
1289 * @param aOffset Not used.
1290 * @param aLength Not used.
1291 * @param aX Not used.
1292 * @param aY Not used.
1294 * @return offset, reversed and text properties of the result are available.
1296 const unsigned long QUERY_SELECTED_TEXT
= 3200;
1299 * QUERY_TEXT_CONTENT queries the text at the specified range.
1301 * @param aOffset The first character's offset. 0 is the first character.
1302 * @param aLength The length of getting text. If the aLength is too long,
1303 * the result text is shorter than this value.
1304 * @param aX Not used.
1305 * @param aY Not used.
1307 * @return text property of the result is available.
1309 const unsigned long QUERY_TEXT_CONTENT
= 3201;
1312 * QUERY_CARET_RECT queries the (collapsed) caret rect of the offset.
1313 * If the actual caret is there at the specified offset, this returns the
1314 * actual caret rect. Otherwise, this guesses the caret rect from the
1315 * metrics of the text.
1317 * @param aOffset The caret offset. 0 is the left side of the first
1318 * caracter in LTR text.
1319 * @param aLength Not used.
1320 * @param aX Not used.
1321 * @param aY Not used.
1323 * @return left, top, width and height properties of the result are available.
1324 * The left and the top properties are offset in the client area of
1327 const unsigned long QUERY_CARET_RECT
= 3203;
1330 * QUERY_TEXT_RECT queries the specified text's rect.
1332 * @param aOffset The first character's offset. 0 is the first character.
1333 * @param aLength The length of getting text. If the aLength is too long,
1334 * the extra length is ignored.
1335 * @param aX Not used.
1336 * @param aY Not used.
1338 * @return left, top, width and height properties of the result are available.
1339 * The left and the top properties are offset in the client area of
1342 const unsigned long QUERY_TEXT_RECT
= 3204;
1345 * QUERY_TEXT_RECT queries the focused editor's rect.
1347 * @param aOffset Not used.
1348 * @param aLength Not used.
1349 * @param aX Not used.
1350 * @param aY Not used.
1352 * @return left, top, width and height properties of the result are available.
1354 const unsigned long QUERY_EDITOR_RECT
= 3205;
1357 * QUERY_CHARACTER_AT_POINT queries the character information at the
1358 * specified point. The point is offset in the window.
1359 * NOTE: If there are some panels at the point, this method send the query
1360 * event to the panel's widget automatically.
1362 * @param aOffset Not used.
1363 * @param aLength Not used.
1364 * @param aX X offset in the widget.
1365 * @param aY Y offset in the widget.
1367 * @return offset, notFound, left, top, width and height properties of the
1368 * result are available.
1370 const unsigned long QUERY_CHARACTER_AT_POINT
= 3208;
1373 * QUERY_TEXT_RECT_ARRAY queries the rects per character
1375 * @param aOffset The first character's offset. 0 is the first character.
1376 * @param aLength The length of getting text. If the aLength is too long,
1377 * the extra length is ignored.
1378 * @param aX Not used.
1379 * @param aY Not used.
1381 const unsigned long QUERY_TEXT_RECT_ARRAY
= 3209;
1384 * Called when the remote child frame has changed its fullscreen state,
1385 * when entering fullscreen, and when the origin which is fullscreen changes.
1386 * aFrameElement is the iframe element which contains the child-process
1387 * fullscreen document.
1389 void remoteFrameFullscreenChanged
(in Element aFrameElement
);
1392 * Called when the remote frame has popped all fullscreen elements off its
1393 * stack, so that the operation can complete on the parent side.
1395 void remoteFrameFullscreenReverted
();
1398 * Calls the document to handle any pending fullscreen requests.
1399 * It is called when the parent document has entered fullscreen, and
1400 * we want to put the current document into fullscreen as well.
1401 * The return value indicates whether there is any fullscreen request
1402 * handled by this call.
1404 boolean handleFullscreenRequests
();
1407 * Called when the child frame has fully exit fullscreen, so that the parent
1408 * process can also fully exit.
1410 * @param aDontResoreViewSize false if content view size is restored by
1411 * original view size that is on entering full
1414 void exitFullscreen
([optional] in boolean aDontRestoreViewSize
);
1417 * If sendQueryContentEvent()'s aAdditionalFlags argument is
1418 * SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK, aOffset and aLength are offset
1419 * and length in/of plain text generated from content is created with "\n".
1420 * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used.
1422 const unsigned long SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK
= 0x0000;
1423 const unsigned long SELECTION_SET_FLAG_USE_XP_LINE_BREAK
= 0x0001;
1426 * If SELECTION_SET_FLAG_REVERSE is set, the selection is set from
1427 * |aOffset + aLength| to |aOffset|. Otherwise, it's set from |aOffset| to
1428 * |aOffset + aLength|.
1430 const unsigned long SELECTION_SET_FLAG_REVERSE
= 0x0002;
1433 * Synthesize a selection set event to the window.
1435 * This sets the selection as the specified information.
1436 * Note that for avoiding unnecessary update from user and web app point of
1437 * view, it compares aOffset and aLength with selection cache which is same
1438 * as what is notified with NOTIFY_IME_OF_SELECTION_CHANGE. Therefore, if
1439 * the notification is still queued, this works different from user's
1440 * scenario. Therefore, before calling this, the caller should wait at least
1441 * 2 animation frames if `Selection` was changed before.
1443 * @param aOffset The caret offset of the selection start.
1444 * @param aLength The length of the selection. If this is too long, the
1445 * extra length is ignored.
1446 * @param aAdditionalFlags See the description of SELECTION_SET_FLAG_*.
1447 * @return True, if succeeded. Otherwise, false.
1449 boolean sendSelectionSetEvent
(in unsigned long aOffset
,
1450 in unsigned long aLength
,
1451 [optional] in unsigned long aAdditionalFlags
);
1453 /* Selection behaviors - mirror nsIFrame's nsSelectionAmount constants */
1454 const unsigned long SELECT_CHARACTER
= 0;
1455 const unsigned long SELECT_CLUSTER
= 1;
1456 const unsigned long SELECT_WORD
= 2;
1457 const unsigned long SELECT_LINE
= 3;
1458 const unsigned long SELECT_BEGINLINE
= 4;
1459 const unsigned long SELECT_ENDLINE
= 5;
1460 const unsigned long SELECT_PARAGRAPH
= 6;
1461 const unsigned long SELECT_WORDNOSPACE
= 7;
1464 * Select content at a client point based on a selection behavior if the
1465 * underlying content is selectable. Selection will accumulate with any
1466 * existing selection, callers should clear selection prior if needed.
1467 * May fire selection changed events. Calls nsFrame's SelectByTypeAtPoint.
1469 * @param aX, aY The selection point in client coordinates.
1470 * @param aSelectType The selection behavior requested.
1471 * @return True if a selection occured, false otherwise.
1472 * @throw NS_ERROR_DOM_SECURITY_ERR, NS_ERROR_UNEXPECTED for utils
1473 * issues, and NS_ERROR_INVALID_ARG for coordinates that are outside
1477 boolean selectAtPoint
(in float aX
,
1479 in unsigned long aSelectBehavior
);
1482 * Perform the equivalent of:
1483 * window.getComputedStyle(aElement, aPseudoElement).
1484 * getPropertyValue(aPropertyName)
1485 * except that, when the link whose presence in history is allowed to
1486 * influence aElement's style is visited, get the value the property
1487 * would have if allowed all properties to change as a result of
1488 * :visited selectors (except for cases where getComputedStyle uses
1489 * data from the frame).
1491 * This is easier to implement than adding our property restrictions
1492 * to this API, and is sufficient for the present testing
1493 * requirements (which are essentially testing 'color').
1495 AString getVisitedDependentComputedStyle
(in Element aElement
,
1496 in AString aPseudoElement
,
1497 in AString aPropertyName
);
1500 * Put the window into a state where scripts are frozen and events
1501 * suppressed, for use when the window has launched a modal prompt.
1503 void enterModalState
();
1506 * Resume normal window state, where scripts can run and events are
1509 void leaveModalState
();
1512 * Is the window is in a modal state? [See enterModalState()]
1514 boolean isInModalState
();
1517 * Suspend/resume timeouts on this window and its descendant windows.
1519 void suspendTimeouts
();
1520 void resumeTimeouts
();
1523 * What type of layer manager the widget associated with this window is
1524 * using. "Basic" is unaccelerated; other types are accelerated. Throws an
1525 * error if there is no widget associated with this window.
1527 readonly attribute AString layerManagerType
;
1530 * True if the layer manager for the widget associated with this window is
1531 * forwarding layers to a remote compositor, false otherwise. Throws an
1532 * error if there is no widget associated with this window.
1534 readonly attribute
boolean layerManagerRemote
;
1537 * True if webrender was requested by the user (via pref or env-var), false
1538 * otherwise. Note that this doesn't represent whether or not webrender is
1539 * *actually* enabled, just whether or not it was requested.
1541 readonly attribute
boolean isWebRenderRequested
;
1544 * Returns the current audio backend as a free-form string.
1546 readonly attribute AString currentAudioBackend
;
1549 * Returns the max channel counts of the current audio device.
1551 readonly attribute
unsigned long currentMaxAudioChannels
;
1554 * Returns the mean round trip latency in seconds for the default input and
1555 * output device, and the stddev of this latency, as a two element array when
1556 * the Promise succeeds.
1558 Promise defaultDevicesRoundTripLatency
();
1561 * Returns the preferred sample rate of the current audio device.
1563 readonly attribute
unsigned long currentPreferredSampleRate
;
1566 * Returns all the audio input/output devices.
1568 const unsigned short AUDIO_INPUT
= 0;
1569 const unsigned short AUDIO_OUTPUT
= 1;
1570 nsIArray audioDevices
(in unsigned short aSide
);
1573 * Record (and return) frame-intervals for frames which were presented
1574 * between calling StartFrameTimeRecording and StopFrameTimeRecording.
1576 * - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late
1577 * (elements were overwritten since Start), result is considered invalid and hence empty.
1578 * - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent).
1579 * Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize.
1580 * - Note: the first frame-interval may be longer than expected because last frame
1581 * might have been presented some time before calling StartFrameTimeRecording.
1585 * Returns a handle which represents current recording start position.
1587 void startFrameTimeRecording
([retval] out unsigned long startIndex
);
1590 * Returns array of frame intervals since the time when the given startIndex
1591 * was handed out from startFrameTimeRecording.
1593 Array
<float> stopFrameTimeRecording
(in unsigned long startIndex
);
1596 * The DPI of the display
1598 readonly attribute
float displayDPI
;
1601 * advanceTimeAndRefresh allows the caller to take over the refresh
1602 * driver timing for a window. A call to advanceTimeAndRefresh does
1604 * (1) It marks the refresh driver for this presentation so that it
1605 * no longer refreshes on its own, but is instead driven entirely
1606 * by the caller (except for the refresh that happens when a
1607 * document comes out of the bfcache).
1608 * (2) It advances the refresh driver's current refresh time by the
1609 * argument given. Negative advances are permitted.
1610 * (3) It does a refresh (i.e., notifies refresh observers) at that
1613 * Note that this affects other connected docshells of the same type
1614 * in the same docshell tree, such as parent frames.
1616 * When callers have completed their use of advanceTimeAndRefresh,
1617 * they must call restoreNormalRefresh.
1619 void advanceTimeAndRefresh
(in long long aMilliseconds
);
1622 * Undoes the effects of advanceTimeAndRefresh.
1624 void restoreNormalRefresh
();
1627 * Reports whether the current state is test-controlled refreshes
1628 * (see advanceTimeAndRefresh and restoreNormalRefresh above).
1630 readonly attribute bool isTestControllingRefreshes
;
1633 * Reports whether APZ is enabled on the widget that this window is attached
1634 * to. If there is no widget it will report the default platform value of
1635 * whether or not APZ is enabled.
1637 readonly attribute bool asyncPanZoomEnabled
;
1640 * Set async scroll offset on an element. The next composite will render
1641 * with that offset if async scrolling is enabled, and then the offset
1642 * will be removed. Only call this while test-controlled refreshes is enabled.
1644 void setAsyncScrollOffset
(in Element aElement
, in float aX
, in float aY
);
1647 * Set async zoom value. aRootElement should be the document element of our
1648 * document. The next composite will render with that zoom added to any
1649 * existing zoom if async scrolling is enabled, and then the zoom will be
1650 * removed. Only call this while test-controlled refreshes is enabled.
1652 void setAsyncZoom
(in Element aRootElement
, in float aValue
);
1655 * Do a round-trip to the compositor to ensure any pending APZ repaint requests
1656 * get flushed to the main thread. If the function returns true, the flush was
1657 * triggered and an "apz-repaints-flushed" notification will be dispatched via
1658 * the observer service once the flush is complete. If the function returns
1659 * false, an error occurred or a flush is not needed, and the notification
1660 * will not fire. This is intended to be used by test code only!
1662 bool flushApzRepaints
();
1665 * Sets a flag on the element to forcibly disable APZ on it. This affects
1666 * the result of nsLayoutUtils::ShouldDisableApzForElement when called on
1667 * this element. This function also schedules a repaint to ensure that the
1668 * change takes effect. Note that this is not reversible; it is intended for
1669 * use by test code only.
1671 void disableApzForElement
(in Element aElement
);
1674 * Ask APZ to pan and zoom to the focused input element.
1676 [can_run_script
] void zoomToFocusedInput
();
1679 * Method for testing StyleAnimationValue::ComputeDistance.
1681 * Returns the distance between the two values as reported by
1682 * StyleAnimationValue::ComputeDistance for the given element and
1685 double computeAnimationDistance
(in Element element
,
1686 in AString property
,
1691 * Returns the computed style for the specified property of given pseudo type
1692 * on the given element after removing styles from declarative animations.
1693 * @param aElement - A target element
1694 * @param aPseudoElement - A pseudo type (e.g. '::before' or null)
1695 * @param aProperty - A longhand CSS property (e.g. 'background-color')
1696 * @param aFlushType - FLUSH_NONE if any pending styles should not happen,
1697 * FLUSH_STYLE to flush pending styles.
1699 AString getUnanimatedComputedStyle
(in Element aElement
,
1700 in AString aPseudoElement
,
1701 in AString aProperty
,
1702 in long aFlushType
);
1705 * Returns the effective canvas background color for the window.
1707 readonly attribute AString canvasBackgroundColor
;
1710 * Get the type of the currently focused html input, if any.
1712 readonly attribute AString focusedInputType
;
1715 * Get the action hint of the currently focused html input, if any.
1717 readonly attribute AString focusedActionHint
;
1720 * Get the inputmode of the currently focused editing host, if any.
1722 readonly attribute AString focusedInputMode
;
1725 * Get the autocapitalize of the currently focused editing host, if any.
1727 readonly attribute AString focusedAutocapitalize
;
1730 * Find the view ID for a given element. This is the reverse of
1731 * findElementWithViewId().
1733 nsViewID getViewId
(in Element aElement
);
1736 * Check if any PaintedLayer painting has been done for this element,
1737 * clears the painted flags if they have.
1739 boolean checkAndClearPaintedState
(in Element aElement
);
1742 * Check if any display list building has been done for this element,
1743 * clears the display list flags if they have.
1745 boolean checkAndClearDisplayListState
(in Element aElement
);
1748 * Check whether all display items of the primary frame of aElement have been
1749 * assigned to the same single PaintedLayer in the last paint. If that is the
1750 * case, returns whether that PaintedLayer is opaque; if it's not the case, an
1751 * exception is thrown.
1753 boolean isPartOfOpaqueLayer
(in Element aElement
);
1756 * Count the number of different PaintedLayers that the supplied elements have
1757 * been assigned to in the last paint. Throws an exception if any of the
1758 * elements doesn't have a primary frame, or if that frame's display items are
1759 * assigned to any other layers than just a single PaintedLayer per element.
1761 unsigned long numberOfAssignedPaintedLayers
(in Array
<Element
> aElements
);
1764 * Get internal id of the stored blob, file or file handle.
1766 [implicit_jscontext
] long long getFileId
(in jsval aFile
);
1769 * Get internal file path of the stored file or file handle.
1771 * TODO: File handle objects are actually not supported at the moment.
1773 [implicit_jscontext
] AString getFilePath
(in jsval aFile
);
1776 * Get file ref count info for given database and file id.
1778 boolean getFileReferences
(in AString aDatabaseName
, in long long aId
,
1779 [optional] out long aRefCnt
,
1780 [optional] out long aDBRefCnt
);
1782 void flushPendingFileDeletions
();
1785 * Begin opcode-level profiling of all JavaScript execution in the window's
1788 [implicit_jscontext
]
1789 void startPCCountProfiling
();
1792 * Stop opcode-level profiling of JavaScript execution in the runtime, and
1793 * collect all counts for use by getPCCount methods.
1795 [implicit_jscontext
]
1796 void stopPCCountProfiling
();
1799 * Purge collected PC counters.
1801 [implicit_jscontext
]
1802 void purgePCCounts
();
1805 * Get the number of scripts with opcode-level profiling information.
1807 [implicit_jscontext
]
1808 long getPCCountScriptCount
();
1811 * Get a JSON string for a short summary of a script and the PC counts
1812 * accumulated for it.
1814 [implicit_jscontext
]
1815 AString getPCCountScriptSummary
(in long script
);
1818 * Get a JSON string with full information about a profiled script,
1819 * including the decompilation of the script and placement of decompiled
1820 * operations within it, and PC counts for each operation.
1822 [implicit_jscontext
]
1823 AString getPCCountScriptContents
(in long script
);
1826 * Returns true if painting is suppressed for this window and false
1829 readonly attribute
boolean paintingSuppressed
;
1832 * Set the viewport size for the purposes of clamping scroll positions for
1833 * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels.
1835 * The caller of this method must have chrome privileges.
1837 void setVisualViewportSize
(in float aWidth
, in float aHeight
);
1840 * These are used to control whether dialogs (alert, prompt, confirm) are
1841 * allowed, and to reset the inernal state that controls whether dialogs
1842 * are currently blocked or not.
1844 void disableDialogs
();
1845 void enableDialogs
();
1846 bool areDialogsEnabled
();
1847 void resetDialogAbuseState
();
1849 const unsigned long AGENT_SHEET
= 0;
1850 const unsigned long USER_SHEET
= 1;
1851 const unsigned long AUTHOR_SHEET
= 2;
1853 * Synchronously loads a style sheet from |sheetURI| and adds it to the list
1854 * of additional style sheets of the document.
1856 * These additional style sheets are very much like user/agent sheets loaded
1857 * with loadAndRegisterSheet. The only difference is that they are applied only
1858 * on the document owned by this window.
1860 * Sheets added via this API take effect immediately on the document.
1862 void loadSheet
(in nsIURI sheetURI
, in unsigned long type
);
1865 * Same as the above method but allows passing the URI as a string.
1867 void loadSheetUsingURIString
(in ACString sheetURI
, in unsigned long type
);
1870 * Adds a style sheet to the list of additional style sheets of the document.
1872 * Style sheets can be preloaded with nsIStyleSheetService.preloadSheet.
1874 * Sheets added via this API take effect immediately on the document.
1876 void addSheet
(in nsIPreloadedStyleSheet sheet
, in unsigned long type
);
1879 * Remove the document style sheet at |sheetURI| from the list of additional
1880 * style sheets of the document. The removal takes effect immediately.
1882 void removeSheet
(in nsIURI sheetURI
, in unsigned long type
);
1885 * Same as the above method but allows passing the URI as a string.
1887 void removeSheetUsingURIString
(in ACString sheetURI
, in unsigned long type
);
1890 * Returns true if a user input is being handled.
1892 * This calls EventStateManager::IsHandlingUserInput().
1894 readonly attribute
boolean isHandlingUserInput
;
1897 * Returns milliseconds elapsed since last user input was started.
1898 * Returns -1 if there wasn't any previous user input.
1900 * This relies on EventStateManager::LatestUserInputStart()
1902 readonly attribute
double millisSinceLastUserInput
;
1905 * After calling the method, the window for which this DOMWindowUtils
1906 * was created can be closed using scripts.
1908 void allowScriptsToClose
();
1911 * Is the parent window's main widget visible? If it isn't, we probably
1912 * don't want to display any dialogs etc it may request. This corresponds
1913 * to the visibility check in nsWindowWatcher::OpenWindowInternal().
1915 * Will throw a DOM security error if called without chrome privileges or
1916 * NS_ERROR_NOT_AVAILABLE in the unlikely event that the parent window's
1917 * main widget can't be reached.
1919 readonly attribute
boolean isParentWindowMainWidgetVisible
;
1922 * In certain cases the event handling of nodes, form controls in practice,
1923 * may be disabled. Such cases are for example the existence of disabled
1924 * attribute or -moz-user-input: none.
1926 boolean isNodeDisabledForEvents
(in Node aNode
);
1929 * Returns the value of a given property animated on the compositor thread.
1930 * If the property is NOT currently being animated on the compositor thread,
1931 * returns an empty string.
1932 * NOTE: Do not use this function for elements that there was another
1933 * animation running on the compositor before.
1935 AString getOMTAStyle
(in Element aElement
, in AString aProperty
,
1936 [optional] in AString aPseudoElement
);
1939 * If aHandlingInput is true, this informs the event state manager that
1940 * we're handling user input, and provides transient user activation.
1941 * Otherwise, this is a no-op (as by default we're not handling user input).
1942 * Remember to call destruct() on the return value!
1943 * See also nsIDOMWindowUtils::isHandlingUserInput.
1945 nsIJSRAIIHelper setHandlingUserInput
(in boolean aHandlingInput
);
1948 * Returns true if a keyboard event qualifies as "user activity" such that
1949 * it would mark the document with the ChromeOnly userHasInteracted
1952 bool isKeyboardEventUserActivity
(in Event aKeyboardEvent
);
1955 * Get the content- and compositor-side APZ test data instances.
1956 * The return values are of type APZTestData (see APZTestData.webidl).
1958 [implicit_jscontext
] jsval getContentAPZTestData
();
1959 [implicit_jscontext
] jsval getCompositorAPZTestData
();
1962 * Posts an RestyleHint::RESTYLE_SELF restyle event for the given element.
1964 void postRestyleSelfEvent
(in Element aElement
);
1967 * This method doesn't do anything useful. It was solely added for the
1968 * purpose of the test for bug 503926.
1970 void xpconnectArgument
(in nsISupports aObj
);
1973 * Helper for JS components that need to send permission requests with
1974 * e10s support properly.
1976 void askPermission
(in nsIContentPermissionRequest aRequest
);
1979 * Restyle generation for the current document.
1981 * May throw NS_ERROR_NOT_AVAILABLE.
1983 readonly attribute
unsigned long long restyleGeneration
;
1986 * Number of frames constructed (excluding breaking) for the curent
1989 * May throw NS_ERROR_NOT_AVAILABLE.
1991 readonly attribute
unsigned long long framesConstructed
;
1994 * Number of frames reflowed for the curent document.
1996 * May throw NS_ERROR_NOT_AVAILABLE.
1998 readonly attribute
unsigned long long framesReflowed
;
2001 * Number of restyles triggered by animations.
2003 readonly attribute
unsigned long long animationTriggeredRestyles
;
2006 * Indicates whether the current frame's refresh driver has a pending tick,
2007 * as reported by nsRefreshDriver::HasPendingTick.
2009 * May throw NS_ERROR_NOT_AVAILABLE.
2011 readonly attribute bool refreshDriverHasPendingTick
;
2014 * Controls the amount of chrome that should be visible on each side of
2015 * the window. Works like the chromemargin xul:window attribute.
2016 * This should only be used with non-XUL windows.
2018 void setChromeMargin
(in int32_t aTop
,
2024 * Controls the amount of space on each edge of the window that can be
2025 * dragged to resize the window in that direction.
2027 * @param aResizeMargin In CSS pixels, will apply to all four window sides.
2029 void setResizeMargin
(in int32_t aResizeMargin
);
2032 * Returns a JSObject which contains a list of frame uniformities
2033 * when the pref gfx.vsync.collect-scroll-data is enabled.
2034 * Every result contains a layer address and a frame uniformity for that layer.
2035 * A negative frame uniformity value indicates an invalid frame uniformity and an error has occured.
2037 [implicit_jscontext
] jsval getFrameUniformityTestData
();
2040 * Increase the chaos mode activation level. An equivalent number of
2041 * calls to leaveChaosMode must be made in order to restore the original
2042 * chaos mode state. If the activation level is nonzero all chaos mode
2043 * features are activated.
2045 void enterChaosMode
();
2048 * Decrease the chaos mode activation level. See enterChaosMode().
2050 void leaveChaosMode
();
2053 * Alerts Gecko of a device reset
2055 void triggerDeviceReset
();
2058 * Returns whether the document's style set's rule processor for the
2059 * specified level of the cascade is shared by multiple style sets.
2060 * (Used by tests to ensure that certain optimizations do not regress.)
2062 * @param aSheetType One of the nsIStyleSheetService.*_SHEET constants.
2064 bool hasRuleProcessorUsedByMultipleStyleSets
(in unsigned long aSheetType
);
2067 * Enable or disable displayport suppression. This is intended to be used by
2068 * testing code, to provide more deterministic behaviour over the displayport
2069 * suppression during tests. Note that this updates a flag, so whatever value
2070 * was last provided is what will be used.
2072 void respectDisplayPortSuppression
(in boolean aEnabled
);
2075 * Set a flag that forces the next reflow interrupt check to return true. This
2076 * can be used by tests to force execution of the interrupted reflow codepaths.
2078 void forceReflowInterrupt
();
2081 * Terminate the GPU process. Used for testing GPU process restarts.
2083 void terminateGPUProcess
();
2086 * Returns the GPU process pid, or -1 if there is no GPU process.
2088 readonly attribute int32_t gpuProcessPid
;
2091 * Adds an ElementState bit to the element.
2093 * The state string must be one of the following:
2094 * * (none yet; but for example "higlighted" for ElementState::HIGHLIGHTED)
2096 * The supported state strings are defined in kManuallyManagedStates
2097 * in nsDOMWindowUtils.cpp.
2099 void addManuallyManagedState
(in Element element
,
2103 * Removes the specified ElementState bits from the element.
2105 * See above for the strings that can be passed for |state|.
2107 void removeManuallyManagedState
(in Element element
,
2111 * Returns usage data for a given storage object.
2114 * The storage object to get usage data for.
2116 int64_t getStorageUsage
(in Storage aStorage
);
2119 * Returns the directionality of a string using the first-strong character
2120 * algorithm defined in http://unicode.org/reports/tr9/#P2.
2122 * @param aString the string to retrieve the direction for.
2123 * @return one of DIRECTION_LTR, DIRECTION_RTL or DIRECTION_NOT_SET depending
2124 * on the first-strong character found in the string.
2126 long getDirectionFromText
(in AString aString
);
2129 * Calls FrameNeedsReflow on that root frame so that a layout flush
2130 * will be necessary.
2132 * This should only be used for testing.
2134 void ensureDirtyRootFrame
();
2137 * Capture the contents of the current WebRender frame and
2138 * save them to a folder relative to the current working directory.
2143 * Flag bits for use in |wrStartCaptureSequence|'s |aFlags| argument.
2145 const uint32_t WR_CAPTURE_SCENE
= 0x1;
2146 const uint32_t WR_CAPTURE_FRAME
= 0x2;
2147 const uint32_t WR_CAPTURE_TILE_CACHE
= 0x4;
2148 const uint32_t WR_CAPTURE_EXTERNAL_RESOURCES
= 0x8;
2151 * Start capturing each WebRender frame to disk.
2153 * |aPath| is the name of a new directory to be created to hold the captures.
2154 * it is relative to:
2155 * - the |PUBLIC_STORAGE| environment variable, if set, else
2156 * - the |MOZ_UPLOAD_DIR| environment variable, if set, else
2157 * - the user's home directory, if known, else
2158 * the current directory.
2160 * If there is already a directory with the given name, a numeric suffix is
2161 * added to ensure a fresh directory is created. This means that you can't
2162 * be sure your capture directory is actually named |aPath|.
2164 * |aFlags| is a set of flags from |webrender::render_api::CaptureBits|.
2166 * If there is already a sequence capture in progress, stop it and start a new
2167 * one, with the new path and flags.
2169 void wrStartCaptureSequence
(in ACString aPath
, in uint32_t aFlags
);
2172 * Stop a capture begun with |wrStartCaptureSequence|.
2174 void wrStopCaptureSequence
();
2177 * Toggle recording of composition on and off.
2179 * This is equivalent to calling |startCompositionRecorder()| or
2180 * |stopCompositionRecorder(true)|.
2182 Promise setCompositionRecording
(in boolean aValue
);
2185 * Start the composition recorder.
2187 * @return A promise that is resolved to true if the composion recorder was
2188 * started successfully.
2190 Promise startCompositionRecording
();
2193 * Stop the composition recorder.
2195 * @param aWriteToDisk Whether or not the frames should be written to disk.
2196 * If false, they will be returned in the promise.
2197 * @return A promise that resolves when the frames have been collected.
2198 * When |aWriteToDisk| is true, the promise will resolve to |undefined|.
2199 * Otherwise, the promise will resolve to a |DOMCollectedFrames| dictionary,
2200 * which contains the timestamps and contents of the captured frames.
2202 Promise stopCompositionRecording
(in boolean aWriteToDisk
);
2205 * Returns whether the document we're associated to has recorded a given CSS
2206 * property via the use counter mechanism.
2208 * Throws if there's no document or the property is invalid.
2210 bool isCssPropertyRecordedInUseCounter
(in ACString aProperty
);
2213 * Calls SetInitialViewport on the MobileViewportManager, which effectively
2214 * causes it to refresh all of its internal state and update things that
2217 void resetMobileViewportManager
();
2219 bool isCoepCredentialless
();
2222 * Change the DPI setting for the primary monitor.
2223 * This setHiDPIMode and restoreHiDPIMode below are only available on debug
2224 * builds since these APIs are supposed to be used in tests.
2226 * Note that on Mac, this API doesn't change the system DPI setting, rather it
2227 * changes our internal state of DPI settings, thus it will not invoke the
2228 * exact same stuff when the system DPI setting is changed.
2231 void setHiDPIMode
(in boolean aHiDPI
);
2233 * Restore the modified HiDPI mode.
2235 void restoreHiDPIMode
();
2238 * NOTE: Currently works only on GTK+.
2240 attribute ACString systemFont
;
2243 * Returns the number of times this document for this window has
2244 * been painted to the screen.
2246 readonly attribute
unsigned long long paintCount
;
2248 // These consts are only for testing purposes.
2249 const long DEFAULT_MOUSE_POINTER_ID
= 0;
2250 const long DEFAULT_PEN_POINTER_ID
= 1;
2251 const long DEFAULT_TOUCH_POINTER_ID
= 2;
2253 // Match mozilla::MouseButton.
2254 const long MOUSE_BUTTON_LEFT_BUTTON
= 0;
2255 const long MOUSE_BUTTON_MIDDLE_BUTTON
= 1;
2256 const long MOUSE_BUTTON_RIGHT_BUTTON
= 2;
2258 // Match mozilla::MouseButtonsFlag.
2259 const long MOUSE_BUTTONS_NO_BUTTON
= 0x00;
2260 const long MOUSE_BUTTONS_LEFT_BUTTON
= 0x01;
2261 const long MOUSE_BUTTONS_RIGHT_BUTTON
= 0x02;
2262 const long MOUSE_BUTTONS_MIDDLE_BUTTON
= 0x04;
2263 // Typically, "back" button being left side of 5-button
2264 // mice, see "buttons" attribute document of DOM3 Events.
2265 const long MOUSE_BUTTONS_4TH_BUTTON
= 0x08;
2266 // Typically, "forward" button being right side of 5-button
2267 // mice, see "buttons" attribute document of DOM3 Events.
2268 const long MOUSE_BUTTONS_5TH_BUTTON
= 0x10;
2269 // Buttons are not specified, will be calculated from |aButton|.
2270 const long MOUSE_BUTTONS_NOT_SPECIFIED
= -1;
2272 // Return values for getDirectionFromText().
2273 const long DIRECTION_LTR
= 0;
2274 const long DIRECTION_RTL
= 1;
2275 const long DIRECTION_NOT_SET
= 2;
2277 void syncFlushCompositor
();
2279 unsigned long long getLayersId
();
2281 // Returns true if we are effectively throttling frame requests.
2282 readonly attribute bool effectivelyThrottlesFrameRequests
;
2284 // Returns the ID for the underlying window widget, which can
2285 // be compared against the rawId from a nsIMediaDevice to determine
2286 // if the window is being shared.
2288 // Using this only makes sense in the parent process, and the function
2289 // will intentionally crash any non-parent process that tries to access
2291 readonly attribute AString webrtcRawDeviceId
;
2293 // Used for testing to check the suspend status.
2294 readonly attribute bool suspendedByBrowsingContextGroup
;
2296 // Whether there's any scroll-linked effect in this document. This is only
2297 // meaningful after the script in question tried to mutate something in a
2298 // scroll event callback until the next refresh driver tick happens.
2300 // See https://firefox-source-docs.mozilla.org/performance/scroll-linked_effects.html
2301 // about scroll-linked effects.
2302 readonly attribute bool hasScrollLinkedEffect
;
2304 // Returns the current orientation lock value in browsing context.
2305 // This value is defined in hal/HalScreenConfiguration.h
2306 readonly attribute uint32_t orientationLock
;
2308 // Returns an element currently scrolling by wheel.
2309 Element getWheelScrollTarget
();
2312 [scriptable
, uuid(c694e359
-7227-4392-a138
-33c0cc1f15a6
)]
2313 interface nsITranslationNodeList
: nsISupports
{
2314 readonly attribute
unsigned long length
;
2315 Node item
(in unsigned long index
);
2317 // A translation root is a block element, or an inline element
2318 // which its parent is not a translation node.
2319 boolean isTranslationRootAtIndex
(in unsigned long index
);
2323 * JS doesn't do RAII very well. We can use this interface to make remembering
2324 * to destruct an object in a finally clause easier.
2326 [scriptable
, uuid(52e5a996
-d0a9
-4efc
-a6fa
-24489c532b19
)]
2327 interface nsIJSRAIIHelper
: nsISupports
{