2004-06-19 23:04:38 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Mozilla.org
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2004
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
/**
|
2005-10-21 22:30:36 +00:00
|
|
|
* nsIDOMWindowUtils is intended for infrequently-used methods related
|
|
|
|
* to the current nsIDOMWindow. Some of the methods may require
|
|
|
|
* elevated privileges; the method implementations should contain the
|
|
|
|
* necessary security checks. Access this interface by calling
|
|
|
|
* getInterface on a DOMWindow.
|
2004-06-19 23:04:38 +00:00
|
|
|
*/
|
|
|
|
|
2007-07-12 22:57:17 +00:00
|
|
|
interface nsIDOMElement;
|
2008-12-03 01:34:07 +00:00
|
|
|
interface nsIDOMHTMLCanvasElement;
|
2007-07-12 22:57:17 +00:00
|
|
|
|
2009-05-05 06:15:23 +00:00
|
|
|
[scriptable, uuid(a5e155c8-ef18-4e70-881b-d2fe8aa13fec)]
|
2004-06-19 23:04:38 +00:00
|
|
|
interface nsIDOMWindowUtils : nsISupports {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
* @note 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.
|
|
|
|
* @note Only images immediately in this window are affected;
|
|
|
|
* this is not recursive to subwindows.
|
|
|
|
* @see imgIContainer
|
|
|
|
*/
|
2004-11-18 20:50:16 +00:00
|
|
|
attribute unsigned short imageAnimationMode;
|
|
|
|
|
2007-08-11 18:37:16 +00:00
|
|
|
/**
|
|
|
|
* Whether the charset of the window's current document has been forced by
|
2007-10-10 21:03:12 +00:00
|
|
|
* the user.
|
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
2007-08-11 18:37:16 +00:00
|
|
|
*/
|
|
|
|
readonly attribute boolean docCharsetIsForced;
|
|
|
|
|
2004-11-18 20:50:16 +00:00
|
|
|
/**
|
|
|
|
* Function to get metadata associated with the window's current document
|
|
|
|
* @param aName the name of the metadata. This should be all lowercase.
|
|
|
|
* @return the value of the metadata, or the empty string if it's not set
|
2005-10-21 22:30:36 +00:00
|
|
|
*
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
2004-11-18 20:50:16 +00:00
|
|
|
*/
|
|
|
|
AString getDocumentMetadata(in AString aName);
|
2005-10-21 22:30:36 +00:00
|
|
|
|
|
|
|
/**
|
2008-06-04 00:00:37 +00:00
|
|
|
* 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.
|
2005-10-21 22:30:36 +00:00
|
|
|
*/
|
2008-06-04 00:00:37 +00:00
|
|
|
unsigned long redraw([optional] in unsigned long aCount);
|
2007-02-26 21:14:19 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*
|
2007-10-10 21:03:12 +00:00
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
|
|
|
*
|
2007-02-26 21:14:19 +00:00
|
|
|
* @param aType event type
|
2008-11-26 21:52:42 +00:00
|
|
|
* @param aX x offset in CSS pixels
|
|
|
|
* @param aY y offset in CSS pixels
|
2007-02-26 21:14:19 +00:00
|
|
|
* @param aButton button to synthesize
|
|
|
|
* @param aClickCount number of clicks that have been performed
|
|
|
|
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
|
2008-11-28 19:53:33 +00:00
|
|
|
* @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
|
2008-10-27 20:16:23 +00:00
|
|
|
* during dispatch
|
2007-02-26 21:14:19 +00:00
|
|
|
*/
|
|
|
|
void sendMouseEvent(in AString aType,
|
2008-11-26 21:52:42 +00:00
|
|
|
in float aX,
|
|
|
|
in float aY,
|
2007-02-26 21:14:19 +00:00
|
|
|
in long aButton,
|
|
|
|
in long aClickCount,
|
2008-10-27 20:16:23 +00:00
|
|
|
in long aModifiers,
|
2008-11-28 19:53:33 +00:00
|
|
|
[optional] in boolean aIgnoreRootScrollFrame);
|
2007-02-26 21:14:19 +00:00
|
|
|
|
2008-08-13 03:08:59 +00:00
|
|
|
/** Synthesize a mouse scroll event for a window. The event types supported
|
|
|
|
* are:
|
|
|
|
* DOMMouseScroll
|
2008-09-17 11:27:19 +00:00
|
|
|
* MozMousePixelScroll
|
2008-08-13 03:08:59 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param aType event type
|
2008-11-26 21:52:42 +00:00
|
|
|
* @param aX x offset in CSS pixels
|
|
|
|
* @param aY y offset in CSS pixels
|
2008-08-13 03:08:59 +00:00
|
|
|
* @param aButton button to synthesize
|
|
|
|
* @param aScrollFlags flag bits --- see nsMouseScrollFlags in nsGUIEvent.h
|
|
|
|
* @param aDelta the direction and amount to scroll (in lines or pixels,
|
2008-09-17 11:27:19 +00:00
|
|
|
* depending on the event type)
|
2008-08-13 03:08:59 +00:00
|
|
|
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
|
|
|
|
*/
|
|
|
|
void sendMouseScrollEvent(in AString aType,
|
2008-11-26 21:52:42 +00:00
|
|
|
in float aX,
|
|
|
|
in float aY,
|
2008-08-13 03:08:59 +00:00
|
|
|
in long aButton,
|
|
|
|
in long aScrollFlags,
|
|
|
|
in long aDelta,
|
|
|
|
in long aModifiers);
|
|
|
|
|
2007-02-26 21:14:19 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2007-10-10 21:03:12 +00:00
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
|
|
|
*
|
2007-02-26 21:14:19 +00:00
|
|
|
* @param aType event type
|
|
|
|
* @param aKeyCode key code
|
|
|
|
* @param aCharCode character code
|
|
|
|
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
|
2008-08-25 18:31:38 +00:00
|
|
|
* @param aPreventDefault if true, preventDefault() the event before dispatch
|
|
|
|
*
|
|
|
|
* @return false if the event had preventDefault() called on it,
|
|
|
|
* true otherwise. In other words, true if and only if the
|
|
|
|
* default action was taken.
|
2007-02-26 21:14:19 +00:00
|
|
|
*/
|
2008-08-25 18:31:38 +00:00
|
|
|
boolean sendKeyEvent(in AString aType,
|
|
|
|
in long aKeyCode,
|
|
|
|
in long aCharCode,
|
|
|
|
in long aModifiers,
|
|
|
|
[optional] in boolean aPreventDefault);
|
2007-07-12 22:57:17 +00:00
|
|
|
|
2008-05-05 23:01:07 +00:00
|
|
|
/**
|
|
|
|
* See nsIWidget::SynthesizeNativeKeyEvent
|
|
|
|
*
|
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
|
|
|
*/
|
|
|
|
void sendNativeKeyEvent(in long aNativeKeyboardLayout,
|
|
|
|
in long aNativeKeyCode,
|
|
|
|
in long aModifierFlags,
|
|
|
|
in AString aCharacters,
|
|
|
|
in AString aUnmodifiedCharacters);
|
|
|
|
|
2008-06-28 07:55:30 +00:00
|
|
|
/**
|
|
|
|
* See nsIWidget::ActivateNativeMenuItemAt
|
|
|
|
*
|
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
|
|
|
*/
|
|
|
|
void activateNativeMenuItemAt(in AString indexString);
|
|
|
|
|
2008-07-28 04:46:33 +00:00
|
|
|
/**
|
2008-10-30 05:36:01 +00:00
|
|
|
* See nsIWidget::ForceUpdateNativeMenuAt
|
2008-07-28 04:46:33 +00:00
|
|
|
*
|
2008-10-30 05:36:01 +00:00
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
2008-07-28 04:46:33 +00:00
|
|
|
*/
|
2008-10-30 05:36:01 +00:00
|
|
|
void forceUpdateNativeMenuAt(in AString indexString);
|
2008-07-28 04:46:33 +00:00
|
|
|
|
2007-07-12 22:57:17 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2007-10-10 21:03:12 +00:00
|
|
|
* Cannot be accessed from unprivileged context (not content-accessible)
|
|
|
|
* Will throw a DOM security error if called without UniversalXPConnect
|
|
|
|
* privileges.
|
|
|
|
*
|
2007-07-12 22:57:17 +00:00
|
|
|
* @param aElement the element to focus
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 18:00:39 +00:00
|
|
|
*
|
|
|
|
* Do not use this method. Just use element.focus if available or
|
|
|
|
* nsIFocusManager::SetFocus instead.
|
|
|
|
*
|
2007-07-12 22:57:17 +00:00
|
|
|
*/
|
|
|
|
void focus(in nsIDOMElement aElement);
|
2007-10-19 21:36:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
void garbageCollect();
|
2008-08-27 21:24:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Force processing of any queued paints
|
|
|
|
*/
|
|
|
|
|
|
|
|
void processUpdates();
|
2008-10-23 20:15:20 +00:00
|
|
|
|
|
|
|
/** Synthesize a simple gesture event for a window. The event types
|
|
|
|
* supported are: MozSwipeGesture, MozMagnifyGestureStart,
|
2009-04-02 19:34:31 +00:00
|
|
|
* MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart,
|
|
|
|
* MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, and
|
|
|
|
* MozTapGesture.
|
2008-10-23 20:15:20 +00:00
|
|
|
*
|
|
|
|
* Cannot be accessed from unprivileged context (not
|
|
|
|
* content-accessible) Will throw a DOM security error if called
|
|
|
|
* without UniversalXPConnect privileges.
|
|
|
|
*
|
|
|
|
* @param aType event type
|
2009-01-03 12:40:26 +00:00
|
|
|
* @param aX x offset in CSS pixels
|
|
|
|
* @param aY y offset in CSS pixels
|
2008-10-23 20:15:20 +00:00
|
|
|
* @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
|
|
|
|
* @param aDelta amount of magnification or rotation for magnify and rotation events
|
|
|
|
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
|
|
|
|
*/
|
|
|
|
void sendSimpleGestureEvent(in AString aType,
|
2009-01-03 12:40:26 +00:00
|
|
|
in float aX,
|
|
|
|
in float aY,
|
2008-10-23 20:15:20 +00:00
|
|
|
in unsigned long aDirection,
|
|
|
|
in double aDelta,
|
|
|
|
in long aModifiers);
|
2008-11-05 03:58:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the element at point aX, aY in the window's document.
|
|
|
|
*
|
|
|
|
* @param 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.
|
|
|
|
* @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
|
|
|
|
*/
|
|
|
|
nsIDOMElement elementFromPoint(in long aX,
|
|
|
|
in long aY,
|
|
|
|
in boolean aIgnoreRootScrollFrame,
|
|
|
|
in boolean aFlushLayout);
|
2008-12-03 01:34:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
PRUint32 compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1,
|
|
|
|
in nsIDOMHTMLCanvasElement aCanvas2,
|
|
|
|
out unsigned long aMaxDifference);
|
2009-01-06 01:15:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if a MozAfterPaint event has been queued but not yet
|
|
|
|
* fired.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean isMozAfterPaintPending;
|
2009-02-12 10:44:38 +00:00
|
|
|
|
2009-03-03 20:11:14 +00:00
|
|
|
/**
|
|
|
|
* Suppresses/unsuppresses user initiated event handling in window's document
|
|
|
|
* and subdocuments.
|
|
|
|
*
|
|
|
|
* @throw NS_ERROR_DOM_SECURITY_ERR if called without UniversalXPConnect
|
|
|
|
* privileges and NS_ERROR_FAILURE if window doesn't have a document.
|
|
|
|
*/
|
|
|
|
void suppressEventHandling(in boolean aSuppress);
|
|
|
|
|
2009-02-27 00:21:55 +00:00
|
|
|
void clearMozAfterPaintEvents();
|
|
|
|
|
2009-02-12 10:44:38 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param aDisable If true, disable all non synthetic test mouse events
|
|
|
|
* on all windows. Otherwise, enable them.
|
|
|
|
*/
|
|
|
|
void disableNonTestMouseEvents(in boolean aDisable);
|
2009-03-30 12:19:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the scroll position of the window's currently loaded document.
|
|
|
|
*
|
|
|
|
* @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
|
|
|
|
* @see nsIDOMWindow::scrollX/Y
|
|
|
|
*/
|
|
|
|
void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
|
2009-05-05 06:15:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get IME open state. TRUE means 'Open', otherwise, 'Close'.
|
|
|
|
* This property works only when IMEEnabled is IME_STATUS_ENABLED.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean IMEIsOpen;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 IME_STATUS_DISABLED = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ENABLED means users can use all functions of IME. This state is same as
|
|
|
|
* |ime-mode: normal;|.
|
|
|
|
*/
|
|
|
|
const unsigned long IME_STATUS_ENABLED = 1;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 IME_STATUS_PASSWORD = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PLUGIN means a plug-in has focus. At this time we should not touch to
|
|
|
|
* controlling the IME state.
|
|
|
|
*/
|
|
|
|
const unsigned long IME_STATUS_PLUGIN = 3;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get IME status, see above IME_STATUS_* definitions.
|
|
|
|
*/
|
|
|
|
readonly attribute unsigned long IMEStatus;
|
2004-06-19 23:04:38 +00:00
|
|
|
};
|