Public Member Functions | Public Attributes

nsIDOMWindowUtils Interface Reference

import "nsIDOMWindowUtils.idl";

List of all members.

Public Member Functions

AString getDocumentMetadata (in AString aName)
 Function to get metadata associated with the window's current document.
unsigned long redraw ([optional] in unsigned long aCount)
 Force an immediate redraw of this window.
void sendMouseEvent (in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifiers,[optional] in boolean aIgnoreRootScrollFrame)
 Synthesize a mouse event for a window.
void sendMouseScrollEvent (in AString aType, in float aX, in float aY, in long aButton, in long aScrollFlags, in long aDelta, in long aModifiers)
 Synthesize a mouse scroll event for a window.
boolean sendKeyEvent (in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers,[optional] in boolean aPreventDefault)
 Synthesize a key event to the window.
void sendNativeKeyEvent (in long aNativeKeyboardLayout, in long aNativeKeyCode, in long aModifierFlags, in AString aCharacters, in AString aUnmodifiedCharacters)
 See nsIWidget::SynthesizeNativeKeyEvent.
void sendNativeMouseEvent (in long aScreenX, in long aScreenY, in long aNativeMessage, in long aModifierFlags, in nsIDOMElement aElement)
 See nsIWidget::SynthesizeNativeMouseEvent.
void activateNativeMenuItemAt (in AString indexString)
 See nsIWidget::ActivateNativeMenuItemAt.
void forceUpdateNativeMenuAt (in AString indexString)
 See nsIWidget::ForceUpdateNativeMenuAt.
void focus (in nsIDOMElement aElement)
 Focus the element aElement.
void garbageCollect ()
 Force a garbage collection.
void processUpdates ()
 Force processing of any queued paints.
void sendSimpleGestureEvent (in AString aType, in float aX, in float aY, in unsigned long aDirection, in double aDelta, in long aModifiers)
 Synthesize a simple gesture event for a window.
nsIDOMElement elementFromPoint (in long aX, in long aY, in boolean aIgnoreRootScrollFrame, in boolean aFlushLayout)
 Retrieve the element at point aX, aY in the window's document.
PRUint32 compareCanvases (in nsIDOMHTMLCanvasElement aCanvas1, in nsIDOMHTMLCanvasElement aCanvas2, out unsigned long aMaxDifference)
 Compare the two canvases, returning the number of differing pixels and the maximum difference in a channel.
void suppressEventHandling (in boolean aSuppress)
 Suppresses/unsuppresses user initiated event handling in window's document and subdocuments.
void clearMozAfterPaintEvents ()
void disableNonTestMouseEvents (in boolean aDisable)
 Disable or enable non synthetic test mouse events on *all* windows.
void getScrollXY (in boolean aFlushLayout, out long aScrollX, out long aScrollY)
 Returns the scroll position of the window's currently loaded document.
void getCOWForObject ()
 Creates a ChromeObjectWrapper for the object and returns it.
boolean dispatchDOMEventViaPresShell (in nsIDOMNode aTarget, in nsIDOMEvent aEvent, in boolean aTrusted)
 Dispatches aEvent via the nsIPresShell object of the window's document.
string getClassName ()
 Returns the real classname (possibly of the mostly-transparent security wrapper) of aObj.
void sendContentCommandEvent (in AString aType,[optional] in nsITransferable aTransferable)
 Generate a content command event.

Public Attributes

attribute unsigned short imageAnimationMode
 Image animation mode of the window.
readonly attribute boolean docCharsetIsForced
 Whether the charset of the window's current document has been forced by the user.
readonly attribute boolean isMozAfterPaintPending
 Returns true if a MozAfterPaint event has been queued but not yet fired.
readonly attribute boolean IMEIsOpen
 Get IME open state.
const unsigned long IME_STATUS_DISABLED = 0
 WARNING: These values must be same as nsIWidget's values.
const unsigned long IME_STATUS_ENABLED = 1
 ENABLED means users can use all functions of IME.
const unsigned long IME_STATUS_PASSWORD = 2
 PASSWORD means users cannot use most functions of IME.
const unsigned long IME_STATUS_PLUGIN = 3
 PLUGIN means a plug-in has focus.
readonly attribute unsigned long IMEStatus
 Get IME status, see above IME_STATUS_* definitions.
readonly attribute float screenPixelsPerCSSPixel
 Get the number of screen pixels per CSS pixel.

Member Function Documentation

void nsIDOMWindowUtils::activateNativeMenuItemAt ( in AString  indexString  ) 

See nsIWidget::ActivateNativeMenuItemAt.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

void nsIDOMWindowUtils::clearMozAfterPaintEvents (  ) 
PRUint32 nsIDOMWindowUtils::compareCanvases ( in nsIDOMHTMLCanvasElement  aCanvas1,
in nsIDOMHTMLCanvasElement  aCanvas2,
out unsigned long  aMaxDifference 
)

Compare the two canvases, returning the number of differing pixels and the maximum difference in a channel.

This will throw an error if the dimensions of the two canvases are different.

This method requires UniversalXPConnect privileges.

void nsIDOMWindowUtils::disableNonTestMouseEvents ( in boolean  aDisable  ) 

Disable or enable non synthetic test mouse events on *all* windows.

Cannot be accessed from unprivileged context (not content-accessible). Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aDisable If true, disable all non synthetic test mouse events on all windows. Otherwise, enable them.
boolean nsIDOMWindowUtils::dispatchDOMEventViaPresShell ( in nsIDOMNode  aTarget,
in nsIDOMEvent  aEvent,
in boolean  aTrusted 
)

Dispatches aEvent via the nsIPresShell object of the window's document.

The event is dispatched to aTarget, which should be an object which implements nsIContent interface (element, text, etc).

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Note:
Event handlers won't get aEvent as parameter, but a similar event. Also, aEvent should not be reused.
nsIDOMElement nsIDOMWindowUtils::elementFromPoint ( in long  aX,
in long  aY,
in boolean  aIgnoreRootScrollFrame,
in boolean  aFlushLayout 
)

Retrieve the element at point aX, aY in the window's document.

Parameters:
aIgnoreRootScrollFrame whether or not to ignore the root scroll frame when retrieving the element. If false, this method returns null for coordinates outside of the viewport.
aFlushLayout flushes layout if true. Otherwise, no flush occurs.
void nsIDOMWindowUtils::focus ( in nsIDOMElement  aElement  ) 

Focus the element aElement.

The element should be in the same document that the window is displaying. Pass null to blur the element, if any, that currently has focus, and focus the document.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aElement the element to focus

Do not use this method. Just use element.focus if available or nsIFocusManager::SetFocus instead.

void nsIDOMWindowUtils::forceUpdateNativeMenuAt ( in AString  indexString  ) 

See nsIWidget::ForceUpdateNativeMenuAt.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

void nsIDOMWindowUtils::garbageCollect (  ) 

Force a garbage collection.

This will run the cycle-collector twice to make sure all garbage is collected.

Will throw a DOM security error if called without UniversalXPConnect privileges in non-debug builds. Available to all callers in debug builds.

string nsIDOMWindowUtils::getClassName (  ) 

Returns the real classname (possibly of the mostly-transparent security wrapper) of aObj.

void nsIDOMWindowUtils::getCOWForObject (  ) 

Creates a ChromeObjectWrapper for the object and returns it.

Parameters:
scope The JavaScript object whose scope we'll use as the parent of the wrapper.
objToWrap The JavaScript object to wrap.
Returns:
the wrapped object.
AString nsIDOMWindowUtils::getDocumentMetadata ( in AString  aName  ) 

Function to get metadata associated with the window's current document.

Parameters:
aName the name of the metadata. This should be all lowercase.
Returns:
the value of the metadata, or the empty string if it's not set

Will throw a DOM security error if called without UniversalXPConnect privileges.

void nsIDOMWindowUtils::getScrollXY ( in boolean  aFlushLayout,
out long  aScrollX,
out long  aScrollY 
)

Returns the scroll position of the window's currently loaded document.

Parameters:
aFlushLayout flushes layout if true. Otherwise, no flush occurs.
See also:
nsIDOMWindow::scrollX/Y
void nsIDOMWindowUtils::processUpdates (  ) 

Force processing of any queued paints.

unsigned long nsIDOMWindowUtils::redraw ( [optional] in unsigned long  aCount  ) 

Force an immediate redraw of this window.

The parameter specifies the number of times to redraw, and the return value is the length, in milliseconds, that the redraws took. If aCount is not specified or is 0, it is taken to be 1.

void nsIDOMWindowUtils::sendContentCommandEvent ( in AString  aType,
[optional] in nsITransferable  aTransferable 
)

Generate a content command event.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aType Type of command content event to send. Can be one of "cut", "copy", "paste", "delete", "undo", "redo", or "pasteTransferable".
aTransferable an instance of nsITransferable when aType is "pasteTransferable"
boolean nsIDOMWindowUtils::sendKeyEvent ( in AString  aType,
in long  aKeyCode,
in long  aCharCode,
in long  aModifiers,
[optional] in boolean  aPreventDefault 
)

Synthesize a key event to the window.

The event types supported are: keydown, keyup, keypress

Key events generally end up being sent to the focused node.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aType event type
aKeyCode key code
aCharCode character code
aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
aPreventDefault if true, preventDefault() the event before dispatch
Returns:
false if the event had preventDefault() called on it, true otherwise. In other words, true if and only if the default action was taken.
void nsIDOMWindowUtils::sendMouseEvent ( in AString  aType,
in float  aX,
in float  aY,
in long  aButton,
in long  aClickCount,
in long  aModifiers,
[optional] in boolean  aIgnoreRootScrollFrame 
)

Synthesize a mouse event for a window.

The event types supported are: mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu

Events are sent in coordinates offset by aX and aY from the window.

Note that additional events may be fired as a result of this call. For instance, typically a click event will be fired as a result of a mousedown and mouseup in sequence.

Normally at this level of events, the mouseover and mouseout events are only fired when the window is entered or exited. For inter-element mouseover and mouseout events, a movemove event fired on the new element should be sufficient to generate the correct over and out events as well.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aType event type
aX x offset in CSS pixels
aY y offset in CSS pixels
aButton button to synthesize
aClickCount number of clicks that have been performed
aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
aIgnoreRootScrollFrame whether the event should ignore viewport bounds during dispatch
void nsIDOMWindowUtils::sendMouseScrollEvent ( in AString  aType,
in float  aX,
in float  aY,
in long  aButton,
in long  aScrollFlags,
in long  aDelta,
in long  aModifiers 
)

Synthesize a mouse scroll event for a window.

The event types supported are: DOMMouseScroll MozMousePixelScroll

Events are sent in coordinates offset by aX and aY from the window.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aType event type
aX x offset in CSS pixels
aY y offset in CSS pixels
aButton button to synthesize
aScrollFlags flag bits --- see nsMouseScrollFlags in nsGUIEvent.h
aDelta the direction and amount to scroll (in lines or pixels, depending on the event type)
aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
void nsIDOMWindowUtils::sendNativeKeyEvent ( in long  aNativeKeyboardLayout,
in long  aNativeKeyCode,
in long  aModifierFlags,
in AString  aCharacters,
in AString  aUnmodifiedCharacters 
)

See nsIWidget::SynthesizeNativeKeyEvent.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

void nsIDOMWindowUtils::sendNativeMouseEvent ( in long  aScreenX,
in long  aScreenY,
in long  aNativeMessage,
in long  aModifierFlags,
in nsIDOMElement  aElement 
)

See nsIWidget::SynthesizeNativeMouseEvent.

Will be called on the widget that contains aElement. Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

void nsIDOMWindowUtils::sendSimpleGestureEvent ( in AString  aType,
in float  aX,
in float  aY,
in unsigned long  aDirection,
in double  aDelta,
in long  aModifiers 
)

Synthesize a simple gesture event for a window.

The event types supported are: MozSwipeGesture, MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart, MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, and MozTapGesture.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Parameters:
aType event type
aX x offset in CSS pixels
aY y offset in CSS pixels
aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
aDelta amount of magnification or rotation for magnify and rotation events
aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
void nsIDOMWindowUtils::suppressEventHandling ( in boolean  aSuppress  ) 

Suppresses/unsuppresses user initiated event handling in window's document and subdocuments.

Exceptions:
NS_ERROR_DOM_SECURITY_ERR if called without UniversalXPConnect privileges and NS_ERROR_FAILURE if window doesn't have a document.

Member Data Documentation

Whether the charset of the window's current document has been forced by the user.

Cannot be accessed from unprivileged context (not content-accessible)

attribute unsigned short nsIDOMWindowUtils::imageAnimationMode

Image animation mode of the window.

When this attribute's value is changed, the implementation should set all images in the window to the given value. That is, when set to kDontAnimMode, all images will stop animating. The attribute's value must be one of the animationMode values from imgIContainer.

Note:
Images may individually override the window's setting after the window's mode is set. Therefore images given different modes since the last setting of the window's mode may behave out of line with the window's overall mode.
The attribute's value is the window's overall mode. It may for example continue to report kDontAnimMode after all images have subsequently been individually animated.
Only images immediately in this window are affected; this is not recursive to subwindows.
See also:
imgIContainer
const unsigned long nsIDOMWindowUtils::IME_STATUS_DISABLED = 0

WARNING: These values must be same as nsIWidget's values.

DISABLED means users cannot use IME completely. Note that this state is *not* same as |ime-mode: disabled;|.

const unsigned long nsIDOMWindowUtils::IME_STATUS_ENABLED = 1

ENABLED means users can use all functions of IME.

This state is same as |ime-mode: normal;|.

const unsigned long nsIDOMWindowUtils::IME_STATUS_PASSWORD = 2

PASSWORD means users cannot use most functions of IME.

But on GTK2, users can use "Simple IM" which only supports dead key inputting. The behavior is same as the behavior of the native password field. This state is same as |ime-mode: disabled;|.

const unsigned long nsIDOMWindowUtils::IME_STATUS_PLUGIN = 3

PLUGIN means a plug-in has focus.

At this time we should not touch to controlling the IME state.

Get IME open state.

TRUE means 'Open', otherwise, 'Close'. This property works only when IMEEnabled is IME_STATUS_ENABLED.

readonly attribute unsigned long nsIDOMWindowUtils::IMEStatus

Get IME status, see above IME_STATUS_* definitions.

Returns true if a MozAfterPaint event has been queued but not yet fired.

Get the number of screen pixels per CSS pixel.


The documentation for this interface was generated from the following file: