diff options
Diffstat (limited to 'dom/interfaces')
227 files changed, 13074 insertions, 0 deletions
diff --git a/dom/interfaces/apps/moz.build b/dom/interfaces/apps/moz.build new file mode 100644 index 000000000..ca6c08821 --- /dev/null +++ b/dom/interfaces/apps/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'mozIApplication.idl', + 'mozIApplicationClearPrivateDataParams.idl', + 'nsIAppsService.idl', +] + +XPIDL_MODULE = 'dom_apps' + diff --git a/dom/interfaces/apps/mozIApplication.idl b/dom/interfaces/apps/mozIApplication.idl new file mode 100644 index 000000000..7aa2b8d29 --- /dev/null +++ b/dom/interfaces/apps/mozIApplication.idl @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=8 et : + */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIPrincipal; + +/** + * We expose Gecko-internal helpers related to "web apps" through this + * sub-interface. + */ +[scriptable, uuid(e76aa5e0-80b2-404f-bccc-1067828bb6ed)] +interface mozIApplication: nsISupports +{ + /* Return true if this app has |permission|. */ + boolean hasPermission(in string permission); + + /* Application status as defined in nsIPrincipal. */ + readonly attribute unsigned short appStatus; + + /* Returns the uuid of the app. */ + readonly attribute DOMString id; + + /* Returns the origin of the app. */ + readonly attribute DOMString origin; + + /* Returns the manifest url of the app. */ + readonly attribute DOMString manifestURL; + + /* Returns the local id of the app. */ + readonly attribute unsigned long localId; + + /* Returns the base directory for the app */ + readonly attribute DOMString basePath; + + /* Name copied from the manifest */ + readonly attribute DOMString name; + + /* CSP copied from the manifest */ + readonly attribute DOMString csp; + + /* Store ID if the app is installed from a store */ + readonly attribute DOMString storeID; + + /* Store version if the app is installed from a store */ + readonly attribute unsigned long storeVersion; + + /* role copied from the manifest */ + readonly attribute DOMString role; + + /* Returns the kind of the app. */ + readonly attribute DOMString kind; + + /* Returns the app's principal */ + readonly attribute nsIPrincipal principal; +}; diff --git a/dom/interfaces/apps/mozIApplicationClearPrivateDataParams.idl b/dom/interfaces/apps/mozIApplicationClearPrivateDataParams.idl new file mode 100644 index 000000000..c08deac10 --- /dev/null +++ b/dom/interfaces/apps/mozIApplicationClearPrivateDataParams.idl @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=8 et : + */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(ba0e6c8e-8c03-4b9b-8f9b-4fb14216f56e)] +interface mozIApplicationClearPrivateDataParams : nsISupports +{ + readonly attribute unsigned long appId; + readonly attribute boolean browserOnly; +}; + +%{C++ +#define TOPIC_WEB_APP_CLEAR_DATA "webapps-clear-data" +#define TOPIC_CLEAR_ORIGIN_DATA "clear-origin-attributes-data" +%} diff --git a/dom/interfaces/apps/nsIAppsService.idl b/dom/interfaces/apps/nsIAppsService.idl new file mode 100644 index 000000000..4e91a50ec --- /dev/null +++ b/dom/interfaces/apps/nsIAppsService.idl @@ -0,0 +1,75 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface mozIApplication; +interface nsIURI; + +%{C++ +#define APPS_SERVICE_CID { 0x05072afa, 0x92fe, 0x45bf, { 0xae, 0x22, 0x39, 0xb6, 0x9c, 0x11, 0x70, 0x58 } } +#define APPS_SERVICE_CONTRACTID "@mozilla.org/AppsService;1" +%} + +/* + * This service allows accessing some DOMApplicationRegistry methods from + * non-javascript code. + */ +[scriptable, uuid(711cfab6-7b72-4aa2-a60c-17952ea05661)] +interface nsIAppsService : nsISupports +{ + mozIApplication getAppByManifestURL(in DOMString manifestURL); + + /** + * Returns a Promise for the manifest for a given manifestURL. + * This is only supported in the parent process: the promise will be rejected + * in content processes. + */ + jsval getManifestFor(in DOMString manifestURL); + + /** + * Returns the |localId| of the app associated with the |manifestURL| passed + * in parameter. + * Returns nsIScriptSecurityManager::NO_APP_ID if |manifestURL| isn't a valid + * installed manifest URL. + */ + unsigned long getAppLocalIdByManifestURL(in DOMString manifestURL); + + /** + * Returns the application associated to this localId. + */ + mozIApplication getAppByLocalId(in unsigned long localId); + + /** + * Returns the manifest URL associated to this localId. + */ + DOMString getManifestURLByLocalId(in unsigned long localId); + + /** + * Returns the basepath for core apps + */ + DOMString getCoreAppsBasePath(); + + /** + * Returns the basepath for regular packaged apps + */ + DOMString getWebAppsBasePath(); + + /** + * Returns true if at least one app is in the registry. + */ + boolean areAnyAppsInstalled(); + + jsval getAppInfo(in DOMString appId); + + /** + * Returns the localId if the app was installed from a store + */ + DOMString getAppLocalIdByStoreId(in DOMString storeID); + + /** + * Returns the scope for app to use with service workers. + */ + DOMString getScopeByLocalId(in unsigned long localId); +}; diff --git a/dom/interfaces/base/domstubs.idl b/dom/interfaces/base/domstubs.idl new file mode 100644 index 000000000..4422b791e --- /dev/null +++ b/dom/interfaces/base/domstubs.idl @@ -0,0 +1,81 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +%{C++ +class nsWrapperCache; +%} + +[ptr] native nsWrapperCachePtr(nsWrapperCache); + +typedef unsigned long long DOMTimeStamp; +typedef double DOMHighResTimeStamp; + +// Core +interface nsIDOMAttr; +interface nsIDOMCDATASection; +interface nsIDOMCharacterData; +interface nsIDOMComment; +interface nsIDOMDOMImplementation; +interface nsIDOMDocument; +interface nsIDOMDocumentFragment; +interface nsIDOMDocumentType; +interface nsIDOMElement; +interface nsIDOMNode; +interface nsIDOMNodeList; +interface nsIDOMProcessingInstruction; +interface nsIDOMText; +interface nsIDOMClientRect; +interface nsIDOMClientRectList; + +// Needed for raises() in our IDL +interface DOMException; + +// Style Sheets +interface nsIDOMStyleSheetList; +interface nsIDOMStyleSheet; +interface nsIDOMMediaList; + +// Base +interface nsIDOMWindow; +interface nsIDOMWindowCollection; +interface nsIDOMNavigator; +interface nsIDOMScreen; + +// Events +interface nsIDOMEvent; +interface nsIDOMEventTarget; +interface nsIDOMEventListener; + +// HTML +interface nsIDOMHTMLElement; +interface nsIDOMHTMLFormElement; +interface nsIDOMHTMLCollection; +interface nsIDOMHTMLHeadElement; + +// CSS +interface nsIDOMCSSValue; +interface nsIDOMCSSPrimitiveValue; +interface nsIDOMCSSRule; +interface nsIDOMCSSRuleList; +interface nsIDOMCSSKeyframeRule; +interface nsIDOMCSSFontFeatureValuesRule; +interface nsIDOMCSSStyleSheet; +interface nsIDOMCSSStyleDeclaration; +interface nsIDOMCounter; +interface nsIDOMRect; +interface nsIDOMCSSStyleRule; +interface nsIDOMCSSStyleRuleCollection; + +// Range +interface nsIDOMRange; + +// Crypto +interface nsIDOMCrypto; + +// Used font face (for inspector) +interface nsIDOMFontFace; +interface nsIDOMFontFaceList; diff --git a/dom/interfaces/base/moz.build b/dom/interfaces/base/moz.build new file mode 100644 index 000000000..e96fc0158 --- /dev/null +++ b/dom/interfaces/base/moz.build @@ -0,0 +1,42 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'domstubs.idl', + 'nsIBrowser.idl', + 'nsIBrowserDOMWindow.idl', + 'nsIContentPermissionPrompt.idl', + 'nsIContentPrefService.idl', + 'nsIContentPrefService2.idl', + 'nsIContentURIGrouper.idl', + 'nsIDOMChromeWindow.idl', + 'nsIDOMClientRect.idl', + 'nsIDOMClientRectList.idl', + 'nsIDOMConstructor.idl', + 'nsIDOMCrypto.idl', + 'nsIDOMGlobalPropertyInitializer.idl', + 'nsIDOMHistory.idl', + 'nsIDOMLocation.idl', + 'nsIDOMModalContentWindow.idl', + 'nsIDOMNavigator.idl', + 'nsIDOMScreen.idl', + 'nsIDOMWindow.idl', + 'nsIDOMWindowCollection.idl', + 'nsIDOMWindowUtils.idl', + 'nsIFocusManager.idl', + 'nsIIdleObserver.idl', + 'nsIQueryContentEventResult.idl', + 'nsIRemoteBrowser.idl', + 'nsIServiceWorkerManager.idl', + 'nsIStructuredCloneContainer.idl', + 'nsITabChild.idl', + 'nsITabParent.idl', + 'nsITextInputProcessor.idl', + 'nsITextInputProcessorCallback.idl', +] + +XPIDL_MODULE = 'dom_base' + diff --git a/dom/interfaces/base/nsIBrowser.idl b/dom/interfaces/base/nsIBrowser.idl new file mode 100644 index 000000000..44ae9b0a2 --- /dev/null +++ b/dom/interfaces/base/nsIBrowser.idl @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "nsISupports.idl" + +interface nsIDOMElement; + +[scriptable, uuid(14e5a0cb-e223-4202-95e8-fe53275193ea)] +interface nsIBrowser : nsISupports +{ + /** + * Gets a related browser for a given browser (if any). If this exists, then + * we should attempt to use the same content parent as its frameLoader + * for any new tab parents. + */ + readonly attribute nsIDOMElement relatedBrowser; + + /* + * Called by the child to inform the parent that links are dropped into + * content area. + * + * @param linksCount length of links + * @param links a flat array of url, name, and type for each link + */ + void dropLinks(in unsigned long linksCount, + [array, size_is(linksCount)] in wstring links); + + /** + * Swapping of frameloaders are usually initiated from a frameloader owner + * or other components operating on frameloader owners. This is done by calling + * swapFrameLoaders at MozFrameLoaderOwner webidl interface. + * + * This function aimed to provide the other way around - + * if the swapping is initiated from frameloader itself or other platform level + * components, it uses this interface to delegate the swapping request to + * frameloader owners and ask them to re-initiate frameloader swapping, so that + * frameloader owners such as <xul:browser> can setup their properties and / + * or listeners properly on swapping. + */ + void swapBrowsers(in nsIBrowser aOtherBrowser); + + /** + * Close the browser (usually means to remove a tab). + */ + void closeBrowser(); +}; diff --git a/dom/interfaces/base/nsIBrowserDOMWindow.idl b/dom/interfaces/base/nsIBrowserDOMWindow.idl new file mode 100644 index 000000000..bc64bf783 --- /dev/null +++ b/dom/interfaces/base/nsIBrowserDOMWindow.idl @@ -0,0 +1,129 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface mozIDOMWindowProxy; +interface nsIDOMWindow; +interface nsIURI; +interface nsIFrameLoaderOwner; + +[scriptable, uuid(e774db14-79ac-4156-a7a3-aa3fd0a22c10)] +interface nsIOpenURIInFrameParams : nsISupports +{ + attribute DOMString referrer; + attribute boolean isPrivate; + + [implicit_jscontext] + readonly attribute jsval openerOriginAttributes; +}; + +[scriptable, uuid(9d17f3dd-672b-451e-afd2-b1115df780d5)] + +/** + * The C++ source has access to the browser script source through + * nsIBrowserDOMWindow. It is intended to be attached to the chrome DOMWindow + * of a toplevel browser window (a XUL window). A DOMWindow that does not + * happen to be a browser chrome window will simply have no access to any such + * interface. + */ +interface nsIBrowserDOMWindow : nsISupports +{ + /** + * Values for openURI's aWhere parameter. + */ + /** + * Do whatever the default is based on application state, user preferences, + * and the value of the aContext parameter to openURI. + */ + const short OPEN_DEFAULTWINDOW = 0; + /** + * Open in the "current window". If aOpener is provided, this should be the + * top window in aOpener's window hierarchy, but exact behavior is + * application-dependent. If aOpener is not provided, it's up to the + * application to decide what constitutes a "current window". + */ + const short OPEN_CURRENTWINDOW = 1; + /** + * Open in a new window. + */ + const short OPEN_NEWWINDOW = 2; + /** + * Open in a new content tab in the toplevel browser window corresponding to + * this nsIBrowserDOMWindow. + */ + const short OPEN_NEWTAB = 3; + /** + * Open in an existing content tab based on the URI. If a match can't be + * found, revert to OPEN_NEWTAB behavior. + */ + const short OPEN_SWITCHTAB = 4; + + /** + * Values for openURI's aFlags parameter. This is a bitflags field. + * + * The 0x1 bit decides the behavior of OPEN_DEFAULTWINDOW, and the 0x4 bit + * controls whether or not to set the window.opener property on the newly + * opened window. + * + * NOTE: The 0x2 bit is ignored for backwards compatibility with addons, as + * OPEN_NEW used to have the value 2. The values 0 and 2 are treated + * the same way internally. + */ + /** + * internal open new window + */ + const long OPEN_NEW = 0x0; + /** + * external link (load request from another application, xremote, etc). + */ + const long OPEN_EXTERNAL = 0x1; + + /** + * Don't set the window.opener property on the window which is being opened + */ + const long OPEN_NO_OPENER = 0x4; + + /** + * Load a URI + + * @param aURI the URI to open. null is allowed. If null is passed in, no + * load will be done, though the window the load would have + * happened in will be returned. + * @param aWhere see possible values described above. + * @param aOpener window requesting the open (can be null). + * @param aFlags flags which control the behavior of the load. The + * OPEN_EXTERNAL/OPEN_NEW flag is only used when + * aWhere == OPEN_DEFAULTWINDOW. + * @return the window into which the URI was opened. + */ + mozIDOMWindowProxy + openURI(in nsIURI aURI, in mozIDOMWindowProxy aOpener, + in short aWhere, in long aFlags); + + /** + * As above, but return the nsIFrameLoaderOwner for the new window. + // XXXbz is this the right API? + // See bug 537428 + */ + nsIFrameLoaderOwner openURIInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params, + in short aWhere, in long aFlags); + + /** + * @param aWindow the window to test. + * @return whether the window is the main content window for any + * currently open tab in this toplevel browser window. + */ + boolean isTabContentWindow(in nsIDOMWindow aWindow); + + /** + * This function is responsible for calling + * nsIContentViewer::PermitUnload on each frame in the window. It + * returns true if closing the window is allowed. See canClose() in + * BrowserUtils.jsm for a simple implementation of this method. + */ + boolean canClose(); +}; + diff --git a/dom/interfaces/base/nsIContentPermissionPrompt.idl b/dom/interfaces/base/nsIContentPermissionPrompt.idl new file mode 100644 index 000000000..8a593e37e --- /dev/null +++ b/dom/interfaces/base/nsIContentPermissionPrompt.idl @@ -0,0 +1,119 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIPrincipal; +interface mozIDOMWindow; +interface nsIDOMElement; +interface nsIArray; + +/** + * Interface provides the request type and its access. + */ +[scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)] +interface nsIContentPermissionType : nsISupports { + /** + * The type of the permission request, such as + * "geolocation". + */ + readonly attribute ACString type; + + /** + * The access of the permission request, such as + * "read". + */ + readonly attribute ACString access; + + /** + * The array of available options. + */ + readonly attribute nsIArray options; // ["choice1", "choice2"] +}; + +/** + * Interface provides the callback type. + */ +[scriptable, uuid(5fb5bb60-7069-11e4-9803-0800200c9a66)] +interface nsIContentPermissionRequestCallback : nsISupports { + /** + * The callback of the visibility result. + */ + void notifyVisibility(in boolean isVisible); +}; + +/** + * Interface provides the way to get the visibility and + * the notification. + */ +[scriptable, uuid(f8577124-6a5f-486f-ae04-c5bcae911eb5)] +interface nsIContentPermissionRequester : nsISupports { + /** + * The function to get the visibility. + */ + void getVisibility(in nsIContentPermissionRequestCallback callback); + + /** + * The callback to get the notification of visibility change. + */ + attribute nsIContentPermissionRequestCallback onVisibilityChange; +}; + +/** + * Interface allows access to a content to request + * permission to perform a privileged operation such as + * geolocation. + */ +[scriptable, uuid(875733da-0ac0-4a26-8c76-70a30876be46)] +interface nsIContentPermissionRequest : nsISupports { + /** + * The array will include the request types. Elements of this array are + * nsIContentPermissionType object. + */ + readonly attribute nsIArray types; + + /* + * The principal of the permission request. + */ + readonly attribute nsIPrincipal principal; + + /** + * The window or element that the permission request was + * originated in. Typically the element will be non-null + * in when using out of process content. window or + * element can be null but not both. + */ + readonly attribute mozIDOMWindow window; + readonly attribute nsIDOMElement element; + + /** + * The requester to get the required information of + * the window. + */ + readonly attribute nsIContentPermissionRequester requester; + + /** + * allow or cancel the request + */ + + void cancel(); + void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"} +}; + +/** + * Interface provides a way for the application to handle + * the UI prompts associated with geo position. + */ +[scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)] +interface nsIContentPermissionPrompt : nsISupports { + /** + * Called when a request has been made to access + * privileged content apis + */ + void prompt(in nsIContentPermissionRequest request); +}; + +%{C++ +#define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID "@mozilla.org/content-permission/prompt;1" +%} diff --git a/dom/interfaces/base/nsIContentPrefService.idl b/dom/interfaces/base/nsIContentPrefService.idl new file mode 100644 index 000000000..9c3cf3665 --- /dev/null +++ b/dom/interfaces/base/nsIContentPrefService.idl @@ -0,0 +1,263 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIVariant; +interface nsIPropertyBag2; +interface nsIContentURIGrouper; +interface nsILoadContext; +interface mozIStorageConnection; + +[scriptable, uuid(43635c53-b445-4c4e-8cc5-562697299b55)] +interface nsIContentPrefObserver : nsISupports +{ + /** + * Called when a content pref is set to a different value. + * + * @param aGroup the group to which the pref belongs, or null + * if it's a global pref (applies to all sites) + * @param aName the name of the pref that was set + * @param aValue the new value of the pref + * @param aIsPrivate an optional flag determining whether the + * original context is private or not + */ + void onContentPrefSet(in AString aGroup, + in AString aName, + in nsIVariant aValue, + [optional] in boolean aIsPrivate); + + /** + * Called when a content pref is removed. + * + * @param aGroup the group to which the pref belongs, or null + * if it's a global pref (applies to all sites) + * @param aName the name of the pref that was removed + * @param aIsPrivate an optional flag determining whether the + * original context is private or not + */ + void onContentPrefRemoved(in AString aGroup, + in AString aName, + [optional] in boolean aIsPrivate); +}; + +[scriptable, function, uuid(c1b3d6df-5373-4606-8494-8bcf14a7fc62)] +interface nsIContentPrefCallback : nsISupports +{ + void onResult(in nsIVariant aResult); +}; + +/** + * @deprecated Please use nsIContentPrefService2 instead. + */ +[scriptable, uuid(e3f772f3-023f-4b32-b074-36cf0fd5d414)] +interface nsIContentPrefService : nsISupports +{ + /** + * Get a pref. + * + * Besides the regular string, integer, boolean, etc. values, this method + * may return null (nsIDataType::VTYPE_EMPTY), which means the pref is set + * to NULL in the database, as well as undefined (nsIDataType::VTYPE_VOID), + * which means there is no record for this pref in the database. + * + * This method can be called from content processes in electrolysis builds. + * We have a whitelist of values that can be read in such a way. + * + * @param aGroup the group for which to get the pref, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to get the global pref (applies to all sites) + * @param aName the name of the pref to get + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search in memory or in + * permanent storage for it), obtained from a relevant + * window or channel. + * @param aCallback an optional nsIContentPrefCallback to receive the + * result. If desired, JavaScript callers can instead + * provide a function to call upon completion + * + * @returns the value of the pref + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + nsIVariant getPref(in nsIVariant aGroup, in AString aName, + in nsILoadContext aPrivacyContext, + [optional] in nsIContentPrefCallback aCallback); + + /** + * Set a pref. + * + * This method can be called from content processes in electrolysis builds. + * We have a whitelist of values that can be set in such a way. + * + * @param aGroup the group for which to set the pref, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to set the global pref (applies to all sites) + * @param aName the name of the pref to set + * @param aValue the new value of the pref + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to store it in memory or in + * permanent storage), obtained from a relevant + * window or channel. + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + void setPref(in nsIVariant aGroup, in AString aName, in nsIVariant aValue, in nsILoadContext aPrivacyContext); + + /** + * Check whether or not a pref exists. + * + * @param aGroup the group for which to check for the pref, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to check for the global pref (applies to all sites) + * @param aName the name of the pref to check for + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search in memory or in + * permanent storage for it), obtained from a relevant + * window or channel. + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + boolean hasPref(in nsIVariant aGroup, in AString aName, in nsILoadContext aContext); + + /** + * Check whether or not the value of a pref (or its non-existance) is cached. + * + * @param aGroup the group for which to check for the pref, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to check for the global pref (applies to all sites) + * @param aName the name of the pref to check for + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search in memory or in + * permanent storage for it), obtained from a relevant + * window or channel. + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + boolean hasCachedPref(in nsIVariant aGroup, in AString aName, in nsILoadContext aContext); + + /** + * Remove a pref. + * + * @param aGroup the group for which to remove the pref, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to remove the global pref (applies to all sites) + * @param aName the name of the pref to remove + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search in memory or in + * permanent storage for it), obtained from a relevant + * window or channel. + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + void removePref(in nsIVariant aGroup, in AString aName, in nsILoadContext aContext); + + /** + * Remove all grouped prefs. Useful for removing references to the sites + * the user has visited when the user clears their private data. + * + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to remove prefs in memory or + * in permanent storage), obtained from a relevant + * window or channel. + */ + void removeGroupedPrefs(in nsILoadContext aContext); + + /** + * Remove all prefs with the given name. + * + * @param aName the setting name for which to remove prefs + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the prefs (ie. whether to remove prefs in memory or + * in permanent storage), obtained from a relevant + * window or channel. + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + void removePrefsByName(in AString aName, in nsILoadContext aContext); + + /** + * Get the prefs that apply to the given site. + * + * @param aGroup the group for which to retrieve prefs, as an nsIURI + * from which the hostname will be used, a string + * (typically in the format of a hostname), or null + * to get the global prefs (apply to all sites) + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search for prefs in memory + * or in permanent storage), obtained from a relevant + * window or channel. + * + * @returns a property bag of prefs + * @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null + */ + nsIPropertyBag2 getPrefs(in nsIVariant aGroup, in nsILoadContext aContext); + + /** + * Get the prefs with the given name. + * + * @param aName the setting name for which to retrieve prefs + * @param aPrivacyContext + * a context from which to determine the privacy status + * of the pref (ie. whether to search for prefs in memory + * or in permanent storage), obtained from a relevant + * window or channel. + * + * @returns a property bag of prefs + * @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string + */ + nsIPropertyBag2 getPrefsByName(in AString aName, in nsILoadContext aContext); + + /** + * Add an observer. + * + * @param aName the setting to observe, or null to add + * a generic observer that observes all settings + * @param aObserver the observer to add + */ + void addObserver(in AString aName, in nsIContentPrefObserver aObserver); + + /** + * Remove an observer. + * + * @param aName the setting being observed, or null to remove + * a generic observer that observes all settings + * @param aObserver the observer to remove + */ + void removeObserver(in AString aName, in nsIContentPrefObserver aObserver); + + /** + * The component that the service uses to determine the groups to which + * URIs belong. By default this is the "hostname grouper", which groups + * URIs by full hostname (a.k.a. site). + */ + readonly attribute nsIContentURIGrouper grouper; + + /** + * The database connection to the content preferences database. + * Useful for accessing and manipulating preferences in ways that are caller- + * specific or for which there is not yet a generic method, although generic + * functionality useful to multiple callers should generally be added to this + * unfrozen interface. Also useful for testing the database creation + * and migration code. + */ + readonly attribute mozIStorageConnection DBConnection; +}; + +%{C++ +// The contractID for the generic implementation built in to xpcom. +#define NS_CONTENT_PREF_SERVICE_CONTRACTID "@mozilla.org/content-pref/service;1" +%} diff --git a/dom/interfaces/base/nsIContentPrefService2.idl b/dom/interfaces/base/nsIContentPrefService2.idl new file mode 100644 index 000000000..4ac1e21d8 --- /dev/null +++ b/dom/interfaces/base/nsIContentPrefService2.idl @@ -0,0 +1,405 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIVariant; +interface nsIContentPrefObserver; +interface nsIContentPrefCallback2; +interface nsILoadContext; +interface nsIContentPref; + +/** + * Content Preferences + * + * Content preferences allow the application to associate arbitrary data, or + * "preferences", with specific domains, or web "content". Specifically, a + * content preference is a structure with three values: a domain with which the + * preference is associated, a name that identifies the preference within its + * domain, and a value. (See nsIContentPref below.) + * + * For example, if you want to remember the user's preference for a certain zoom + * level on www.mozilla.org pages, you might store a preference whose domain is + * "www.mozilla.org", whose name is "zoomLevel", and whose value is the numeric + * zoom level. + * + * A preference need not have a domain, and in that case the preference is + * called a "global" preference. This interface doesn't impart any special + * significance to global preferences; they're simply name-value pairs that + * aren't associated with any particular domain. As a consumer of this + * interface, you might choose to let a global preference override all non- + * global preferences of the same name, for example, for whatever definition of + * "override" is appropriate for your use case. + * + * + * Domain Parameters + * + * Many methods of this interface accept a "domain" parameter. Domains may be + * specified either exactly, like "example.com", or as full URLs, like + * "http://example.com/foo/bar". In the latter case the API extracts the full + * domain from the URL, so if you specify "http://foo.bar.example.com/baz", the + * domain is taken to be "foo.bar.example.com", not "example.com". + * + * + * Private-Browsing Context Parameters + * + * Many methods also accept a "context" parameter. This parameter relates to + * private browsing and determines the kind of storage that a method uses, + * either the usual permanent storage or temporary storage set aside for private + * browsing sessions. + * + * Pass null to unconditionally use permanent storage. Pass an nsILoadContext + * to use storage appropriate to the context's usePrivateBrowsing attribute: if + * usePrivateBrowsing is true, temporary private-browsing storage is used, and + * otherwise permanent storage is used. A context can be obtained from the + * window or channel whose content pertains to the preferences being modified or + * retrieved. + * + * + * Callbacks + * + * The methods of callback objects are always called asynchronously. + * + * Observers are called after callbacks are called, but they are called in the + * same turn of the event loop as callbacks. + * + * See nsIContentPrefCallback2 below for more information about callbacks. + */ + +[scriptable, uuid(bed98666-d995-470f-bebd-62476d318576)] +interface nsIContentPrefService2 : nsISupports +{ + /** + * Gets all the preferences with the given name. + * + * @param name The preferences' name. + * @param context The private-browsing context, if any. + * @param callback handleResult is called once for each preference unless + * no such preferences exist, in which case handleResult + * is not called at all. + */ + void getByName(in AString name, + in nsILoadContext context, + in nsIContentPrefCallback2 callback); + + /** + * Gets the preference with the given domain and name. + * + * @param domain The preference's domain. + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @param callback handleResult is called once unless no such preference + * exists, in which case handleResult is not called at all. + */ + void getByDomainAndName(in AString domain, + in AString name, + in nsILoadContext context, + in nsIContentPrefCallback2 callback); + + /** + * Gets all preferences with the given name whose domains are either the same + * as or subdomains of the given domain. + * + * @param domain The preferences' domain. + * @param name The preferences' name. + * @param context The private-browsing context, if any. + * @param callback handleResult is called once for each preference. If no + * such preferences exist, handleResult is not called at all. + */ + void getBySubdomainAndName(in AString domain, + in AString name, + in nsILoadContext context, + in nsIContentPrefCallback2 callback); + + /** + * Gets the preference with no domain and the given name. + * + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @param callback handleResult is called once unless no such preference + * exists, in which case handleResult is not called at all. + */ + void getGlobal(in AString name, + in nsILoadContext context, + in nsIContentPrefCallback2 callback); + + /** + * Synchronously retrieves from the in-memory cache the preference with the + * given domain and name. + * + * In addition to caching preference values, the cache also keeps track of + * preferences that are known not to exist. If the preference is known not to + * exist, the value attribute of the returned object will be undefined + * (nsIDataType::VTYPE_VOID). + * + * If the preference is neither cached nor known not to exist, then null is + * returned, and get() must be called to determine whether the preference + * exists. + * + * @param domain The preference's domain. + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @return The preference, or null if no such preference is known to + * exist. + */ + nsIContentPref getCachedByDomainAndName(in AString domain, + in AString name, + in nsILoadContext context); + + /** + * Synchronously retrieves from the in-memory cache all preferences with the + * given name whose domains are either the same as or subdomains of the given + * domain. + * + * The preferences are returned in an array through the out-parameter. If a + * preference for a particular subdomain is known not to exist, then an object + * corresponding to that preference will be present in the array, and, as with + * getCachedByDomainAndName, its value attribute will be undefined. + * + * @param domain The preferences' domain. + * @param name The preferences' name. + * @param context The private-browsing context, if any. + * @param len The length of the returned array. + * @param prefs The array of preferences. + */ + void getCachedBySubdomainAndName(in AString domain, + in AString name, + in nsILoadContext context, + [optional] out unsigned long len, + [retval,array,size_is(len)] out nsIContentPref prefs); + + /** + * Synchronously retrieves from the in-memory cache the preference with no + * domain and the given name. + * + * As with getCachedByDomainAndName, if the preference is cached then it is + * returned; if the preference is known not to exist, then the value attribute + * of the returned object will be undefined; if the preference is neither + * cached nor known not to exist, then null is returned. + * + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @return The preference, or null if no such preference is known to + * exist. + */ + nsIContentPref getCachedGlobal(in AString name, + in nsILoadContext context); + + /** + * Sets a preference. + * + * @param domain The preference's domain. + * @param name The preference's name. + * @param value The preference's value. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the preference has been + * stored. + */ + void set(in AString domain, + in AString name, + in nsIVariant value, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Sets a preference with no domain. + * + * @param name The preference's name. + * @param value The preference's value. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the preference has been + * stored. + */ + void setGlobal(in AString name, + in nsIVariant value, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes the preference with the given domain and name. + * + * @param domain The preference's domain. + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeByDomainAndName(in AString domain, + in AString name, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all the preferences with the given name whose domains are either + * the same as or subdomains of the given domain. + * + * @param domain The preferences' domain. + * @param name The preferences' name. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeBySubdomainAndName(in AString domain, + in AString name, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes the preference with no domain and the given name. + * + * @param name The preference's name. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeGlobal(in AString name, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all preferences with the given domain. + * + * @param domain The preferences' domain. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeByDomain(in AString domain, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all preferences whose domains are either the same as or subdomains + * of the given domain. + * + * @param domain The preferences' domain. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeBySubdomain(in AString domain, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all preferences with the given name regardless of domain, including + * global preferences with the given name. + * + * @param name The preferences' name. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeByName(in AString name, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all non-global preferences -- in other words, all preferences that + * have a domain. + * + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeAllDomains(in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all non-global preferences created after and including |since|. + * + * @param since Timestamp in milliseconds. + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeAllDomainsSince(in unsigned long long since, + in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Removes all global preferences -- in other words, all preferences that have + * no domain. + * + * @param context The private-browsing context, if any. + * @param callback handleCompletion is called when the operation completes. + */ + void removeAllGlobals(in nsILoadContext context, + [optional] in nsIContentPrefCallback2 callback); + + /** + * Registers an observer that will be notified whenever a preference with the + * given name is set or removed. + * + * When a set or remove method is called, observers are called after the set + * or removal completes and after the method's callback is called, and they + * are called in the same turn of the event loop as the callback. + * + * The service holds a strong reference to the observer, so the observer must + * be removed later to avoid leaking it. + * + * @param name The name of the preferences to observe. Pass null to + * observe all preference changes regardless of name. + * @param observer The observer. + */ + void addObserverForName(in AString name, + in nsIContentPrefObserver observer); + + /** + * Unregisters an observer for the given name. + * + * @param name The name for which the observer was registered. Pass null + * if the observer was added with a null name. + * @param observer The observer. + */ + void removeObserverForName(in AString name, + in nsIContentPrefObserver observer); + + /** + * Extracts and returns the domain from the given string representation of a + * URI. This is how the API extracts domains from URIs passed to it. + * + * @param str The string representation of a URI, like + * "http://example.com/foo/bar". + * @return If the given string is a valid URI, the domain of that URI is + * returned. Otherwise, the string itself is returned. + */ + AString extractDomain(in AString str); +}; + +/** + * The callback used by the above methods. + */ +[scriptable, uuid(1a12cf41-79e8-4d0f-9899-2f7b27c5d9a1)] +interface nsIContentPrefCallback2 : nsISupports +{ + /** + * For the retrieval methods, this is called once for each retrieved + * preference. It is not called for other methods. + * + * @param pref The retrieved preference. + */ + void handleResult(in nsIContentPref pref); + + /** + * Called when an error occurs. This may be called multiple times before + * handleCompletion is called. + * + * @param error A number in Components.results describing the error. + */ + void handleError(in nsresult error); + + /** + * Called when the method finishes. This will be called exactly once for + * each method invocation, and afterward no other callback methods will be + * called. + * + * @param reason One of the COMPLETE_* values indicating the manner in which + * the method completed. + */ + void handleCompletion(in unsigned short reason); + + const unsigned short COMPLETE_OK = 0; + const unsigned short COMPLETE_ERROR = 1; +}; + +[scriptable, function, uuid(9f24948d-24b5-4b1b-b554-7dbd58c1d792)] +interface nsIContentPref : nsISupports +{ + readonly attribute AString domain; + readonly attribute AString name; + readonly attribute nsIVariant value; +}; diff --git a/dom/interfaces/base/nsIContentURIGrouper.idl b/dom/interfaces/base/nsIContentURIGrouper.idl new file mode 100644 index 000000000..9224450f9 --- /dev/null +++ b/dom/interfaces/base/nsIContentURIGrouper.idl @@ -0,0 +1,23 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIURI.idl" + +[scriptable, uuid(4bb38cb4-c3cb-4d17-9799-1b3132b39723)] +interface nsIContentURIGrouper : nsISupports +{ + /** + * Determine the group to which the URI belongs. + * + * @param aURI the URI to group + * + * @returns the group to which the URI belongs + */ + AString group(in nsIURI aURI); +}; + +%{C++ +// The contractID for the generic implementation built in to xpcom. +#define NS_HOSTNAME_GROUPER_SERVICE_CONTRACTID "@mozilla.org/content-pref/hostname-grouper;1" +%} diff --git a/dom/interfaces/base/nsIDOMChromeWindow.idl b/dom/interfaces/base/nsIDOMChromeWindow.idl new file mode 100644 index 000000000..600aa46eb --- /dev/null +++ b/dom/interfaces/base/nsIDOMChromeWindow.idl @@ -0,0 +1,81 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIBrowserDOMWindow; +interface nsIDOMElement; +interface nsIDOMEvent; +interface nsIMessageBroadcaster; +interface mozIDOMWindowProxy; + +[scriptable, uuid(78bdcb41-1efa-409f-aaba-70842213f80f)] +interface nsIDOMChromeWindow : nsISupports +{ + const unsigned short STATE_MAXIMIZED = 1; + const unsigned short STATE_MINIMIZED = 2; + const unsigned short STATE_NORMAL = 3; + const unsigned short STATE_FULLSCREEN = 4; + + readonly attribute unsigned short windowState; + + /** + * browserDOMWindow provides access to yet another layer of + * utility functions implemented by chrome script. It will be null + * for DOMWindows not corresponding to browsers. + */ + attribute nsIBrowserDOMWindow browserDOMWindow; + + void getAttention(); + + void getAttentionWithCycleCount(in long aCycleCount); + + void setCursor(in DOMString cursor); + + void maximize(); + void minimize(); + void restore(); + + /** + * Notify a default button is loaded on a dialog or a wizard. + * defaultButton is the default button. + */ + void notifyDefaultButtonLoaded(in nsIDOMElement defaultButton); + + readonly attribute nsIMessageBroadcaster messageManager; + + /** + * Returns the message manager identified by the given group name that + * manages all frame loaders belonging to that group. + */ + nsIMessageBroadcaster getGroupMessageManager(in AString group); + + /** + * On some operating systems, we must allow the window manager to + * handle window dragging. This function tells the window manager to + * start dragging the window. This function will fail unless called + * while the left mouse button is held down, callers must check this. + * + * The optional panel argument should be set when moving a panel. + * + * Returns NS_ERROR_NOT_IMPLEMENTED (and thus throws in JS) if the OS + * doesn't support this. + */ + void beginWindowMove(in nsIDOMEvent mouseDownEvent, [optional] in nsIDOMElement panel); + + /** + * These methods provide a way to specify the opener value for the content in + * the window before the content itself is created. This is important in order + * to set the DocGroup of a document, as the opener must be set before the + * document is created. + * + * SetOpenerForInitialContentBrowser is used to set which opener will be used, + * and TakeOpenerForInitialContentBrowser is used by nsXULElement in order to + * take the value set earlier, and null out the value in the + * nsIDOMChromeWindow. + */ + void setOpenerForInitialContentBrowser(in mozIDOMWindowProxy aOpener); + mozIDOMWindowProxy takeOpenerForInitialContentBrowser(); +}; diff --git a/dom/interfaces/base/nsIDOMClientRect.idl b/dom/interfaces/base/nsIDOMClientRect.idl new file mode 100644 index 000000000..905d68661 --- /dev/null +++ b/dom/interfaces/base/nsIDOMClientRect.idl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(B2F824C4-D9D3-499B-8D3B-45C8245497C6)] +interface nsIDOMClientRect : nsISupports +{ + readonly attribute float left; + readonly attribute float top; + readonly attribute float right; + readonly attribute float bottom; + readonly attribute float width; + readonly attribute float height; +}; diff --git a/dom/interfaces/base/nsIDOMClientRectList.idl b/dom/interfaces/base/nsIDOMClientRectList.idl new file mode 100644 index 000000000..2056fe362 --- /dev/null +++ b/dom/interfaces/base/nsIDOMClientRectList.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(f474c567-cbcb-458f-abad-ae42363da287)] +interface nsIDOMClientRectList : nsISupports +{ + readonly attribute unsigned long length; + nsIDOMClientRect item(in unsigned long index); +}; diff --git a/dom/interfaces/base/nsIDOMConstructor.idl b/dom/interfaces/base/nsIDOMConstructor.idl new file mode 100644 index 000000000..1eddf5739 --- /dev/null +++ b/dom/interfaces/base/nsIDOMConstructor.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sw=2 et tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "domstubs.idl" + +[scriptable, uuid(0ccbcf19-d1b4-489e-984c-cd8c43672bb9)] +interface nsIDOMDOMConstructor : nsISupports +{ + AString toString(); +}; + diff --git a/dom/interfaces/base/nsIDOMCrypto.idl b/dom/interfaces/base/nsIDOMCrypto.idl new file mode 100644 index 000000000..3df047934 --- /dev/null +++ b/dom/interfaces/base/nsIDOMCrypto.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIGlobalObject; + +[uuid(48d7f7fd-bb85-4c04-9b8b-5cd9131acdef)] +interface nsIDOMCrypto : nsISupports +{ + [notxpcom] void init(in nsIGlobalObject parent); +}; diff --git a/dom/interfaces/base/nsIDOMGlobalPropertyInitializer.idl b/dom/interfaces/base/nsIDOMGlobalPropertyInitializer.idl new file mode 100644 index 000000000..3c931824d --- /dev/null +++ b/dom/interfaces/base/nsIDOMGlobalPropertyInitializer.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface mozIDOMWindow; + +[scriptable, uuid(5842e275-797f-4afb-b7e0-e29f0cb312ae)] +interface nsIDOMGlobalPropertyInitializer : nsISupports +{ + /* + * Initialize the global property. + * + * @param window the global object on which the property is being retrieved. + * + * @returns a JS Object to use use as the property's value. + */ + jsval init(in mozIDOMWindow window); +}; diff --git a/dom/interfaces/base/nsIDOMHistory.idl b/dom/interfaces/base/nsIDOMHistory.idl new file mode 100644 index 000000000..b520b6212 --- /dev/null +++ b/dom/interfaces/base/nsIDOMHistory.idl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(55226663-fe68-48ba-addf-08e32eaab569)] +interface nsIDOMHistory : nsISupports +{ + // Empty interface that exists only for extension backwards compat +}; diff --git a/dom/interfaces/base/nsIDOMLocation.idl b/dom/interfaces/base/nsIDOMLocation.idl new file mode 100644 index 000000000..d6577582f --- /dev/null +++ b/dom/interfaces/base/nsIDOMLocation.idl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(79de76e5-994e-4f6b-81aa-42d9adb6e67e)] +interface nsIDOMLocation : nsISupports +{ + /** + * These properties refer to the current location of the document. + * This will correspond to the URI shown in the location bar, which + * can be different from the documentURI of the document. + */ + attribute DOMString hash; + attribute DOMString host; + attribute DOMString hostname; + attribute DOMString href; + attribute DOMString pathname; + attribute DOMString port; + attribute DOMString protocol; + attribute DOMString search; + + readonly attribute DOMString origin; + + void reload([optional] in boolean forceget); + void replace(in DOMString url); + void assign(in DOMString url); + + DOMString toString(); + nsIDOMLocation valueOf(); +}; diff --git a/dom/interfaces/base/nsIDOMModalContentWindow.idl b/dom/interfaces/base/nsIDOMModalContentWindow.idl new file mode 100644 index 000000000..c1ba87ed9 --- /dev/null +++ b/dom/interfaces/base/nsIDOMModalContentWindow.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIVariant; +interface nsIArray; + +[scriptable, uuid(3f4cb2d0-5f7e-44a9-9f4f-370945f8db08)] +interface nsIDOMModalContentWindow : nsISupports +{ + /** + * Readonly attribute containing an arbitrary JS value passed by the + * code that opened the modal content window. A security check is + * performed at access time, per spec. + */ + readonly attribute nsIVariant dialogArguments; + + /** + * The return value that will be returned to the function that + * opened the modal content window. + */ + attribute nsIVariant returnValue; +}; diff --git a/dom/interfaces/base/nsIDOMNavigator.idl b/dom/interfaces/base/nsIDOMNavigator.idl new file mode 100644 index 000000000..5fd16b8ae --- /dev/null +++ b/dom/interfaces/base/nsIDOMNavigator.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIIdleObserver; + +[uuid(f1101fbb-d119-4cb8-845b-6bbae8a151c7)] +interface nsIDOMNavigator : nsISupports +{ + readonly attribute DOMString appCodeName; + readonly attribute DOMString appName; + readonly attribute DOMString appVersion; + readonly attribute DOMString language; + readonly attribute DOMString platform; + readonly attribute DOMString oscpu; + readonly attribute DOMString vendor; + readonly attribute DOMString vendorSub; + readonly attribute DOMString product; + readonly attribute DOMString productSub; + readonly attribute DOMString userAgent; + readonly attribute DOMString buildID; + readonly attribute DOMString doNotTrack; +}; diff --git a/dom/interfaces/base/nsIDOMScreen.idl b/dom/interfaces/base/nsIDOMScreen.idl new file mode 100644 index 000000000..1f1cab79d --- /dev/null +++ b/dom/interfaces/base/nsIDOMScreen.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMEventTarget.idl" + +[builtinclass, uuid(82c7924b-4b46-4e5a-a8d2-6edb5fc0a60d)] +interface nsIDOMScreen : nsIDOMEventTarget +{ + readonly attribute long top; + readonly attribute long left; + readonly attribute long width; + readonly attribute long height; + readonly attribute long pixelDepth; + readonly attribute long colorDepth; + readonly attribute long availWidth; + readonly attribute long availHeight; + readonly attribute long availLeft; + readonly attribute long availTop; + + /** + * Returns the current screen orientation. + * Can be: landscape-primary, landscape-secondary, + * portrait-primary or portrait-secondary. + */ + [binaryname(SlowMozOrientation)] + readonly attribute DOMString mozOrientation; +}; diff --git a/dom/interfaces/base/nsIDOMWindow.idl b/dom/interfaces/base/nsIDOMWindow.idl new file mode 100644 index 000000000..b41458a12 --- /dev/null +++ b/dom/interfaces/base/nsIDOMWindow.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIControllers; +interface nsIDOMBlob; +interface nsIDOMLocation; +interface nsIDOMOfflineResourceList; +interface nsIPrompt; +interface nsISelection; +interface nsIVariant; + +/** + * Empty interface for compatibility with older versions. + * @deprecated Use WebIDL for script visible features, + * nsPIDOMWindow for C++ callers. + */ + +[scriptable, uuid(b8343993-0383-4add-9930-ad176b189240)] +interface nsIDOMWindow : nsISupports {}; + +/** + * Empty interface for compatibility with older versions. + * @deprecated Use nsIDOMWindow instead + */ +[scriptable, uuid(8c589e65-3237-4cd1-8bad-c5c47135e79b)] +interface nsIDOMWindowInternal : nsIDOMWindow {}; diff --git a/dom/interfaces/base/nsIDOMWindowCollection.idl b/dom/interfaces/base/nsIDOMWindowCollection.idl new file mode 100644 index 000000000..ed48ae18f --- /dev/null +++ b/dom/interfaces/base/nsIDOMWindowCollection.idl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface mozIDOMWindowProxy; + +/** + * The nsIDOMWindowCollection interface is an interface for a + * collection of DOM window objects. + */ + +[uuid(8d64f457-fb8c-49ea-a359-cef30eed9774)] +interface nsIDOMWindowCollection : nsISupports +{ + /** + * Accessor for the number of windows in this collection. + */ + readonly attribute unsigned long length; + + /** + * Method for accessing an item in this collection by index. + */ + mozIDOMWindowProxy item(in unsigned long index); + + /** + * Method for accessing an item in this collection by window name. + */ + mozIDOMWindowProxy namedItem(in DOMString name); +}; diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl new file mode 100644 index 000000000..70ec7e0ae --- /dev/null +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -0,0 +1,2009 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * 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. + * + * WARNING: Do not use 'out jsval' parameters in this file. + * SpecialPowers, which is used to access nsIDOMWindowUtils + * in plain mochitests, does not know how to handle them. + * (Use 'jsval' return values instead.) + */ + +%{C++ +#include "nsColor.h" +class gfxContext; +struct nsRect; +%} + +[ref] native nsConstRect(const nsRect); +native nscolor(nscolor); +[ptr] native gfxContext(gfxContext); +typedef unsigned long long nsViewID; + +interface nsICycleCollectorListener; +interface nsIDOMNode; +interface nsIDOMNodeList; +interface nsIDOMElement; +interface nsIDOMHTMLCanvasElement; +interface nsIDOMEvent; +interface nsIDOMStyleSheet; +interface nsITransferable; +interface nsIQueryContentEventResult; +interface nsIDOMWindow; +interface nsIFile; +interface nsIDOMClientRect; +interface nsIURI; +interface nsIDOMEventTarget; +interface nsIRunnable; +interface nsITranslationNodeList; +interface nsIJSRAIIHelper; +interface nsIContentPermissionRequest; +interface nsIObserver; + +[scriptable, uuid(c471d440-004b-4c50-a6f2-747db5f443b6)] +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 + */ + attribute unsigned short imageAnimationMode; + + /** + * Whether the charset of the window's current document has been forced by + * the user. + * Cannot be accessed from unprivileged context (not content-accessible) + */ + readonly attribute boolean docCharsetIsForced; + + /** + * Get current cursor type from this window + * @return the current value of nsCursor + */ + short getCursorType(); + + /** + * 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 + * + * Will throw a DOM security error if called without chrome privileges. + */ + AString getDocumentMetadata(in AString aName); + + /** + * 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. + */ + unsigned long redraw([optional] in unsigned long aCount); + + /** + * Force a synchronous layer transaction for this window if necessary. + */ + void updateLayerTree(); + + /** + * Get the last used layer transaction id for this window's refresh driver. + */ + readonly attribute unsigned long long lastTransactionId; + + /** + * Information retrieved from the <meta name="viewport"> tag. + * See nsContentUtils::GetViewportInfo for more information. + */ + void getViewportInfo(in uint32_t aDisplayWidth, in uint32_t aDisplayHeight, + out double aDefaultZoom, out boolean aAllowZoom, + out double aMinZoom, out double aMaxZoom, + out uint32_t aWidth, out uint32_t aHeight, + out boolean aAutoSize); + + /** + * Information about the window size in device pixels. + */ + void getContentViewerSize(out uint32_t aDisplayWidth, out uint32_t aDisplayHeight); + + /** + * For any scrollable element, this allows you to override the + * visible region and draw more than what is visible, which is + * useful for asynchronous drawing. The "displayport" will be + * <xPx, yPx, widthPx, heightPx> in units of CSS pixels, + * regardless of the size of the enclosing container. This + * will *not* trigger reflow. + * + * For the root scroll area, pass in the root document element. + * For scrollable elements, pass in the container element (for + * instance, the element with overflow: scroll). + * + * <x, y> is relative to the top-left of what would normally be + * the visible area of the element. This means that the pixels + * rendered to the displayport take scrolling into account, + * for example. + * + * It's legal to set a displayport that extends beyond the overflow + * area in any direction (left/right/top/bottom). + * + * It's also legal to set a displayport that extends beyond the + * area's bounds. No pixels are rendered outside the area bounds. + * + * The caller of this method must have chrome privileges. + * + * Calling this will always force a recomposite, so it should be + * avoided if at all possible. Client code should do checks before + * calling this so that duplicate sets are not made with the same + * displayport. + * + * aPriority is recorded along with the displayport rectangle. If this + * method is called with a lower priority than the current priority, the + * call is ignored. + */ + void setDisplayPortForElement(in float aXPx, in float aYPx, + in float aWidthPx, in float aHeightPx, + in nsIDOMElement aElement, + in uint32_t aPriority); + /** + * An alternate way to represent a displayport rect as a set of margins and a + * base rect to apply those margins to. A consumer of pixels may ask for as + * many extra pixels as it would like in each direction. Layout then sets + * the base rect to the "visible rect" of the element, which is just the + * subrect of the element that is drawn (it does not take in account content + * covering the element). + * + * If both a displayport rect and displayport margins with corresponding base + * rect are set with the same priority then the margins will take precendence. + * + * Specifying an alignment value will ensure that after the base rect has + * been expanded by the displayport margins, it will be further expanded so + * that each edge is located at a multiple of the "alignment" value. + * + * Note that both the margin values and alignment are treated as values in + * ScreenPixels. Refer to layout/base/Units.h for a description of this unit. + * The base rect values are in app units. + */ + void setDisplayPortMarginsForElement(in float aLeftMargin, + in float aTopMargin, + in float aRightMargin, + in float aBottomMargin, + in nsIDOMElement aElement, + in uint32_t aPriority); + + void setDisplayPortBaseForElement(in int32_t aX, + in int32_t aY, + in int32_t aWidth, + in int32_t aHeight, + in nsIDOMElement aElement); + + /** + * Get/set the resolution at which rescalable web content is drawn. + * + * Setting a new resolution does *not* trigger reflow. This API is + * entirely separate from textZoom and fullZoom; a resolution scale + * can be applied together with both textZoom and fullZoom. + * + * The effect of this API is for gfx code to allocate more or fewer + * pixels for rescalable content by a factor of |resolution| in + * both dimensions. The scale at which the content is displayed does + * not change; if that is desired, use setResolutionAndScaleTo() instead. + * + * The caller of this method must have chrome privileges. + */ + void setResolution(in float aResolution); + + void getResolution(out float aResolution); + + /** + * Similar to setResolution(), but also scales the content by the + * amount of the resolution, so that it is displayed at a + * correspondingly larger or smaller size, without the need for + * the caller to set an additional transform. + * + * This can be used to implement a non-reflowing scale-zoom, e.g. + * for pinch-zoom on mobile platforms. + * + * The caller of this method must have chrome privileges. + */ + void setResolutionAndScaleTo(in float aResolution); + + /** + * Set a resolution on the presShell which is the "restored" from history. + * The display dimensions are compared to their current values and used + * to scale the resolution value if necessary, e.g. if the device was + * rotated between saving and restoring of the session data. + * This resolution should be used when painting for the first time. Calling + * this too late may have no effect. + */ + void setRestoreResolution(in float aResolution, + in uint32_t aDisplayWidth, + in uint32_t aDisplayHeight); + + /** + * Whether the resolution has been set by the user. + * This gives a way to check whether the provided resolution is the default + * value or restored from a previous session. + * + * Can only be accessed with chrome privileges. + */ + readonly attribute boolean isResolutionSet; + + /** + * Whether the next paint should be flagged as the first paint for a document. + * This gives a way to track the next paint that occurs after the flag is + * set. The flag gets cleared after the next paint. + * + * Can only be accessed with chrome privileges. + */ + attribute boolean isFirstPaint; + + void getPresShellId(out uint32_t aPresShellId); + + /** + * Following modifiers are for sent*Event() except sendNative*Event(). + * NOTE: MODIFIER_ALT, MODIFIER_CONTROL, MODIFIER_SHIFT and MODIFIER_META + * are must be same values as nsIDOMNSEvent::*_MASK for backward + * compatibility. + */ + const long MODIFIER_ALT = 0x0001; + const long MODIFIER_CONTROL = 0x0002; + const long MODIFIER_SHIFT = 0x0004; + const long MODIFIER_META = 0x0008; + const long MODIFIER_ALTGRAPH = 0x0010; + const long MODIFIER_CAPSLOCK = 0x0020; + const long MODIFIER_FN = 0x0040; + const long MODIFIER_FNLOCK = 0x0080; + const long MODIFIER_NUMLOCK = 0x0100; + const long MODIFIER_SCROLLLOCK = 0x0200; + const long MODIFIER_SYMBOL = 0x0400; + const long MODIFIER_SYMBOLLOCK = 0x0800; + const long MODIFIER_OS = 0x1000; + + /** Synthesize a mouse event. The event types supported are: + * mousedown, mouseup, mousemove, mouseover, mouseout, mousecancel, + * contextmenu, MozMouseHittest + * + * 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 chrome privileges. + * + * The event is dispatched via the toplevel window, so it could go to any + * window under the toplevel window, in some cases it could never reach this + * window at all. + * + * NOTE: mousecancel is used to represent the vanishing of an input device + * such as a pen leaving its digitizer by synthesizing a WidgetMouseEvent, + * whose mMessage is eMouseExitFromWidget and mExitFrom is + * WidgetMouseEvent::eTopLevel. + * + * @param aType event type + * @param aX x offset in CSS pixels + * @param aY y offset in CSS pixels + * @param aButton button to synthesize + * @param aClickCount number of clicks that have been performed + * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* + * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds + * during dispatch + * @param aPressure touch input pressure: 0.0 -> 1.0 + * @param aInputSourceArg input source, see nsIDOMMouseEvent for values, + * defaults to mouse input. + * @param aIsDOMEventSynthesized controls nsIDOMEvent.isSynthesized value + * that helps identifying test related events, + * defaults to true + * @param aIsWidgetEventSynthesized controls WidgetMouseEvent.mReason value + * defaults to false (WidgetMouseEvent::eReal) + * + * returns true if the page called prevent default on this event + */ + [optional_argc] + boolean sendMouseEvent(in AString aType, + in float aX, + in float aY, + in long aButton, + in long aClickCount, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg, + [optional] in boolean aIsDOMEventSynthesized, + [optional] in boolean aIsWidgetEventSynthesized, + [optional] in long aButtons); + + + /** Synthesize a pointer event. The event types supported are: + * pointerdown, pointerup, pointermove, pointerover, pointerout + * + * 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 pointerover and pointerout events are + * only fired when the window is entered or exited. For inter-element + * pointerover and pointerout 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 chrome privileges. + * + * The event is dispatched via the toplevel window, so it could go to any + * window under the toplevel window, in some cases it could never reach this + * window at all. + * + * @param aType event type + * @param aX x offset in CSS pixels + * @param aY y offset in CSS pixels + * @param aButton button to synthesize + * @param aClickCount number of clicks that have been performed + * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* + * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds + * during dispatch + * @param aPressure touch input pressure: 0.0 -> 1.0 + * @param aInputSourceArg input source, see nsIDOMMouseEvent for values, + * defaults to mouse input. + * @param aPointerId A unique identifier for the pointer causing the event. default is 0 + * @param aWidth The width (magnitude on the X axis), default is 0 + * @param aHeight The height (magnitude on the Y axis), default is 0 + * @param aTilt The plane angle between the Y-Z plane + * and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis. default is 0 + * @param aTiltX The plane angle between the X-Z plane + * and the plane containing both the transducer (e.g. pen stylus) axis and the X axis. default is 0 + * @param aIsPrimary Indicates if the pointer represents the primary pointer of this pointer type. + * @param aIsSynthesized controls nsIDOMEvent.isSynthesized value + * that helps identifying test related events, + * defaults to true + * + * returns true if the page called prevent default on this event + */ + + [optional_argc] + boolean sendPointerEvent(in AString aType, + in float aX, + in float aY, + in long aButton, + in long aClickCount, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg, + [optional] in long aPointerId, + [optional] in long aWidth, + [optional] in long aHeight, + [optional] in long aTiltX, + [optional] in long aTiltY, + [optional] in boolean aIsPrimary, + [optional] in boolean aIsSynthesized); + + /** Synthesize a touch event. The event types supported are: + * touchstart, touchend, touchmove, and touchcancel + * + * 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 chrome privileges. + * + * The event is dispatched via the toplevel window, so it could go to any + * window under the toplevel window, in some cases it could never reach this + * window at all. + * + * @param aType event type + * @param xs array of offsets in CSS pixels for each touch to be sent + * @param ys array of offsets in CSS pixels for each touch to be sent + * @param rxs array of radii in CSS pixels for each touch to be sent + * @param rys array of radii in CSS pixels for each touch to be sent + * @param rotationAngles array of angles in degrees for each touch to be sent + * @param forces array of forces (floats from 0 to 1) for each touch to be sent + * @param count number of touches in this set + * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* + * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds + * during dispatch + * + * returns true if the page called prevent default on this touch event + */ + boolean sendTouchEvent(in AString aType, + [array, size_is(count)] in uint32_t aIdentifiers, + [array, size_is(count)] in int32_t aXs, + [array, size_is(count)] in int32_t aYs, + [array, size_is(count)] in uint32_t aRxs, + [array, size_is(count)] in uint32_t aRys, + [array, size_is(count)] in float aRotationAngles, + [array, size_is(count)] in float aForces, + in uint32_t count, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame); + + /** The same as sendMouseEvent but ensures that the event is dispatched to + * this DOM window or one of its children. + */ + [optional_argc] + void sendMouseEventToWindow(in AString aType, + in float aX, + in float aY, + in long aButton, + in long aClickCount, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg, + [optional] in boolean aIsDOMEventSynthesized, + [optional] in boolean aIsWidgetEventSynthesized, + [optional] in long aButtons); + + /** The same as sendPointerEvent but ensures that the event + * is dispatched to this DOM window or one of its children. + */ + [optional_argc] + void sendPointerEventToWindow(in AString aType, + in float aX, + in float aY, + in long aButton, + in long aClickCount, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg, + [optional] in long aPointerId, + [optional] in long aWidth, + [optional] in long aHeight, + [optional] in long aTiltX, + [optional] in long aTiltY, + [optional] in boolean aIsPrimary, + [optional] in boolean aIsSynthesized); + + /** The same as sendTouchEvent but ensures that the event is dispatched to + * this DOM window or one of its children. + */ + boolean sendTouchEventToWindow(in AString aType, + [array, size_is(count)] in uint32_t aIdentifiers, + [array, size_is(count)] in int32_t aXs, + [array, size_is(count)] in int32_t aYs, + [array, size_is(count)] in uint32_t aRxs, + [array, size_is(count)] in uint32_t aRys, + [array, size_is(count)] in float aRotationAngles, + [array, size_is(count)] in float aForces, + in uint32_t count, + in long aModifiers, + [optional] in boolean aIgnoreRootScrollFrame); + + /** Synthesize a wheel event for a window. The event types supported is only + * wheel. + * + * 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 chrome privileges. + * + * @param aX x offset in CSS pixels + * @param aY y offset in CSS pixels + * @param aDeltaX deltaX value. + * @param aDeltaY deltaY value. + * @param aDeltaZ deltaZ value. + * @param aDeltaMode deltaMode value which must be one of + * nsIDOMWheelEvent::DOM_DELTA_*. + * @param aModifiers modifiers pressed, using constants defined as + * MODIFIER_* + * @param aLineOrPageDeltaX If you set this value non-zero for + * DOM_DELTA_PIXEL event, EventStateManager will + * dispatch NS_MOUSE_SCROLL event for horizontal + * scroll. + * @param aLineOrPageDeltaY If you set this value non-zero for + * DOM_DELTA_PIXEL event, EventStateManager will + * dispatch NS_MOUSE_SCROLL event for vertical + * scroll. + * @param aOptions Set following flags. + */ + const unsigned long WHEEL_EVENT_CAUSED_BY_NO_LINE_OR_PAGE_DELTA_DEVICE = 0x0001; + // @deprecated Use WHEEL_EVENT_CAUSED_BY_NO_LINE_OR_PAGE_DELTA_DEVICE. + const unsigned long WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE = 0x0001; + const unsigned long WHEEL_EVENT_CAUSED_BY_MOMENTUM = 0x0002; + const unsigned long WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS = 0x0004; + // If any of the following flags is specified this method will throw an + // exception in case the relevant overflowDelta has an unexpected value. + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO = 0x0010; + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE = 0x0020; + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE = 0x0040; + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO = 0x0100; + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE = 0x0200; + const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE = 0x0400; + void sendWheelEvent(in float aX, + in float aY, + in double aDeltaX, + in double aDeltaY, + in double aDeltaZ, + in unsigned long aDeltaMode, + in long aModifiers, + in long aLineOrPageDeltaX, + in long aLineOrPageDeltaY, + in unsigned long aOptions); + + /** + * 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 chrome privileges. + * + * @param aType event type + * @param aKeyCode key code + * @param aCharCode character code + * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* + * @param aAdditionalFlags special flags for the key event, see KEY_FLAG_*. + * + * @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. + */ + + // If this is set, preventDefault() the event before dispatch. + const unsigned long KEY_FLAG_PREVENT_DEFAULT = 0x0001; + + // If this is set, the mIsSynthesizedForTests flag is set to false + // on the key event. Otherwise it is true. + const unsigned long KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS = 0x0002; + + // if one of these flags is set, the KeyboardEvent.location will be the value. + // Otherwise, it will be computed from aKeyCode. + const unsigned long KEY_FLAG_LOCATION_STANDARD = 0x0010; + const unsigned long KEY_FLAG_LOCATION_LEFT = 0x0020; + const unsigned long KEY_FLAG_LOCATION_RIGHT = 0x0040; + const unsigned long KEY_FLAG_LOCATION_NUMPAD = 0x0080; + + boolean sendKeyEvent(in AString aType, + in long aKeyCode, + in long aCharCode, + in long aModifiers, + [optional] in unsigned long aAdditionalFlags); + + /** + * See nsIWidget::SynthesizeNativeKeyEvent + * + * Cannot be accessed from unprivileged context (not content-accessible) + * Will throw a DOM security error if called without chrome privileges. + * + * When you use this for tests, use the constants defined in NativeKeyCodes.js + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified with a "keyevent" + * topic. + */ + void sendNativeKeyEvent(in long aNativeKeyboardLayout, + in long aNativeKeyCode, + in long aModifierFlags, + in AString aCharacters, + in AString aUnmodifiedCharacters, + [optional] in nsIObserver aObserver); + + /** + * 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 chrome privileges. + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified with a "mouseevent" + * topic. + */ + void sendNativeMouseEvent(in long aScreenX, + in long aScreenY, + in long aNativeMessage, + in long aModifierFlags, + in nsIDOMElement aElement, + [optional] in nsIObserver aObserver); + /** + * See nsIWidget::SynthesizeNativeMouseMove and sendNativeMouseEvent + */ + void sendNativeMouseMove(in long aScreenX, + in long aScreenY, + in nsIDOMElement aElement, + [optional] in nsIObserver aObserver); + + /** + * The values for sendNativeMouseScrollEvent's aAdditionalFlags. + */ + + /** + * If MOUSESCROLL_PREFER_WIDGET_AT_POINT is set, widget will dispatch + * the event to a widget which is under the cursor. Otherwise, dispatch to + * a default target on the platform. E.g., on Windows, it's focused window. + */ + const unsigned long MOUSESCROLL_PREFER_WIDGET_AT_POINT = 0x00000001; + + /** + * Interpret the scroll delta values as lines rather than pixels. + */ + const unsigned long MOUSESCROLL_SCROLL_LINES = 0x00000002; + + /** + * The platform specific values of aAdditionalFlags. Must be over 0x00010000. + */ + + /** + * If MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL is set and aNativeMessage is + * WM_VSCROLL or WM_HSCROLL, widget will set the window handle to the lParam + * instead of NULL. + */ + const unsigned long MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL = 0x00010000; + + /** + * See nsIWidget::SynthesizeNativeMouseScrollEvent + * + * 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 chrome privileges. + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified with a + * "mousescrollevent" topic. + * + * @param aNativeMessage + * On Windows: WM_MOUSEWHEEL (0x020A), WM_MOUSEHWHEEL(0x020E), + * WM_VSCROLL (0x0115) or WM_HSCROLL (0x114). + */ + void sendNativeMouseScrollEvent(in long aScreenX, + in long aScreenY, + in unsigned long aNativeMessage, + in double aDeltaX, + in double aDeltaY, + in double aDeltaZ, + in unsigned long aModifierFlags, + in unsigned long aAdditionalFlags, + in nsIDOMElement aElement, + [optional] in nsIObserver aObserver); + + /** + * Touch states for sendNativeTouchPoint. These values match + * nsIWidget's TouchPointerState. + */ + + // The pointer is in a hover state above the digitizer + const long TOUCH_HOVER = 0x01; + // The pointer is in contact with the digitizer + const long TOUCH_CONTACT = 0x02; + // The pointer has been removed from the digitizer detection area + const long TOUCH_REMOVE = 0x04; + // The pointer has been canceled. Will cancel any pending os level + // gestures that would be triggered as a result of completion of the + // input sequence. This may not cancel moz platform related events + // that might get tirggered by input already delivered. + const long TOUCH_CANCEL = 0x08; + + /** + * Create a new or update an existing touch point on the digitizer. + * To trigger os level gestures, individual touch points should + * transition through a complete set of touch states which should be + * sent as individual calls. For example: + * tap - msg1:TOUCH_CONTACT, msg2:TOUCH_REMOVE + * drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE + * hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE + * + * Widget support: Windows 8.0+, Winrt/Win32. Gonk supports CONTACT, REMOVE, + * and CANCEL but no HOVER. Other widgets will throw. + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified with a "touchpoint" + * topic. + * + * @param aPointerId The touch point id to create or update. + * @param aTouchState one or more of the touch states listed above + * @param aScreenX, aScreenY screen coords of this event + * @param aPressure 0.0 -> 1.0 float val indicating pressure + * @param aOrientation 0 -> 359 degree value indicating the + * orientation of the pointer. Use 90 for normal taps. + */ + void sendNativeTouchPoint(in unsigned long aPointerId, + in unsigned long aTouchState, + in long aScreenX, + in long aScreenY, + in double aPressure, + in unsigned long aOrientation, + [optional] in nsIObserver aObserver); + + /** + * Simulates native touch based taps on the input digitizer. Events + * triggered by this call are injected at the os level. Events do not + * bypass widget level input processing and as such can be used to + * test widget event logic and async pan-zoom controller functionality. + * Cannot be accessed from an unprivileged context. + * + * Long taps (based on the aLongTap parameter) will be completed + * asynchrnously after the call returns. Long tap delay is based on + * the ui.click_hold_context_menus.delay pref or 1500 msec if pref + * is not set. + * + * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will + * throw. + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified, with a "touchtap" + * topic. + * + * @param aScreenX, aScreenY screen coords of this event + * @param aLongTap true if the tap should be long, false for a short + * tap. + */ + void sendNativeTouchTap(in long aScreenX, + in long aScreenY, + in boolean aLongTap, + [optional] in nsIObserver aObserver); + + /** + * Cancel any existing touch points or long tap delays. Calling this is safe + * even if you're sure there aren't any pointers recorded. You should call + * this when tests shut down to reset the digitizer driver. Not doing so can + * leave the digitizer in an undetermined state which can screw up subsequent + * tests and native input. + * + * NOTE: The synthesized native event will be fired asynchronously, and upon + * completion the observer, if provided, will be notified with a "cleartouch" + * topic. + */ + void clearNativeTouchSequence([optional] in nsIObserver aObserver); + + /** + * See nsIWidget::ActivateNativeMenuItemAt + * + * Cannot be accessed from unprivileged context (not content-accessible) + * Will throw a DOM security error if called without chrome privileges. + */ + void activateNativeMenuItemAt(in AString indexString); + + /** + * See nsIWidget::ForceUpdateNativeMenuAt + * + * Cannot be accessed from unprivileged context (not content-accessible) + * Will throw a DOM security error if called without chrome privileges. + */ + void forceUpdateNativeMenuAt(in AString indexString); + + /** + * Returns the current selection as plaintext. Note that the result may be + * different from the result of sendQueryContentEvent(QUERY_SELECTED_TEXT). + * This result is computed by native API with transferable data. In other + * words, when the OS treats the selection as plaintext, it treats current + * selection as this result. + */ + AString GetSelectionAsPlaintext(); + + /** + * 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 chrome privileges. + * + * @param aElement the element to focus + * + * Do not use this method. Just use element.focus if available or + * nsIFocusManager::SetFocus instead. + * + */ + void focus(in nsIDOMElement aElement); + + /** + * Force a garbage collection followed by a cycle collection. + * + * Will throw a DOM security error if called without chrome privileges in + * non-debug builds. Available to all callers in debug builds. + * + * @param aListener listener that receives information about the CC graph + * (see @mozilla.org/cycle-collector-logger;1 for a logger + * component) + * @param aExtraForgetSkippableCalls indicates how many times + * nsCycleCollector_forgetSkippable will + * be called before running cycle collection. + * -1 prevents the default + * nsCycleCollector_forgetSkippable call + * which happens after garbage collection. + */ + void garbageCollect([optional] in nsICycleCollectorListener aListener, + [optional] in long aExtraForgetSkippableCalls); + + /** + * Force a cycle collection without garbage collection. + * + * Will throw a DOM security error if called without chrome privileges in + * non-debug builds. Available to all callers in debug builds. + * + * @param aListener listener that receives information about the CC graph + * (see @mozilla.org/cycle-collector-logger;1 for a logger + * component) + * @param aExtraForgetSkippableCalls indicates how many times + * nsCycleCollector_forgetSkippable will + * be called before running cycle collection. + * -1 prevents the default + * nsCycleCollector_forgetSkippable call + * which happens after garbage collection. + */ + void cycleCollect([optional] in nsICycleCollectorListener aListener, + [optional] in long aExtraForgetSkippableCalls); + + /** + * Trigger whichever GC or CC timer is currently active and waiting to fire. + * Don't do this too much for initiating heavy actions, like the start of a IGC. + */ + void runNextCollectorTimer(); + + /** Synthesize a simple gesture event for a window. The event types + * supported are: MozSwipeGestureMayStart, MozSwipeGestureStart, + * MozSwipeGestureUpdate, MozSwipeGestureEnd, MozSwipeGesture, + * MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture, + * MozRotateGestureStart, MozRotateGestureUpdate, MozRotateGesture, + * MozPressTapGesture, MozTapGesture, and MozEdgeUIGesture. + * + * Cannot be accessed from unprivileged context (not + * content-accessible) Will throw a DOM security error if called + * without chrome privileges. + * + * @param aType event type + * @param aX x offset in CSS pixels + * @param aY y offset in CSS pixels + * @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 + * @param aClickCount For tap gestures, the number of taps. + */ + void sendSimpleGestureEvent(in AString aType, + in float aX, + in float aY, + in unsigned long aDirection, + in double aDelta, + in long aModifiers, + [optional] in unsigned long aClickCount); + + /** + * 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 float aX, + in float aY, + in boolean aIgnoreRootScrollFrame, + in boolean aFlushLayout); + + /** + * Retrieve all nodes that intersect a rect in the window's document. + * + * @param aX x reference for the rectangle in CSS pixels + * @param aY y reference for the rectangle in CSS pixels + * @param aTopSize How much to expand up the rectangle + * @param aRightSize How much to expand right the rectangle + * @param aBottomSize How much to expand down the rectangle + * @param aLeftSize How much to expand left the rectangle + * @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. + */ + nsIDOMNodeList nodesFromRect(in float aX, + in float aY, + in float aTopSize, + in float aRightSize, + in float aBottomSize, + in float aLeftSize, + in boolean aIgnoreRootScrollFrame, + in boolean aFlushLayout); + + + /** + * Get a list of nodes that have meaningful textual content to + * be translated. The implementation of this algorithm is in flux + * as we experiment and refine which approach works best. + * + * This method requires chrome privileges. + */ + nsITranslationNodeList getTranslationNodes(in nsIDOMNode aRoot); + + /** + * 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 chrome privileges. + */ + uint32_t compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1, + in nsIDOMHTMLCanvasElement aCanvas2, + out unsigned long aMaxDifference); + + /** + * Returns true if a MozAfterPaint event has been queued but not yet + * fired. + */ + readonly attribute boolean isMozAfterPaintPending; + + /** + * Suppresses/unsuppresses user initiated event handling in window's document + * and subdocuments. + * + * @throw NS_ERROR_DOM_SECURITY_ERR if called without chrome privileges and + * NS_ERROR_FAILURE if window doesn't have a document. + */ + void suppressEventHandling(in boolean aSuppress); + + void clearMozAfterPaintEvents(); + + /** + * 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 chrome privileges. + * + * @param aDisable If true, disable all non synthetic test mouse events + * on all windows. Otherwise, enable them. + */ + void disableNonTestMouseEvents(in boolean aDisable); + + /** + * 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); + + /** + * 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 getScrollXYFloat(in boolean aFlushLayout, out float aScrollX, out float aScrollY); + + /** + * Returns the scrollbar width of the window's scroll frame. + * + * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs. + */ + void getScrollbarSize(in boolean aFlushLayout, out long aWidth, out long aHeight); + + /** + * Returns the given element's bounds without flushing pending layout changes. + */ + nsIDOMClientRect getBoundsWithoutFlushing(in nsIDOMElement aElement); + + /** + * Returns the bounds of the window's currently loaded document. This will + * generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL + * documents) may have a negative left value. + */ + nsIDOMClientRect getRootBounds(); + + /** + * 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; + + /** + * Get the number of screen pixels per CSS pixel. + */ + readonly attribute float screenPixelsPerCSSPixel; + + /** + * Get the current zoom factor. + * This is _approximately_ the same as nsIContentViewer.fullZoom, + * but takes into account Gecko's quantization of the zoom factor, which is + * implemented by adjusting the (integer) number of appUnits per devPixel. + */ + readonly attribute float fullZoom; + + /** + * 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 chrome privileges. + * + * @note Event handlers won't get aEvent as parameter, but a similar event. + * Also, aEvent should not be reused. + */ + boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget, + in nsIDOMEvent aEvent, + in boolean aTrusted); + + /** + * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that + * the event is propagated only to chrome. + * Event's .target property will be aTarget. + * Returns the same value as what EventTarget.dispatchEvent does. + */ + boolean dispatchEventToChromeOnly(in nsIDOMEventTarget aTarget, + in nsIDOMEvent aEvent); + + /** + * Returns the real classname (possibly of the mostly-transparent security + * wrapper) of aObj. + */ + [implicit_jscontext] string getClassName(in jsval aObject); + + /** + * Generate a content command event. + * + * Cannot be accessed from unprivileged context (not content-accessible) + * Will throw a DOM security error if called without chrome privileges. + * + * @param aType Type of command content event to send. Can be one of "cut", + * "copy", "paste", "delete", "undo", "redo", or "pasteTransferable". + * @param aTransferable an instance of nsITransferable when aType is + * "pasteTransferable" + */ + void sendContentCommandEvent(in AString aType, + [optional] in nsITransferable aTransferable); + + /** + * If sendQueryContentEvent()'s aAdditionalFlags argument is + * QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK, plain text generated from content + * is created with "\n". + * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used. + * aOffset and aLength are offset and length in/of the plain text content. + * This flag also affects the result values such as offset, length and string. + */ + const unsigned long QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK = 0x0000; + const unsigned long QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK = 0x0001; + + /** + * sendQueryContentEvent()'s aAdditionalFlags may have one of following + * flags when aType is QUERY_SELECTED_TEXT. If one of them is set, + * the result is the first range of the selection type. See also + * nsISelectionController::SELECTION_*. + */ + const unsigned long QUERY_CONTENT_FLAG_SELECTION_SPELLCHECK = 0x0002; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_RAWINPUT = 0x0004; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDRAWTEXT = 0x0008; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_CONVERTEDTEXT = 0x0010; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDCONVERTEDTEXT = + 0x0020; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_ACCESSIBILITY = 0x0040; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_FIND = 0x0080; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_URLSECONDARY = 0x0100; + const unsigned long QUERY_CONTENT_FLAG_SELECTION_URLSTRIKEOUT = 0x0200; + + /** + * One of sendQueryContentEvent()'s aAdditionalFlags. If this is specified, + * aOffset is relative to start of selection or composition. + * Note that this is supported only when QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK + * is not specified for now. + */ + const unsigned long QUERY_CONTENT_FLAG_OFFSET_RELATIVE_TO_INSERTION_POINT = + 0x0400; + + /** + * Synthesize a query content event. Note that the result value returned here + * is in LayoutDevice pixels rather than CSS pixels. + * + * @param aType One of the following const values. And see also each comment + * for the other parameters and the result. + * @param aAdditionalFlags See the description of QUERY_CONTENT_FLAG_*. + */ + nsIQueryContentEventResult sendQueryContentEvent( + in unsigned long aType, + in long long aOffset, + in unsigned long aLength, + in long aX, + in long aY, + [optional] in unsigned long aAdditionalFlags); + + /** + * QUERY_SELECTED_TEXT queries the first selection range's information. + * + * @param aOffset Not used. + * @param aLength Not used. + * @param aX Not used. + * @param aY Not used. + * + * @return offset, reversed and text properties of the result are available. + */ + const unsigned long QUERY_SELECTED_TEXT = 3200; + + /** + * QUERY_TEXT_CONTENT queries the text at the specified range. + * + * @param aOffset The first character's offset. 0 is the first character. + * @param aLength The length of getting text. If the aLength is too long, + * the result text is shorter than this value. + * @param aX Not used. + * @param aY Not used. + * + * @return text property of the result is available. + */ + const unsigned long QUERY_TEXT_CONTENT = 3201; + + /** + * QUERY_CARET_RECT queries the (collapsed) caret rect of the offset. + * If the actual caret is there at the specified offset, this returns the + * actual caret rect. Otherwise, this guesses the caret rect from the + * metrics of the text. + * + * @param aOffset The caret offset. 0 is the left side of the first + * caracter in LTR text. + * @param aLength Not used. + * @param aX Not used. + * @param aY Not used. + * + * @return left, top, width and height properties of the result are available. + * The left and the top properties are offset in the client area of + * the DOM window. + */ + const unsigned long QUERY_CARET_RECT = 3203; + + /** + * QUERY_TEXT_RECT queries the specified text's rect. + * + * @param aOffset The first character's offset. 0 is the first character. + * @param aLength The length of getting text. If the aLength is too long, + * the extra length is ignored. + * @param aX Not used. + * @param aY Not used. + * + * @return left, top, width and height properties of the result are available. + * The left and the top properties are offset in the client area of + * the DOM window. + */ + const unsigned long QUERY_TEXT_RECT = 3204; + + /** + * QUERY_TEXT_RECT queries the focused editor's rect. + * + * @param aOffset Not used. + * @param aLength Not used. + * @param aX Not used. + * @param aY Not used. + * + * @return left, top, width and height properties of the result are available. + */ + const unsigned long QUERY_EDITOR_RECT = 3205; + + /** + * QUERY_CHARACTER_AT_POINT queries the character information at the + * specified point. The point is offset in the window. + * NOTE: If there are some panels at the point, this method send the query + * event to the panel's widget automatically. + * + * @param aOffset Not used. + * @param aLength Not used. + * @param aX X offset in the widget. + * @param aY Y offset in the widget. + * + * @return offset, notFound, left, top, width and height properties of the + * result are available. + */ + const unsigned long QUERY_CHARACTER_AT_POINT = 3208; + + /** + * QUERY_TEXT_RECT_ARRAY queries the rects per character + * + * @param aOffset The first character's offset. 0 is the first character. + * @param aLength The length of getting text. If the aLength is too long, + * the extra length is ignored. + * @param aX Not used. + * @param aY Not used. + */ + const unsigned long QUERY_TEXT_RECT_ARRAY = 3209; + + /** + * Called when the remote child frame has changed its fullscreen state, + * when entering fullscreen, and when the origin which is fullscreen changes. + * aFrameElement is the iframe element which contains the child-process + * fullscreen document. + */ + void remoteFrameFullscreenChanged(in nsIDOMElement aFrameElement); + + /** + * Called when the remote frame has popped all fullscreen elements off its + * stack, so that the operation can complete on the parent side. + */ + void remoteFrameFullscreenReverted(); + + /** + * Calls the document to handle any pending fullscreen requests. + * It is called when the parent document has entered fullscreen, and + * we want to put the current document into fullscreen as well. + * The return value indicates whether there is any fullscreen request + * handled by this call. + */ + boolean handleFullscreenRequests(); + + /** + * Called when the child frame has fully exit fullscreen, so that the parent + * process can also fully exit. + */ + void exitFullscreen(); + + /** + * If sendQueryContentEvent()'s aAdditionalFlags argument is + * SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK, aOffset and aLength are offset + * and length in/of plain text generated from content is created with "\n". + * Otherwise, platform dependent. E.g., on Windows, "\r\n" is used. + */ + const unsigned long SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK = 0x0000; + const unsigned long SELECTION_SET_FLAG_USE_XP_LINE_BREAK = 0x0001; + + /** + * If SELECTION_SET_FLAG_REVERSE is set, the selection is set from + * |aOffset + aLength| to |aOffset|. Otherwise, it's set from |aOffset| to + * |aOffset + aLength|. + */ + const unsigned long SELECTION_SET_FLAG_REVERSE = 0x0002; + + /** + * Synthesize a selection set event to the window. + * + * This sets the selection as the specified information. + * + * @param aOffset The caret offset of the selection start. + * @param aLength The length of the selection. If this is too long, the + * extra length is ignored. + * @param aAdditionalFlags See the description of SELECTION_SET_FLAG_*. + * @return True, if succeeded. Otherwise, false. + */ + boolean sendSelectionSetEvent(in unsigned long aOffset, + in unsigned long aLength, + [optional] in unsigned long aAdditionalFlags); + + /* Selection behaviors - mirror nsIFrame's nsSelectionAmount constants */ + const unsigned long SELECT_CHARACTER = 0; + const unsigned long SELECT_CLUSTER = 1; + const unsigned long SELECT_WORD = 2; + const unsigned long SELECT_LINE = 3; + const unsigned long SELECT_BEGINLINE = 4; + const unsigned long SELECT_ENDLINE = 5; + const unsigned long SELECT_PARAGRAPH = 6; + const unsigned long SELECT_WORDNOSPACE = 7; + + /** + * Select content at a client point based on a selection behavior if the + * underlying content is selectable. Selection will accumulate with any + * existing selection, callers should clear selection prior if needed. + * May fire selection changed events. Calls nsFrame's SelectByTypeAtPoint. + * + * @param aX, aY The selection point in client coordinates. + * @param aSelectType The selection behavior requested. + * @return True if a selection occured, false otherwise. + * @throw NS_ERROR_DOM_SECURITY_ERR, NS_ERROR_UNEXPECTED for utils + * issues, and NS_ERROR_INVALID_ARG for coordinates that are outside + * this window. + */ + boolean selectAtPoint(in float aX, + in float aY, + in unsigned long aSelectBehavior); + + /** + * Perform the equivalent of: + * window.getComputedStyle(aElement, aPseudoElement). + * getPropertyValue(aPropertyName) + * except that, when the link whose presence in history is allowed to + * influence aElement's style is visited, get the value the property + * would have if allowed all properties to change as a result of + * :visited selectors (except for cases where getComputedStyle uses + * data from the frame). + * + * This is easier to implement than adding our property restrictions + * to this API, and is sufficient for the present testing + * requirements (which are essentially testing 'color'). + */ + AString getVisitedDependentComputedStyle(in nsIDOMElement aElement, + in AString aPseudoElement, + in AString aPropertyName); + + /** + * Get the id of the outer window of this window. This will never throw. + */ + readonly attribute unsigned long long outerWindowID; + + /** + * Get the id of the current inner window of this window. If there + * is no current inner window, throws NS_ERROR_NOT_AVAILABLE. + */ + readonly attribute unsigned long long currentInnerWindowID; + + /** + * Put the window into a state where scripts are frozen and events + * suppressed, for use when the window has launched a modal prompt. + */ + void enterModalState(); + + /** + * Resume normal window state, where scripts can run and events are + * delivered. + */ + void leaveModalState(); + + /** + * Is the window is in a modal state? [See enterModalState()] + */ + [noscript] boolean isInModalState(); + + /** + * Request set internal desktopMode flag change. + */ + void setDesktopModeViewport(in boolean aDesktopModeViewport); + + /** + * Suspend/resume timeouts on this window and its descendant windows. + */ + void suspendTimeouts(); + void resumeTimeouts(); + + /** + * What type of layer manager the widget associated with this window is + * using. "Basic" is unaccelerated; other types are accelerated. Throws an + * error if there is no widget associated with this window. + */ + readonly attribute AString layerManagerType; + + /** + * True if the layer manager for the widget associated with this window is + * forwarding layers to a remote compositor, false otherwise. Throws an + * error if there is no widget associated with this window. + */ + readonly attribute boolean layerManagerRemote; + + /** + * Returns a Promise that will be resolved with a string once the capabilities + * of the h264 decoder have been determined. + * Success does not mean that all h264 video decoding will be done + * in hardware. + */ + readonly attribute jsval supportsHardwareH264Decoding; + + /** + * Returns the current audio backend as a free-form string. + */ + readonly attribute AString currentAudioBackend; + + /** + * Record (and return) frame-intervals for frames which were presented + * between calling StartFrameTimeRecording and StopFrameTimeRecording. + * + * - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late + * (elements were overwritten since Start), result is considered invalid and hence empty. + * - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent). + * Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize. + * - Note: the first frame-interval may be longer than expected because last frame + * might have been presented some time before calling StartFrameTimeRecording. + */ + + /** + * Returns a handle which represents current recording start position. + */ + void startFrameTimeRecording([retval] out unsigned long startIndex); + + /** + * Returns number of recorded frames since startIndex was issued, + * and allocates+populates 2 arraye with the recorded data. + * - Allocation is infallible. Should be released even if size is 0. + */ + void stopFrameTimeRecording(in unsigned long startIndex, + [optional] out unsigned long frameCount, + [retval, array, size_is(frameCount)] out float frameIntervals); + + /** + * Signals that we're begining to tab switch. This is used by painting code to + * determine total tab switch time. + */ + void beginTabSwitch(); + + /** + * The DPI of the display + */ + readonly attribute float displayDPI; + + /** + * Return the outer window with the given ID, if any. Can return null. + * @deprecated Use nsIWindowMediator.getOuterWindowWithId. See bug 865664. + */ + nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID); + + /** + * Return this window's frame element. + * Ignores all chrome/content or mozbrowser boundaries. + */ + readonly attribute nsIDOMElement containerElement; + + [noscript] void RenderDocument(in nsConstRect aRect, + in uint32_t aFlags, + in nscolor aBackgroundColor, + in gfxContext aThebesContext); + + /** + * advanceTimeAndRefresh allows the caller to take over the refresh + * driver timing for a window. A call to advanceTimeAndRefresh does + * three things: + * (1) It marks the refresh driver for this presentation so that it + * no longer refreshes on its own, but is instead driven entirely + * by the caller (except for the refresh that happens when a + * document comes out of the bfcache). + * (2) It advances the refresh driver's current refresh time by the + * argument given. Negative advances are permitted. + * (3) It does a refresh (i.e., notifies refresh observers) at that + * new time. + * + * Note that this affects other connected docshells of the same type + * in the same docshell tree, such as parent frames. + * + * When callers have completed their use of advanceTimeAndRefresh, + * they must call restoreNormalRefresh. + */ + void advanceTimeAndRefresh(in long long aMilliseconds); + + /** + * Undoes the effects of advanceTimeAndRefresh. + */ + void restoreNormalRefresh(); + + /** + * Reports whether the current state is test-controlled refreshes + * (see advanceTimeAndRefresh and restoreNormalRefresh above). + */ + readonly attribute bool isTestControllingRefreshes; + + /** + * Reports whether APZ is enabled on the widget that this window is attached + * to. If there is no widget it will report the default platform value of + * whether or not APZ is enabled. + */ + readonly attribute bool asyncPanZoomEnabled; + + /** + * Set async scroll offset on an element. The next composite will render + * with that offset if async scrolling is enabled, and then the offset + * will be removed. Only call this while test-controlled refreshes is enabled. + */ + void setAsyncScrollOffset(in nsIDOMNode aNode, in float aX, in float aY); + + /** + * Set async zoom value. aRootElement should be the document element of our + * document. The next composite will render with that zoom added to any + * existing zoom if async scrolling is enabled, and then the zoom will be + * removed. Only call this while test-controlled refreshes is enabled. + */ + void setAsyncZoom(in nsIDOMNode aRootElement, in float aValue); + + /** + * Do a round-trip to the compositor to ensure any pending APZ repaint requests + * get flushed to the main thread. If the function returns true, the flush was + * triggered and an "apz-repaints-flushed" notification will be dispatched via + * the observer service once the flush is complete. If the function returns + * false, an error occurred or a flush is not needed, and the notification + * will not fire. This is intended to be used by test code only! + */ + bool flushApzRepaints(); + + /** + * Ask APZ to pan and zoom to the focused input element. + */ + void zoomToFocusedInput(); + + /** + * Method for testing StyleAnimationValue::ComputeDistance. + * + * Returns the distance between the two values as reported by + * StyleAnimationValue::ComputeDistance for the given element and + * property. + */ + double computeAnimationDistance(in nsIDOMElement element, + in AString property, + in AString value1, + in AString value2); + + /** + * Wrap an nsIFile in an DOM File + * Returns a File object. + */ + nsISupports wrapDOMFile(in nsIFile aFile); + + /** + * Get the type of the currently focused html input, if any. + */ + readonly attribute string focusedInputType; + + /** + * Find the view ID for a given element. This is the reverse of + * findElementWithViewId(). + */ + nsViewID getViewId(in nsIDOMElement aElement); + + /** + * Checks the layer tree for this window and returns true + * if all layers have transforms that are translations by integers, + * no leaf layers overlap, and the union of the leaf layers is exactly + * the bounds of the window. Always returns true in non-DEBUG builds. + */ + boolean leafLayersPartitionWindow(); + + /** + * Check if any PaintedLayer painting has been done for this element, + * clears the painted flags if they have. + */ + boolean checkAndClearPaintedState(in nsIDOMElement aElement); + + /** + * Check whether all display items of the primary frame of aElement have been + * assigned to the same single PaintedLayer in the last paint. If that is the + * case, returns whether that PaintedLayer is opaque; if it's not the case, an + * exception is thrown. + */ + boolean isPartOfOpaqueLayer(in nsIDOMElement aElement); + + /** + * Count the number of different PaintedLayers that the supplied elements have + * been assigned to in the last paint. Throws an exception if any of the + * elements doesn't have a primary frame, or if that frame's display items are + * assigned to any other layers than just a single PaintedLayer per element. + */ + unsigned long numberOfAssignedPaintedLayers([array, size_is(count)] in nsIDOMElement aElements, + in uint32_t count); + + /** + * Get internal id of the stored blob, file or file handle. + */ + [implicit_jscontext] long long getFileId(in jsval aFile); + + /** + * Get internal file path of the stored file or file handle. + * + * TODO: File handle objects are actually not supported at the moment. + */ + [implicit_jscontext] AString getFilePath(in jsval aFile); + + /** + * Get file ref count info for given database and file id. + * + */ + [implicit_jscontext] + boolean getFileReferences(in AString aDatabaseName, in long long aId, + [optional] in jsval aOptions, + [optional] out long aRefCnt, + [optional] out long aDBRefCnt, + [optional] out long aSliceRefCnt); + + void flushPendingFileDeletions(); + + /** + * Return whether incremental GC has been disabled due to a binary add-on. + */ + [implicit_jscontext] + boolean isIncrementalGCEnabled(); + + /** + * Begin opcode-level profiling of all JavaScript execution in the window's + * runtime. + */ + [implicit_jscontext] + void startPCCountProfiling(); + + /** + * Stop opcode-level profiling of JavaScript execution in the runtime, and + * collect all counts for use by getPCCount methods. + */ + [implicit_jscontext] + void stopPCCountProfiling(); + + /** + * Purge collected PC counters. + */ + [implicit_jscontext] + void purgePCCounts(); + + /** + * Get the number of scripts with opcode-level profiling information. + */ + [implicit_jscontext] + long getPCCountScriptCount(); + + /** + * Get a JSON string for a short summary of a script and the PC counts + * accumulated for it. + */ + [implicit_jscontext] + AString getPCCountScriptSummary(in long script); + + /** + * Get a JSON string with full information about a profiled script, + * including the decompilation of the script and placement of decompiled + * operations within it, and PC counts for each operation. + */ + [implicit_jscontext] + AString getPCCountScriptContents(in long script); + + /** + * Returns true if painting is suppressed for this window and false + * otherwise. + */ + readonly attribute boolean paintingSuppressed; + + /** + * Returns an array of plugins on the page for opt-in activation. + * + * Cannot be accessed from unprivileged context (not content-accessible). + * Will throw a DOM security error if called without chrome privileges. + * + */ + [implicit_jscontext] + readonly attribute jsval plugins; + + /** + * Set the scrollport size for the purposes of clamping scroll positions for + * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels. + * + * The caller of this method must have chrome privileges. + */ + void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight); + + /** + * These are used to control whether dialogs (alert, prompt, confirm) are + * allowed. + */ + void disableDialogs(); + void enableDialogs(); + bool areDialogsEnabled(); + + const unsigned long AGENT_SHEET = 0; + const unsigned long USER_SHEET = 1; + const unsigned long AUTHOR_SHEET = 2; + /** + * Synchronously loads a style sheet from |sheetURI| and adds it to the list + * of additional style sheets of the document. + * + * These additional style sheets are very much like user/agent sheets loaded + * with loadAndRegisterSheet. The only difference is that they are applied only + * on the document owned by this window. + * + * Sheets added via this API take effect immediately on the document. + */ + void loadSheet(in nsIURI sheetURI, in unsigned long type); + + /** + * Same as the above method but allows passing the URI as a string. + */ + void loadSheetUsingURIString(in ACString sheetURI, in unsigned long type); + + /** + * Adds a style sheet to the list of additional style sheets of the document. + * + * Style sheets can be preloaded with nsIStyleSheetService.preloadSheet. + * + * Sheets added via this API take effect immediately on the document. + */ + void addSheet(in nsIDOMStyleSheet sheet, in unsigned long type); + + /** + * Remove the document style sheet at |sheetURI| from the list of additional + * style sheets of the document. The removal takes effect immediately. + */ + void removeSheet(in nsIURI sheetURI, in unsigned long type); + + /** + * Same as the above method but allows passing the URI as a string. + */ + void removeSheetUsingURIString(in ACString sheetURI, in unsigned long type); + + /** + * Returns true if a user input is being handled. + * + * This calls EventStateManager::IsHandlingUserInput(). + */ + readonly attribute boolean isHandlingUserInput; + + /** + * Returns milliseconds elapsed since last user input was started + * + * This relies on EventStateManager::LatestUserInputStart() + */ + readonly attribute double millisSinceLastUserInput; + + /** + * After calling the method, the window for which this DOMWindowUtils + * was created can be closed using scripts. + */ + void allowScriptsToClose(); + + /** + * Is the parent window's main widget visible? If it isn't, we probably + * don't want to display any dialogs etc it may request. This corresponds + * to the visibility check in nsWindowWatcher::OpenWindowInternal(). + * + * Will throw a DOM security error if called without chrome privileges or + * NS_ERROR_NOT_AVAILABLE in the unlikely event that the parent window's + * main widget can't be reached. + */ + readonly attribute boolean isParentWindowMainWidgetVisible; + + /** + * In certain cases the event handling of nodes, form controls in practice, + * may be disabled. Such cases are for example the existence of disabled + * attribute or -moz-user-input: none/disabled. + */ + boolean isNodeDisabledForEvents(in nsIDOMNode aNode); + + /** + * Setting paintFlashing to true will flash newly painted area. + */ + attribute boolean paintFlashing; + + /* + * Returns the value of a given property animated on the compositor thread. + * If the property is NOT currently being animated on the compositor thread, + * returns an empty string. + */ + AString getOMTAStyle(in nsIDOMElement aElement, in AString aProperty, + [optional] in AString aPseudoElement); + + /** + * Special function that gets a property syncronously from the last composite + * that occured. + * + * Supported properties: + * "overdraw": Report a percentage between 0 and 999 indicate how many times + * each pixels on the destination window have been touched. + * "missed_hwc": Report a bool if hardware composer is supported but was + * not used for the last frame. + */ + float requestCompositorProperty(in AString aProperty); + + /** + * If aHandlingInput is true, this informs the event state manager that + * we're handling user input. Otherwise, this is a no-op (as by default + * we're not handling user input). + * Remember to call destruct() on the return value! + * See also nsIDOMWindowUtils::isHandlingUserInput. + */ + nsIJSRAIIHelper setHandlingUserInput(in boolean aHandlingInput); + + /** + * Get the content- and compositor-side APZ test data instances. + * The return values are of type APZTestData (see APZTestData.webidl). + */ + [implicit_jscontext] jsval getContentAPZTestData(); + [implicit_jscontext] jsval getCompositorAPZTestData(); + + /** + * Posts an eRestyle_Self restyle event for the given element. + */ + void postRestyleSelfEvent(in nsIDOMElement aElement); + + /** + * Used to pause or resume all media in this window. Use-cases are audio + * competing, remote media control and to prevent auto-playing media. + */ + attribute uint32_t mediaSuspend; + + /** + * With this it's possible to mute all the MediaElements in this window. + * We have audioMuted and audioVolume to preserve the volume across + * mute/umute. + */ + attribute boolean audioMuted; + + /** + * range: greater or equal to 0. The real volume level is affected by the + * volume of all ancestor windows. + */ + attribute float audioVolume; + + /** + * This method doesn't do anything useful. It was solely added for the + * purpose of the test for bug 503926. + */ + void xpconnectArgument(in nsIDOMWindowUtils aThis); + + /** + * Helper for JS components that need to send permission requests with + * e10s support properly. + */ + void askPermission(in nsIContentPermissionRequest aRequest); + + /** + * Number of elements restyled for the curent document. + * + * Note that during a restyle operation we may restyle an element more + * than once (e.g., for an inline that contains blocks). This also + * counts restyling of pseudo-elements and anonymous boxes. + * + * May throw NS_ERROR_NOT_AVAILABLE. + */ + readonly attribute unsigned long long elementsRestyled; + + /** + * Number of frames constructed (excluding breaking) for the curent + * document. + * + * May throw NS_ERROR_NOT_AVAILABLE. + */ + readonly attribute unsigned long long framesConstructed; + + /** + * Number of frames reflowed for the curent document. + * + * May throw NS_ERROR_NOT_AVAILABLE. + */ + readonly attribute unsigned long long framesReflowed; + + /** + * Controls the amount of chrome that should be visible on each side of + * the window. Works like the chromemargin xul:window attribute. + * This should only be used with non-XUL windows. + */ + void setChromeMargin(in int32_t aTop, + in int32_t aRight, + in int32_t aBottom, + in int32_t aLeft); + + /** + * Enable some service workers testing features. + */ + attribute boolean serviceWorkersTestingEnabled; + + /** + * Returns a JSObject which contains a list of frame uniformities + * when the pref gfx.vsync.collect-scroll-data is enabled. + * Every result contains a layer address and a frame uniformity for that layer. + * A negative frame uniformity value indicates an invalid frame uniformity and an error has occured. + */ + [implicit_jscontext] jsval getFrameUniformityTestData(); + + /* + * Increase the chaos mode activation level. An equivalent number of + * calls to leaveChaosMode must be made in order to restore the original + * chaos mode state. If the activation level is nonzero all chaos mode + * features are activated. + */ + void enterChaosMode(); + + /** + * Decrease the chaos mode activation level. See enterChaosMode(). + */ + void leaveChaosMode(); + + /** + * Returns whether the document's style set's rule processor for the + * specified level of the cascade is shared by multiple style sets. + * (Used by tests to ensure that certain optimizations do not regress.) + * + * @param aSheetType One of the nsIStyleSheetService.*_SHEET constants. + */ + bool hasRuleProcessorUsedByMultipleStyleSets(in unsigned long aSheetType); + + /* + * Force the use counters for the node's associated document(s) to be + * flushed to telemetry. For example, a document node will flush its own + * counters and an image node with an SVG source will flush the SVG + * document's counters. Normally, use counters are flushed to telemetry + * upon document destruction, but as document destruction is somewhat + * non-deterministic, we have this method here for more determinism when + * running tests. + */ + void forceUseCounterFlush(in nsIDOMNode aNode); + + void setNextPaintSyncId(in long aSyncId); + + /** + * Enable or disable displayport suppression. This is intended to be used by + * testing code, to provide more deterministic behaviour over the displayport + * suppression during tests. Note that this updates a flag, so whatever value + * was last provided is what will be used. + */ + void respectDisplayPortSuppression(in boolean aEnabled); + + /** + * Set a flag that forces the next reflow interrupt check to return true. This + * can be used by tests to force execution of the interrupted reflow codepaths. + */ + void forceReflowInterrupt(); + + /** + * Terminate the GPU process. Used for testing GPU process restarts. + */ + void terminateGPUProcess(); + + /** + * Returns the GPU process pid, or -1 if there is no GPU process. + */ + readonly attribute int32_t gpuProcessPid; + + const long MOUSE_BUTTONS_NO_BUTTON = 0x00; + const long MOUSE_BUTTONS_LEFT_BUTTON = 0x01; + const long MOUSE_BUTTONS_RIGHT_BUTTON = 0x02; + const long MOUSE_BUTTONS_MIDDLE_BUTTON = 0x04; + // Typically, "back" button being left side of 5-button + // mice, see "buttons" attribute document of DOM3 Events. + const long MOUSE_BUTTONS_4TH_BUTTON = 0x08; + // Typically, "forward" button being right side of 5-button + // mice, see "buttons" attribute document of DOM3 Events. + const long MOUSE_BUTTONS_5TH_BUTTON = 0x10; + // Buttons are not specified, will be calculated from |aButton|. + const long MOUSE_BUTTONS_NOT_SPECIFIED = -1; +}; + +[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)] +interface nsITranslationNodeList : nsISupports { + readonly attribute unsigned long length; + nsIDOMNode item(in unsigned long index); + + // A translation root is a block element, or an inline element + // which its parent is not a translation node. + boolean isTranslationRootAtIndex(in unsigned long index); +}; + +/** + * JS doesn't do RAII very well. We can use this interface to make remembering + * to destruct an object in a finally clause easier. + */ +[scriptable, uuid(52e5a996-d0a9-4efc-a6fa-24489c532b19)] +interface nsIJSRAIIHelper : nsISupports { + void destruct(); +}; diff --git a/dom/interfaces/base/nsIFocusManager.idl b/dom/interfaces/base/nsIFocusManager.idl new file mode 100644 index 000000000..0deddc2c3 --- /dev/null +++ b/dom/interfaces/base/nsIFocusManager.idl @@ -0,0 +1,276 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface mozIDOMWindowProxy; +interface nsIDocument; +interface nsIContent; + +[scriptable, uuid(86e1f1e1-365d-493b-b52a-a649f3f311dc)] +/** + * The focus manager deals with all focus related behaviour. Only one element + * in the entire application may have the focus at a time; this element + * receives any keyboard events. While there is only one application-wide + * focused element, each nsIDOMWindow maintains a reference to the element + * that would be focused if the window was active. + * + * If the window's reference is to a frame element (iframe, browser, + * editor), then the child window contains the element that is currently + * focused. If the window's reference is to a root element, then the root is + * focused. If a window's reference is null, then no element is focused, yet + * the window is still focused. + * + * The blur event is fired on an element when it loses the application focus. + * After this blur event, if the focus is moving away from a document, two + * additional blur events are fired on the old document and window containing + * the focus respectively. + * + * When a new document is focused, two focus events are fired on the new + * document and window respectively. Then the focus event is fired on an + * element when it gains the application focus. + * + * A special case is that the root element may be focused, yet does not + * receive the element focus and blur events. Instead a focus outline may be + * drawn around the document. + * + * Blur and focus events do not bubble as per the W3C DOM Events spec. + */ +interface nsIFocusManager : nsISupports +{ + /** + * The most active (frontmost) window, or null if no window that is part of + * the application is active. Setting the activeWindow raises it, and + * focuses the current child window's current element, if any. Setting this + * to null or to a non-top-level window throws an NS_ERROR_INVALID_ARG + * exception. + */ + attribute mozIDOMWindowProxy activeWindow; + + /** + * The child window within the activeWindow that is focused. This will + * always be activeWindow, a child window of activeWindow or null if no + * child window is focused. Setting the focusedWindow changes the focused + * window and raises the toplevel window it is in. If the current focus + * within the new focusedWindow is a frame element, then the focusedWindow + * will actually be set to the child window and the current element within + * that set as the focused element. This process repeats downwards until a + * non-frame element is found. + */ + attribute mozIDOMWindowProxy focusedWindow; + + /** + * The element that is currently focused. This will always be an element + * within the document loaded in focusedWindow or null if no element in that + * document is focused. + */ + readonly attribute nsIDOMElement focusedElement; + + /** + * Returns the method that was used to focus the element in window. This + * will either be 0, FLAG_BYMOUSE or FLAG_BYKEY. If window is null, then + * the current focusedWindow will be used by default. This has the result + * of retrieving the method that was used to focus the currently focused + * element. + */ + uint32_t getLastFocusMethod(in mozIDOMWindowProxy window); + + /** + * Changes the focused element reference within the window containing + * aElement to aElement. + */ + void setFocus(in nsIDOMElement aElement, in unsigned long aFlags); + + /** + * Move the focus to another element. If aStartElement is specified, then + * movement is done relative to aStartElement. If aStartElement is null, + * then movement is done relative to the currently focused element. If no + * element is focused, focus the first focusable element within the + * document (or the last focusable element if aType is MOVEFOCUS_END). This + * method is equivalent to setting the focusedElement to the new element. + * + * Specifying aStartElement and using MOVEFOCUS_LAST is not currently + * implemented. + * + * If no element is found, and aType is either MOVEFOCUS_ROOT or + * MOVEFOCUS_CARET, then the focus is cleared. If aType is any other value, + * the focus is not changed. + * + * Returns the element that was focused. The return value may be null if focus + * was moved into a child process. + */ + nsIDOMElement moveFocus(in mozIDOMWindowProxy aWindow, + in nsIDOMElement aStartElement, + in unsigned long aType, in unsigned long aFlags); + + /** + * Clears the focused element within aWindow. If the current focusedWindow + * is a descendant of aWindow, sets the current focusedWindow to aWindow. + * + * @throws NS_ERROR_INVALID_ARG if aWindow is null + */ + void clearFocus(in mozIDOMWindowProxy aWindow); + + /** + * Returns the currently focused element within aWindow. If aWindow is equal + * to the current value of focusedWindow, then the returned element will be + * the application-wide focused element (the value of focusedElement). The + * return value will be null if no element is focused. + * + * If aDeep is true, then child frames are traversed and the return value + * may be the element within a child descendant window that is focused. If + * aDeep if false, then the return value will be the frame element if the + * focus is in a child frame. + * + * aFocusedWindow will be set to the currently focused descendant window of + * aWindow, or to aWindow if aDeep is false. This will be set even if no + * element is focused. + * + * @throws NS_ERROR_INVALID_ARG if aWindow is null + */ + nsIDOMElement getFocusedElementForWindow(in mozIDOMWindowProxy aWindow, + in boolean aDeep, + out mozIDOMWindowProxy aFocusedWindow); + + /** + * Moves the selection caret within aWindow to the current focus. + */ + void moveCaretToFocus(in mozIDOMWindowProxy aWindow); + + /*** + * Check if given element is focusable. + */ + boolean elementIsFocusable(in nsIDOMElement aElement, in unsigned long aFlags); + + /* + * Raise the window when switching focus + */ + const unsigned long FLAG_RAISE = 1; + + /** + * Do not scroll the element to focus into view + */ + const unsigned long FLAG_NOSCROLL = 2; + + /** + * If attempting to change focus in a window that is not focused, do not + * switch focus to that window. Instead, just update the focus within that + * window and leave the application focus as is. This flag will have no + * effect if a child window is focused and an attempt is made to adjust the + * focus in an ancestor, as the frame must be switched in this case. + */ + const unsigned long FLAG_NOSWITCHFRAME = 4; + + /** + * This flag is only used when passed to moveFocus. If set, focus is never + * moved to the parent frame of the starting element's document, instead + * iterating around to the beginning of that document again. Child frames + * are navigated as normal. + */ + const unsigned long FLAG_NOPARENTFRAME = 8; + + /** + * Focus is changing due to a mouse operation, for instance the mouse was + * clicked on an element. + */ + const unsigned long FLAG_BYMOUSE = 0x1000; + + /** + * Focus is changing due to a key operation, for instance pressing the tab + * key. This flag would normally be passed when MOVEFOCUS_FORWARD or + * MOVEFOCUS_BACKWARD is used. + */ + const unsigned long FLAG_BYKEY = 0x2000; + + /** + * Focus is changing due to a call to MoveFocus. This flag will be implied + * when MoveFocus is called except when one of the other mechanisms (mouse + * or key) is specified, or when the type is MOVEFOCUS_ROOT or + * MOVEFOCUS_CARET. + */ + const unsigned long FLAG_BYMOVEFOCUS = 0x4000; + + /** + * Always show the focus ring or other indicator of focus, regardless of + * other state. + */ + const unsigned long FLAG_SHOWRING = 0x100000; + + /** + * Focus is changing due to a touch operation that generated a mouse event. + * Normally used in conjunction with FLAG_BYMOUSE. + */ + const unsigned long FLAG_BYTOUCH = 0x200000; + + // these constants are used with the aType argument to MoveFocus + + /** move focus forward one element, used when pressing TAB */ + const unsigned long MOVEFOCUS_FORWARD = 1; + /** move focus backward one element, used when pressing Shift+TAB */ + const unsigned long MOVEFOCUS_BACKWARD = 2; + /** move focus forward to the next frame document, used when pressing F6 */ + const unsigned long MOVEFOCUS_FORWARDDOC = 3; + /** move focus forward to the previous frame document, used when pressing Shift+F6 */ + const unsigned long MOVEFOCUS_BACKWARDDOC = 4; + /** move focus to the first focusable element */ + const unsigned long MOVEFOCUS_FIRST = 5; + /** move focus to the last focusable element */ + const unsigned long MOVEFOCUS_LAST = 6; + /** move focus to the root element in the document */ + const unsigned long MOVEFOCUS_ROOT = 7; + /** move focus to a link at the position of the caret. This is a special value used to + * focus links as the caret moves over them in caret browsing mode. + */ + const unsigned long MOVEFOCUS_CARET = 8; + + /** move focus to the first focusable document */ + const unsigned long MOVEFOCUS_FIRSTDOC = 9; + /** move focus to the last focusable document */ + const unsigned long MOVEFOCUS_LASTDOC = 10; + + /** + * Called when a window has been raised. + */ + [noscript] void windowRaised(in mozIDOMWindowProxy aWindow); + + /** + * Called when a window has been lowered. + */ + [noscript] void windowLowered(in mozIDOMWindowProxy aWindow); + + /** + * Called when a new document in a window is shown. + * + * If aNeedsFocus is true, then focus events are expected to be fired on the + * window if this window is in the focused window chain. + */ + [noscript] void windowShown(in mozIDOMWindowProxy aWindow, + in boolean aNeedsFocus); + + /** + * Called when a document in a window has been hidden or otherwise can no + * longer accept focus. + */ + [noscript] void windowHidden(in mozIDOMWindowProxy aWindow); + + /** + * Fire any events that have been delayed due to synchronized actions. + */ + [noscript] void fireDelayedEvents(in nsIDocument aDocument); + + /** + * Indicate that a plugin wishes to take the focus. This is similar to a + * normal focus except that the widget focus is not changed. Updating the + * widget focus state is the responsibility of the caller. + */ + [noscript] void focusPlugin(in nsIContent aPlugin); + + /** + * Used in a child process to indicate that the parent window is now + * active or deactive. + */ + [noscript] void parentActivated(in mozIDOMWindowProxy aWindow, + in bool active); +}; diff --git a/dom/interfaces/base/nsIIdleObserver.idl b/dom/interfaces/base/nsIIdleObserver.idl new file mode 100644 index 000000000..e7a31c319 --- /dev/null +++ b/dom/interfaces/base/nsIIdleObserver.idl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(37916e05-e062-4f72-96d5-660cfb55e9b6)] +interface nsIIdleObserver : nsISupports +{ + // Time is in seconds and is read only when idle observers are added + // and removed. + readonly attribute unsigned long time; + void onidle(); + void onactive(); +}; diff --git a/dom/interfaces/base/nsIQueryContentEventResult.idl b/dom/interfaces/base/nsIQueryContentEventResult.idl new file mode 100644 index 000000000..cdf328535 --- /dev/null +++ b/dom/interfaces/base/nsIQueryContentEventResult.idl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * The result of query content events. succeeded propery can be used always. + * Whether other properties can be used or not depends on the event. + * See nsIDOMWindowUtils.idl, which properites can be used was documented. + */ + +[scriptable, uuid(e2c39e0e-345f-451a-a7b2-e0230d555847)] +interface nsIQueryContentEventResult : nsISupports +{ + readonly attribute unsigned long offset; + readonly attribute unsigned long tentativeCaretOffset; + readonly attribute boolean reversed; + + readonly attribute long left; + readonly attribute long top; + readonly attribute long width; + readonly attribute long height; + readonly attribute AString text; + + void getCharacterRect(in long offset, + out long left, out long top, + out long width, out long height); + + readonly attribute boolean succeeded; + readonly attribute boolean notFound; + readonly attribute boolean tentativeCaretOffsetNotFound; +}; diff --git a/dom/interfaces/base/nsIRemoteBrowser.idl b/dom/interfaces/base/nsIRemoteBrowser.idl new file mode 100644 index 000000000..25ab5d737 --- /dev/null +++ b/dom/interfaces/base/nsIRemoteBrowser.idl @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(C8379366-F79F-4D25-89A6-22BEC0A93D16)] +interface nsIRemoteBrowser : nsISupports +{ + /* + * Called by the child to inform the parent that a command update has occurred + * and the supplied set of commands are now enabled and disabled. + * + * @param action command updater action + * @param enabledLength length of enabledCommands array + * @param enabledCommands commands to enable + * @param disabledLength length of disabledCommands array + * @param disabledCommand commands to disable + */ + void enableDisableCommands(in AString action, + in unsigned long enabledLength, + [array, size_is(enabledLength)] in string enabledCommands, + in unsigned long disabledLength, + [array, size_is(disabledLength)] in string disabledCommands); +}; diff --git a/dom/interfaces/base/nsIServiceWorkerManager.idl b/dom/interfaces/base/nsIServiceWorkerManager.idl new file mode 100644 index 000000000..794a740d5 --- /dev/null +++ b/dom/interfaces/base/nsIServiceWorkerManager.idl @@ -0,0 +1,227 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface mozIDOMWindow; +interface nsPIDOMWindowInner; +interface mozIDOMWindowProxy; +interface nsIArray; +interface nsIDocument; +interface nsIInterceptedChannel; +interface nsIPrincipal; +interface nsIRunnable; +interface nsIURI; + +[scriptable, uuid(52ee2c9d-ee87-4caf-9588-23ae77ff8798)] +interface nsIServiceWorkerUnregisterCallback : nsISupports +{ + // aState is true if the unregistration succeded. + // It's false if this ServiceWorkerRegistration doesn't exist. + void unregisterSucceeded(in bool aState); + void unregisterFailed(); +}; + +interface nsIWorkerDebugger; + +[scriptable, builtinclass, uuid(76e357ed-208d-4e4c-9165-1c4059707879)] +interface nsIServiceWorkerInfo : nsISupports +{ + // State values below should match the ServiceWorkerState enumeration. + const unsigned short STATE_INSTALLING = 0; + const unsigned short STATE_INSTALLED = 1; + const unsigned short STATE_ACTIVATING = 2; + const unsigned short STATE_ACTIVATED = 3; + const unsigned short STATE_REDUNDANT = 4; + const unsigned short STATE_UNKNOWN = 5; + + readonly attribute DOMString scriptSpec; + readonly attribute DOMString cacheName; + + readonly attribute unsigned short state; + + readonly attribute nsIWorkerDebugger debugger; + + void attachDebugger(); + + void detachDebugger(); +}; + +[scriptable, uuid(87e63548-d440-4b8a-b158-65ad1de0211E)] +interface nsIServiceWorkerRegistrationInfoListener : nsISupports +{ + void onChange(); +}; + +[scriptable, builtinclass, uuid(ddbc1fd4-2f2e-4fca-a395-6e010bbedfe3)] +interface nsIServiceWorkerRegistrationInfo : nsISupports +{ + readonly attribute nsIPrincipal principal; + + readonly attribute DOMString scope; + readonly attribute DOMString scriptSpec; + + readonly attribute nsIServiceWorkerInfo installingWorker; + readonly attribute nsIServiceWorkerInfo waitingWorker; + readonly attribute nsIServiceWorkerInfo activeWorker; + + // Allows to get the related nsIServiceWorkerInfo for a given + // nsIWorkerDebugger. Over time we shouldn't need this anymore, + // and instead always control then nsIWorkerDebugger from + // nsIServiceWorkerInfo and not the other way around. Returns + // null if the service worker is no longer registered. + nsIServiceWorkerInfo getWorkerByID(in unsigned long long aID); + + void addListener(in nsIServiceWorkerRegistrationInfoListener listener); + + void removeListener(in nsIServiceWorkerRegistrationInfoListener listener); +}; + +[scriptable, uuid(9e523e7c-ad6f-4df0-8077-c74aebbc679d)] +interface nsIServiceWorkerManagerListener : nsISupports +{ + void onRegister(in nsIServiceWorkerRegistrationInfo aInfo); + + void onUnregister(in nsIServiceWorkerRegistrationInfo aInfo); +}; + +[scriptable, builtinclass, uuid(7404c8e8-4d47-4449-8ed1-47d1261d4e33)] +interface nsIServiceWorkerManager : nsISupports +{ + /** + * Registers a ServiceWorker with script loaded from `aScriptURI` to act as + * the ServiceWorker for aScope. Requires a valid entry settings object on + * the stack. This means you must call this from content code 'within' + * a window. + * + * Returns a Promise. + */ + nsISupports register(in mozIDOMWindow aWindow, in nsIURI aScope, in nsIURI aScriptURI); + + /** + * Unregister an existing ServiceWorker registration for `aScope`. + * It keeps aCallback alive until the operation is concluded. + */ + void unregister(in nsIPrincipal aPrincipal, + in nsIServiceWorkerUnregisterCallback aCallback, + in DOMString aScope); + + // Returns a Promise + nsISupports getRegistrations(in mozIDOMWindow aWindow); + + // Returns a Promise + nsISupports getRegistration(in mozIDOMWindow aWindow, in DOMString aScope); + + // Returns a Promise + nsISupports getReadyPromise(in mozIDOMWindow aWindow); + + // Remove ready pending Promise + void removeReadyPromise(in mozIDOMWindow aWindow); + + nsIServiceWorkerRegistrationInfo getRegistrationByPrincipal(in nsIPrincipal aPrincipal, + in DOMString aScope); + + /** + * Call this to request that document `aDoc` be controlled by a ServiceWorker + * if a registration exists for it's scope. + * + * This MUST only be called once per document! + */ + [notxpcom,nostdcall] void MaybeStartControlling(in nsIDocument aDoc, in DOMString aDocumentId); + + /** + * Documents that have called MaybeStartControlling() should call this when + * they are destroyed. This function may be called multiple times, and is + * idempotent. + */ + [notxpcom,nostdcall] void MaybeStopControlling(in nsIDocument aDoc); + + /* + * Returns a ServiceWorker. + * window is the window of the caller. scope is the registration's scope and must be + * a valid entry that window is allowed to load, otherwise this will return nullptr. + * These are only meant to be called from ServiceWorkerRegistration instances. + */ + [noscript] nsISupports GetInstalling(in nsPIDOMWindowInner aWindow, in DOMString aScope); + [noscript] nsISupports GetWaiting(in nsPIDOMWindowInner aWindow, in DOMString aScope); + [noscript] nsISupports GetActive(in nsPIDOMWindowInner aWindow, in DOMString aScope); + + /* + * Returns a ServiceWorker object representing the active worker controlling this + * window. + */ + [noscript] nsISupports GetDocumentController(in nsPIDOMWindowInner aWindow); + + /* + * Clears ServiceWorker registrations from memory and disk for the specified + * host. + * - All ServiceWorker instances change their state to redundant. + * - Existing ServiceWorker instances handling fetches will keep running. + * - All documents will immediately stop being controlled. + * - Unregister jobs will be queued for all registrations. + * This eventually results in the registration being deleted from disk too. + */ + void removeAndPropagate(in AUTF8String aHost); + + // Testing + DOMString getScopeForUrl(in nsIPrincipal aPrincipal, in DOMString aPath); + + // Note: This is meant to be used only by about:serviceworkers. + // It returns an array of nsIServiceWorkerRegistrationInfos. + nsIArray getAllRegistrations(); + + // Note: This is meant to be used only by about:serviceworkers. + // It calls softUpdate() for each child process. + [implicit_jscontext] void propagateSoftUpdate(in jsval aOriginAttributes, + in DOMString aScope); + + // Note: This is meant to be used only by about:serviceworkers. + // It calls unregister() in each child process. The callback is used to + // inform when unregister() is completed on the current process. + void propagateUnregister(in nsIPrincipal aPrincipal, + in nsIServiceWorkerUnregisterCallback aCallback, + in DOMString aScope); + + void sendNotificationClickEvent(in ACString aOriginSuffix, + in ACString scope, + in AString aID, + in AString aTitle, + in AString aDir, + in AString aLang, + in AString aBody, + in AString aTag, + in AString aIcon, + in AString aData, + in AString aBehavior); + + void sendNotificationCloseEvent(in ACString aOriginSuffix, + in ACString scope, + in AString aID, + in AString aTitle, + in AString aDir, + in AString aLang, + in AString aBody, + in AString aTag, + in AString aIcon, + in AString aData, + in AString aBehavior); + + [optional_argc] void sendPushEvent(in ACString aOriginAttributes, + in ACString aScope, + [optional] in uint32_t aDataLength, + [optional, array, size_is(aDataLength)] in uint8_t aDataBytes); + void sendPushSubscriptionChangeEvent(in ACString aOriginAttributes, + in ACString scope); + + void addListener(in nsIServiceWorkerManagerListener aListener); + + void removeListener(in nsIServiceWorkerManagerListener aListener); + + bool shouldReportToWindow(in mozIDOMWindowProxy aWindow, in ACString aScope); +}; + +%{ C++ +#define SERVICEWORKERMANAGER_CONTRACTID "@mozilla.org/serviceworkers/manager;1" +%} diff --git a/dom/interfaces/base/nsIStructuredCloneContainer.idl b/dom/interfaces/base/nsIStructuredCloneContainer.idl new file mode 100644 index 000000000..23f11c714 --- /dev/null +++ b/dom/interfaces/base/nsIStructuredCloneContainer.idl @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: set ts=8 sw=2 et tw=80: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIVariant; +interface nsIDocument; + +%{C++ +#include "js/TypeDecls.h" +%} + +/** + * This interface acts as a container for an object serialized using the + * structured clone algorithm. + * + * You can copy an object into an nsIStructuredCloneContainer using + * initFromJSVal or initFromBase64. It's an error to initialize an + * nsIStructuredCloneContainer more than once. + * + * Once you've initialized the container, you can get a copy of the object it + * stores by calling deserializeToVariant. You can also get a base-64-encoded + * string containing a copy of the container's serialized data, using + * getDataAsBase64. + */ +[scriptable, uuid(c664aae7-0d67-4155-a2dd-a3861778626f)] +interface nsIStructuredCloneContainer : nsISupports +{ + /** + * Initialize this structured clone container so it contains a clone of the + * given jsval. + */ + [noscript, implicit_jscontext] + void initFromJSVal(in jsval aData); + + /** + * Initialize this structured clone container from a base-64-encoded byte + * stream, stored in aData. aFormatVersion should be the version of the + * structured clone algorithm which was used to generate aData. + */ + void initFromBase64(in AString aData, in unsigned long aFormatVersion); + + /** + * Deserializes this structured clone container returning it as a jsval. + * Can be called on main and worker threads. + */ + [implicit_jscontext] + jsval deserializeToJsval(); + + /** + * Deserialize the object this container holds, returning it wrapped as + * an nsIVariant. + * Main thread only! + */ + [implicit_jscontext] + nsIVariant deserializeToVariant(); + + /** + * Get this structured clone container's data as a base-64-encoded string. + */ + AString getDataAsBase64(); + + /** + * Get the size in bytes of this container's serialized data. + */ + readonly attribute unsigned long long serializedNBytes; + + /** + * Get the version of the structured clone algorithm which was used to + * generate this container's serialized buffer. + */ + readonly attribute unsigned long formatVersion; +}; diff --git a/dom/interfaces/base/nsITabChild.idl b/dom/interfaces/base/nsITabChild.idl new file mode 100644 index 000000000..cf3d0bfd6 --- /dev/null +++ b/dom/interfaces/base/nsITabChild.idl @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" +#include "nsIDroppedLinkHandler.idl" + +interface nsIContentFrameMessageManager; +interface nsIWebBrowserChrome3; + +native CommandsArray(nsTArray<nsCString>); +[ref] native CommandsArrayRef(nsTArray<nsCString>); + +[scriptable, uuid(1fb79c27-e760-4088-b19c-1ce3673ec24e)] +interface nsITabChild : nsISupports +{ + readonly attribute nsIContentFrameMessageManager messageManager; + + attribute nsIWebBrowserChrome3 webBrowserChrome; + + [notxpcom] void sendRequestFocus(in boolean canFocus); + + [notxpcom] void sendGetTabCount(out uint32_t tabCount); + + [noscript, notxpcom] void enableDisableCommands(in AString action, + in CommandsArrayRef enabledCommands, + in CommandsArrayRef disabledCommands); + + [noscript] void remoteSizeShellTo(in int32_t width, in int32_t height, + in int32_t shellItemWidth, in int32_t shellItemHeight); + + [noscript] void remoteDropLinks(in unsigned long linksCount, + [array, size_is(linksCount)] in nsIDroppedLinkItem links); + + readonly attribute uint64_t tabId; +}; + diff --git a/dom/interfaces/base/nsITabParent.idl b/dom/interfaces/base/nsITabParent.idl new file mode 100644 index 000000000..5b03c9070 --- /dev/null +++ b/dom/interfaces/base/nsITabParent.idl @@ -0,0 +1,59 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" + +[builtinclass, scriptable, uuid(8e49f7b0-1f98-4939-bf91-e9c39cd56434)] +interface nsITabParent : nsISupports +{ + void getChildProcessOffset(out int32_t aCssX, out int32_t aCssY); + + readonly attribute boolean useAsyncPanZoom; + + /** + * Manages the docshell active state of the remote browser. + */ + attribute boolean docShellIsActive; + + /** + * Whether this tabParent is in prerender mode. + */ + [infallible] readonly attribute boolean isPrerendered; + + /** + * As an optimisation, setting the docshell's active state to + * inactive also triggers a layer invalidation to free up some + * potentially unhelpful memory usage. Calling preserveLayers + * will cause the layers to be preserved even for inactive + * docshells. + */ + void preserveLayers(in boolean aPreserveLayers); + + /** + * During interactions where painting performance + * is more important than scrolling, we may temporarily + * suppress the displayport. Each enable called must be matched + * with a disable call. + */ + void suppressDisplayport(in bool aEnabled); + + readonly attribute uint64_t tabId; + + /** + * The OS level process Id of the related child process. + */ + readonly attribute int32_t osPid; + + /** + * Navigate by key. If aForDocumentNavigation is true, navigate by document. + * If aForDocumentNavigation is false, navigate by element. + * + * If aForward is true, navigate to the first focusable element or document. + * If aForward is false, navigate to the last focusable element or document. + */ + void navigateByKey(in bool aForward, in bool aForDocumentNavigation); + + readonly attribute boolean hasContentOpener; +}; diff --git a/dom/interfaces/base/nsITextInputProcessor.idl b/dom/interfaces/base/nsITextInputProcessor.idl new file mode 100644 index 000000000..2ba6b1ecc --- /dev/null +++ b/dom/interfaces/base/nsITextInputProcessor.idl @@ -0,0 +1,589 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMKeyEvent; +interface mozIDOMWindow; +interface nsITextInputProcessorCallback; + +/** + * An nsITextInputProcessor instance is associated with a top level widget which + * handles native IME. It's associated by calling beginInputTransaction() or + * beginInputTransactionForTests(). While an instance has composition, nobody + * can steal the rights to make composition on the top level widget. In other + * words, if another instance is composing on a top level widget, either + * beginInputTransaction() or beginInputTransactionForTests() returns false + * (i.e., not throws an exception). + * + * NOTE: See nsITextInputProcessorCallback.idl for examples of |callback| in + * following examples, + * + * Example #1 JS-IME can start composition like this: + * + * var TIP = Components.classes["@mozilla.org/text-input-processor;1"]. + * createInstance(Components.interfaces.nsITextInputProcessor); + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to make composition + * } + * // Create a keyboard event if the following compositionc change is caused + * // by a key event. + * var keyEvent = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // Set new composition string first + * TIP.setPendingCompositionString("some-words-are-inputted"); + * // Set clause information. + * TIP.appendClauseToPendingComposition(23, TIP.ATTR_RAW_CLAUSE); + * // Set caret position, this is optional. + * TIP.setCaretInPendingComposition(23); + * // Flush the pending composition + * if (!TIP.flushPendingComposition(keyEvent)) { + * // If it returns false, it fails to start composition. + * return; + * } + * + * Example #2 JS-IME can separate composition string to two or more clauses: + * + * // Create a keyboard event if the following compositionc change is caused + * // by a key event. + * var keyEvent = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // First, set composition string again + * TIP.setPendingCompositionString("some-words-are-inputted"); + * // Then, if "are" is selected to convert, there are 3 clauses: + * TIP.appendClauseToPendingComposition(11, TIP.ATTR_CONVERTED_CLAUSE); + * TIP.appendClauseToPendingComposition(3, TIP.ATTR_SELECTED_CLAUSE); + * TIP.appendClauseToPendingComposition(9, TIP.ATTR_CONVERTED_CLAUSE); + * // Show caret at the beginning of the selected clause + * TIP.setCaretInPendingComposition(11); + * // Flush the pending composition. Note that if there is a composition, + * // flushPendingComposition() won't return false. + * TIP.flushPendingComposition(keyEvent); + * + * Example #3 JS-IME can commit composition with specific string with this: + * + * // Create a keyboard event if the following compositionc change is caused + * // by a key event. + * var keyEvent1 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // First, there is a composition. + * TIP.setPendingCompositionString("some-words-directly-inputted"); + * TIP.appendClauseToPendingComposition(28, TIP.ATTR_RAW_CLAUSE); + * TIP.flushPendingComposition(keyEvent1); + * // Create a keyboard event if the following commit composition is caused + * // by a key event. + * var keyEvent2 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // This is useful when user selects a commit string from candidate list UI + * // which is provided by JS-IME. + * TIP.commitCompositionWith("selected-words-from-candidate-list", keyEvent2); + * + * Example #4 JS-IME can commit composition with the last composition string + * without specifying commit string: + * + * // Create a keyboard event if the following compositionc change is caused + * // by a key event. + * var keyEvent1 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // First, there is a composition. + * TIP.setPendingCompositionString("some-words-will-be-commited"); + * TIP.appendClauseToPendingComposition(27, TIP.ATTR_RAW_CLAUSE); + * TIP.flushPendingComposition(keyEvent1); + * // Create a keyboard event if the following commit is caused by a key + * // event. + * var keyEvent2 = + * new KeyboardEvent("", { key: "Enter", code: "Enter", + keyCode: KeyboardEvent.DOM_VK_RETURN }); + * // This is useful when user just type Enter key. + * TIP.commitComposition(keyEvent2); + * + * Example #5 JS-IME can cancel composition with this: + * + * // Create a keyboard event if the following composition change is caused + * // by a key event. + * var keyEvent1 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // First, there is a composition. + * TIP.setPendingCompositionString("some-words-will-be-canceled"); + * TIP.appendClauseToPendingComposition(27, TIP.ATTR_RAW_CLAUSE); + * TIP.flushPendingComposition(keyEvent1); + * // Create a keyboard event if the following canceling composition is + * // caused by a key event. + * var keyEvent2 = + * new KeyboardEvent("", { key: "Escape", code: "Escape", + keyCode: KeyboardEvent.DOM_VK_ESCAPE }); + * // This is useful when user doesn't want to commit the composition. + * // FYI: This is same as TIP.commitCompositionWith("") for now. + * TIP.cancelComposition(keyEvent2); + * + * Example #6 JS-IME can insert text only with commitCompositionWith(): + * + * // Create a keyboard event if the following inserting text is caused by a + * // key event. + * var keyEvent1 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to make composition + * } + * TIP.commitCompositionWith("Some words", keyEvent1); + * + * Example #7 JS-IME can start composition explicitly: + * + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to make composition + * } + * // Create a keyboard event if the following starting composition is caused + * // by a key event. + * var keyEvent1 = + * new KeyboardEvent("", { key: "foo", code: "bar", keyCode: buzz }); + * // If JS-IME don't want to show composing string in the focused editor, + * // JS-IME can dispatch only compositionstart event with this. + * if (!TIP.startComposition(keyEvent1)) { + * // Failed to start composition. + * return; + * } + * // And when user selects a result from UI of JS-IME, commit with it. + * // Then, the key event should be null. + * TIP.commitCompositionWith("selected-words"); + * + * Example #8 JS-IME or JS-Keyboard should dispatch key events even during + * composition (non-printable key case): + * + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to dispatch key events + * } + * + * // You don't need to specify .keyCode value if it's non-printable key + * // because it can be computed from .key value. + * // If you specify non-zero value to .keyCode, it'll be used. + * var keyEvent = new KeyboardEvent("", { code: "Enter", key: "Enter" }); + * if (TIP.keydown(keyEvent)) { + * // Handle its default action + * } + * + * // Even if keydown event was consumed, keyup event should be dispatched. + * if (TIP.keyup(keyEvent)) { + * // Handle its default action + * } + * + * Example #9 JS-IME or JS-Keyboard should dispatch key events even during + * composition (printable key case): + * + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to dispatch key events + * } + * + * // You need to specify .keyCode value if it's printable key. + * // The rules of .keyCode value is documented in MDN: + * // https://developer.mozilla.org/docs/Web/API/KeyboardEvent.keyCode + * // + * // #1 If the key location is DOM_KEY_LOCATION_NUMPAD and NumLock is + * // active, you should specify DOM_VK_NUMPAD[0-9], DOM_VK_MULTIPLY, + * // DOM_VK_ADD, DOM_VK_SEPARATOR, DOM_VK_SUBTRACT, DOM_VK_DECIMAL or + * // DOM_VK_DIVIDE. + * // #2 If the key is Spacebar, use DOM_VK_SPACE. + * // + * // Following rules are printable keys in DOM_KEY_LOCATION_STANDARD. + * // .keyCode value for a key shouldn't be changed by modifier states: + * // #1 If the key can input [0-9] with any modifier state (except + * // NumLock state), the value should be DOM_VK_[0-9]. + * // #2 Otherwise, and if the key inputs an ASCII alphabet with no + * // active modifiers, use DOM_VK_[A-Z]. + * // #3 Otherwise, and if the key inputs an ASCII alphabet with no + * // active modifiers except Shift key state, use DOM_VK_[A-Z] for + * // the shifted character. E.g., if a key causes non-alphabet + * // character such as "@" or a Unicode character without Shift key + * // but "a" is inputted when Shift key is pressed, the proper + * // keyCode is DOM_VK_A. + * // #4 Otherwise, and if the key inputs another ASCII character with + * // no modifier states, use a proper value for the character. E.g., + * // if the key inputs "*" without Shift key state, it should be + * // DOM_VK_ASTERISK. + * // #5 Otherwise, and if the key inputs another ASCII character with + * // Shift key state, use a proper value for the character. E.g., + * // if a key causes a Unicode character without Shift key but "&" + * // is inputted when Shift key is pressed, the proper keyCode is + * // DOM_VK_AMPERSAND. + * // See above document for the other cases. + * // + * // NOTE: If the software keyboard is 10-key like simple phone, + * // We don't have common rules to decide its .keyCode value. + * // Above rules should be used when the JS-Keyboard emulates PC + * // keyboard. + * // .key value should be inputting character by the key with current + * // modifier state. + * // .code value should be empty string if the JS-Keyboard isn't emulating + * // physical keyboard. Otherwise, use same value with physical keyboard's + * // same key. + * var keyEvent = new KeyboardEvent("", { code: "KeyA", key: "a", + * keyCode: KeyboardEvent.DOM_VK_A }); + * if (TIP.keydown(keyEvent)) { + * // Handle its default action + * } + * + * // Even if keydown event was consumed, keyup event should be dispatched. + * if (TIP.keyup(keyEvent)) { + * // Handle its default action + * } + * + * Example #10 JS-Keyboard doesn't need to initialize modifier states at + * calling either keydown() or keyup(). + * + * // Neither beginInputTransaction() nor beginInputTransactionForTests() + * // resets modifier state. + * if (!TIP.beginInputTransaction(window, callback)) { + * return; // You failed to get the rights to dispatch key events + * } + * + * var leftShift = new KeyboardEvent("", { code: "ShiftLeft", key: "Shift" }); + * + * // This causes following key events will be shifted automatically. + * TIP.keydown(leftShift); + * + * var rightShift = + * new KeyboardEvent("", { code: "ShiftRight", key: "Shift" }); + * + * TIP.keydown(rightShift); + * + * // keyup of one of shift key doesn't cause inactivating "Shift" state. + * TIP.keyup(rightShift); + * + * // This causes inactivating "Shift" state completely. + * TIP.keyup(leftShift); + */ + +[scriptable, builtinclass, uuid(47ae2181-2e98-4d58-84a2-b8db6764ce9a)] +interface nsITextInputProcessor : nsISupports +{ + /** + * Returns true if this instance was dispatched compositionstart but hasn't + * dispatched compositionend yet. + */ + readonly attribute boolean hasComposition; + + /** + * When you create an instance, you must call beginInputTransaction() first + * except when you created the instance for automated tests. + * + * @param aWindow A DOM window. The instance will look for a top + * level widget from this. + * @param aCallback Callback interface which handles requests to + * IME and notifications to IME. This must not be + * null. + * @return If somebody uses internal text input service for a + * composition, this returns false. Otherwise, returns + * true. I.e., only your TIP can create composition + * when this returns true. If this returns false, + * your TIP should wait next chance. + */ + boolean beginInputTransaction(in mozIDOMWindow aWindow, + in nsITextInputProcessorCallback aCallback); + + /** + * When you create an instance for automated test, you must call + * beginInputTransaction(), first. See beginInputTransaction() for more + * detail of this. + * Note that aCallback can be null. If it's null, nsITextInputProcessor + * implementation will handle them automatically. + */ + [optional_argc] boolean + beginInputTransactionForTests( + in mozIDOMWindow aWindow, + [optional] in nsITextInputProcessorCallback aCallback); + + /** + * startComposition() dispatches compositionstart event explicitly. + * IME does NOT need to call this typically since compositionstart event + * is automatically dispatched by sendPendingComposition() if + * compositionstart event hasn't been dispatched yet. If this is called + * when compositionstart has already been dispatched, this throws an + * exception. + * + * @param aKeyboardEvent Key event which causes starting composition. + * If its type value is "keydown", this method + * dispatches only keydown event first. Otherwise, + * dispatches keydown first and keyup at last. + * @param aKeyFlags See KEY_* constants. + * @return Returns true if composition starts normally. + * Otherwise, returns false because it might be + * canceled by the web application. + */ + [optional_argc] + boolean startComposition([optional] in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * Set new composition string. Pending composition will be flushed by + * a call of flushPendingComposition(). However, if the new composition + * string isn't empty, you need to call appendClauseToPendingComposition() to + * fill all characters of aString with one or more clauses before flushing. + * Note that if you need to commit or cancel composition, use + * commitComposition(), commitCompositionWith() or cancelComposition(). + */ + void setPendingCompositionString(in DOMString aString); + + // ATTR_RAW_CLAUSE means that the clause hasn't been selected nor converted + // yet. + const unsigned long ATTR_RAW_CLAUSE = 0x02; + // ATTR_SELECTED_RAW_CLAUSE means that the clause hasn't been converted yet + // but is selected for converting to the other string. + const unsigned long ATTR_SELECTED_RAW_CLAUSE = 0x03; + // ATTR_CONVERTED_CLAUSE means that the clause has already been converted but + // is not selected. This does NOT mean that this clause isn't modifiable. + const unsigned long ATTR_CONVERTED_CLAUSE = 0x04; + // ATTR_SELECTED_CLAUSE means that the clause has already been converted and + // is selected. In other words, the clause is being converted. + const unsigned long ATTR_SELECTED_CLAUSE = 0x05; + + /** + * Append a clause to the pending composition. + * + * If you need to fill the pending composition string with a clause, you + * should call this once. For example: + * appendClauseToPendingComposition(compositionString.length, + * ATTR_RAW_CLAUSE); + * is enough. If you need to separate the pending composition string to + * multiple clauses, you need to call this multiple times. For example, + * if your pending composition string has three clauses and the second clause + * is being converted: + * appendClauseToPendingComposition(firstClauseLength, + * ATTR_CONVERTED_CLAUSE); + * appendClauseToPendingComposition(secondClauseLength, + * ATTR_SELECTED_CLAUSE); + * appendClauseToPendingComposition(thirdClauseLength, + * ATTR_CONVERTED_CLAUSE); + * Note that if sum of aLength mismatches length of the pending composition + * string, flushPendingComposition() will throw an exception. I.e., + * |firstClauseLength + secondClauseLength + thirdClauseLength| must be + * same as the length of pending composition string. + * + * TODO: Should be able to specify custom clause style. + * + * @param aLength Length of the clause. + * @param aAttribute One of ATTR_* constants. + */ + void appendClauseToPendingComposition(in unsigned long aLength, + in unsigned long aAttribute); + + /** + * Set caret offset in the pending composition string. If you don't need to + * show a caret, you don't need to call this. + * + * @param aOffset Caret offset in the pending composition string. + * This must be between 0 and length of the pending + * composition string. + */ + void setCaretInPendingComposition(in unsigned long aOffset); + + /** + * flushPendingComposition() must be called after + * setPendingCompositionString() and appendClauseToPendingComposition() + * (setCaretInPendingComposition() is optional) are called. + * + * Note that compositionstart will be automatically dispatched if this is + * called when there is no composition. + * + * Note that if sum of lengths of appended clauses are not same as composition + * string or caret offset is larger than the composition string length, this + * throws an exception. + * + * @param aKeyboardEvent Key event which causes the composition string. + * If its type value is "keydown", this method + * dispatches only keydown event first. Otherwise, + * dispatches keydown first and keyup at last. + * @param aKeyFlags See KEY_* constants. + * @return Returns true if there is a composition already or + * starting composition automatically. + * Otherwise, i.e., if it cannot start composition + * automatically, e.g., canceled by web apps, returns + * false. + */ + [optional_argc] + boolean flushPendingComposition( + [optional] in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * commitComposition() will commit composition with the last composition + * string. If there is no composition, this will throw an exception. + * + * @param aKeyboardEvent Key event which causes the commit composition. + * If its type value is "keydown", this method + * dispatches only keydown event first. Otherwise, + * dispatches keydown first and keyup at last. + * @param aKeyFlags See KEY_* constants. + */ + [optional_argc] + void commitComposition([optional] in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * commitCompositionWith() will commit composition with the specific string. + * If there is no composition, this will start composition and commit it + * with the specified string. + * + * @param aCommitString The string to be committed. + * @param aKeyboardEvent Key event which causes the commit composition. + * If its type value is "keydown", this method + * dispatches only keydown event first. Otherwise, + * dispatches keydown first and keyup at last. + * @param aKeyFlags See KEY_* constants. + * @return Returns true if there is a composition already or + * starting composition automatically. + * Otherwise, i.e., if it cannot start composition + * automatically, e.g., canceled by web apps, returns + * false. + */ + [optional_argc] + boolean commitCompositionWith(in DOMString aCommitString, + [optional] in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * cancelComposition() will cancel composition. This is for now the same as + * calling commitComposition(""). However, in the future, this might work + * better. If your IME needs to cancel composition, use this instead of + * commitComposition(). + * + * Note that if you tries to cancel composition when there is no composition, + * this throws an exception. + * + * @param aKeyboardEvent Key event which causes the canceling composition. + * If its type value is "keydown", this method + * dispatches only keydown event first. Otherwise, + * dispatches keydown first and keyup at last. + * @param aKeyFlags See KEY_* constants. + */ + [optional_argc] + void cancelComposition([optional] in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + // Specifying KEY_DEFAULT_PREVENTED can dispatch key events whose + // defaultPrevented are true. Note that if this is specified, keypress event + // won't be fired. + const unsigned long KEY_DEFAULT_PREVENTED = 0x00000001; + // If KEY_NON_PRINTABLE_KEY is specified and the .key value isn't valid + // key name, the methods will throws an exception. In other words, this + // flag prevents to dispatch key events with wrong key values and to cause + // such key events input the key values as text. + const unsigned long KEY_NON_PRINTABLE_KEY = 0x00000002; + // If KEY_FORCE_PRINTABLE_KEY is specified and even if the .key value is a + // registered key name, it's treated as inputting text value. + const unsigned long KEY_FORCE_PRINTABLE_KEY = 0x00000004; + // If KEY_KEEP_KEY_LOCATION_STANDARD is specified when its .location is not + // initialized or initialized with 0, the value isn't computed with .code + // value. Note that if .location is initialized with non-zero value, + // this flag causes throwing an exception. + // NOTE: This is not recommended to use except for tests. + const unsigned long KEY_KEEP_KEY_LOCATION_STANDARD = 0x00000008; + // If KEY_KEEP_KEYCODE_ZERO is specified when its .keyCode is not initialized + // or initialized with 0, the value isn't computed with .key value when it + // represents non-printable key. Note that if .keyCode is initialized with + // non-zero value, this flag causes throwing an exception. + const unsigned long KEY_KEEP_KEYCODE_ZERO = 0x00000010; + // If KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT is specified when the key event is + // a modifier key's, keydown() and keyup() only modifies its modifier state + // without dispatching key events. This is useful for testing odd behavior + // or emulating legacy API behavior. + const unsigned long KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT = 0x00000020; + + // These values can be used to do bitwise operation with the return value of + // the keydown() method. + const unsigned long KEYEVENT_NOT_CONSUMED = 0x00000000; + const unsigned long KEYDOWN_IS_CONSUMED = 0x00000001; + const unsigned long KEYPRESS_IS_CONSUMED = 0x00000002; + + /** + * keydown() may dispatch a keydown event and some keypress events if + * preceding keydown event isn't consumed and they are necessary. + * Note that even if this is called during composition, key events may not + * be dispatched. In this case, this returns false. + * + * You should initialize at least .key value and .code value of the event. + * Additionally, if you try to emulate a printable key, .keyCode value should + * be specified if there is proper key value. See the comment of above + * example how to decide .keyCode value of a printable key. On the other + * hand, .keyCode value is automatically computed when you try to emulate + * non-printable key. However, if you try to emulate physical keyboard of + * desktop platform, you need to specify proper value explicitly because + * the mapping table of this API isn't enough to emulate the behavior of + * Gecko for desktop platforms. + * + * NOTE: Even if this has composition, JS-Keyboard should call keydown() and + * keyup(). Although, with the default preferences and normal + * conditions, DOM key events won't be fired during composition. + * However, they MAY be dispatched for some reasons, e.g., the web + * content listens only key events, or if the standard DOM event spec + * will be changed in the future. + * + * @param aKeyboardEvent Must be a keyboard event which should be dispatched + * as a keydown event and keypress events. + * #1 Note that you don't need to set charCode value + * because it's computed from its key value. + * #2 If code value is set properly and location value + * isn't specified (i.e., 0), the location value will + * be guessed from the code value. + * #3 Non-defined code names are not allowed. If your + * key isn't registered, file a bug. If your key isn't + * defined by any standards, use "" (empty string). + * #4 .keyCode is guessed from .key value if the key + * name is registered and .keyCode isn't initialized. + * #5 modifier key states, e.g., .shiftKey, are + * ignored. Instead, modifier states are managed by + * each instance and set automatically. + * @param aKeyFlags Special flags. The values can be some of KEY_* + * constants. + * @return KEYEVENT_NOT_CONSUMED, if the keydown event nor + * the following keypress event(s) are consumed. + * KEYDOWN_IS_CONSUMED, if the keydown event is + * consumed. No keypress event will be dispatched in + * this case. + * KEYPRESS_IS_CONSUMED, if the keypress event(s) is + * consumed when dispatched. + * Note that keypress event is always consumed by + * native code for the printable keys (indicating the + * default action has been taken). + */ + [optional_argc] + unsigned long keydown(in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * Similar to keydown(), but this dispatches only a keyup event. + */ + [optional_argc] + boolean keyup(in nsIDOMKeyEvent aKeyboardEvent, + [optional] in unsigned long aKeyFlags); + + /** + * getModifierState() returns modifier state managed by this instance. + * + * @param aModifier One of modifier key names. This doesn't support + * virtual modifiers like "Accel". + * @return true if the modifier key is active. Otherwise, + * false. + */ + boolean getModifierState(in DOMString aModifierKey); + + /** + * shareModifierStateOf() makes the instance shares modifier state of + * another instance. When this is called, the instance refers the modifier + * state of another instance. After that, changes to either this and the + * other instance's modifier state is synchronized. + * + * @param aOther Another instance which will be referred by the + * instance. If this is null, the instance restarts + * to manage modifier state independently. + */ + void shareModifierStateOf(in nsITextInputProcessor aOther); +}; + +%{C++ +#define TEXT_INPUT_PROCESSOR_CID \ + { 0xcaaab47f, 0x1e31, 0x478e, \ + { 0x89, 0x19, 0x97, 0x09, 0x04, 0xe9, 0xcb, 0x72 } } +#define TEXT_INPUT_PROCESSOR_CONTRACTID \ + "@mozilla.org/text-input-processor;1" +%} diff --git a/dom/interfaces/base/nsITextInputProcessorCallback.idl b/dom/interfaces/base/nsITextInputProcessorCallback.idl new file mode 100644 index 000000000..61b6d50ed --- /dev/null +++ b/dom/interfaces/base/nsITextInputProcessorCallback.idl @@ -0,0 +1,104 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsITextInputProcessor; + +/** + * nsITextInputProcessorNotification stores the type of notification to IME and + * its detail. See each explanation of attribute for the detail. + */ + +[scriptable, builtinclass, uuid(c0ce1add-82bb-45ab-b99a-42cfba7fd5d7)] +interface nsITextInputProcessorNotification : nsISupports +{ + /** + * type attribute represents what's notified or requested. Value must be + * one of following values: + * + * "request-to-commit" (required to be handled) + * This is requested when Gecko believes that active composition should be + * committed. nsITextInputProcessorCallback::onNotify() has to handle this + * notification. + * + * "request-to-cancel" (required to be handled) + * This is requested when Gecko believes that active composition should be + * canceled. I.e., composition should be committed with empty string. + * nsITextInputProcessorCallback::onNotify() has to handle this + * notification. + * + * "notify-end-input-transaction" (optional) + * This is notified when the callback is detached from + * nsITextInputProcessor. I.e., the TextInputProcessor lost the rights + * to input text and needs to call .beginInputTransaction() before next + * input. + * + * "notify-focus" (optional) + * This is notified when an editable editor gets focus and Gecko starts + * to observe changes in the content. E.g., selection changes. + * IME shouldn't change DOM tree, focus nor something when this is notified. + * + * "notify-blur" (optional) + * This is notified when an editable editor loses focus and Gecko stops + * observing the changes in the content. + */ + readonly attribute ACString type; +}; + +/** + * nsITextInputProcessorCallback is a callback interface for JS to implement + * IME. IME implemented by JS can implement onNotify() function and must send + * it to nsITextInputProcessor at initializing. Then, onNotify() will be + * called with nsITextInputProcessorNotification instance. + * The reason why onNotify() uses string simply is that if we will support + * other notifications such as text changes and selection changes, we need to + * notify IME of some other information. Then, only changing + * nsITextInputProcessorNotification interface is better for compatibility. + */ + +[scriptable, function, uuid(23d5f242-adb5-46f1-8766-90d1bf0383df)] +interface nsITextInputProcessorCallback : nsISupports +{ + /** + * When Gecko notifies IME of something or requests something to IME, + * this is called. + * + * @param aTextInputProcessor Reference to the nsITextInputProcessor service + * which is the original receiver of the request + * or notification. + * @param aNotification Stores type of notifications and additional + * information. + * @return Return true if it succeeded or does nothing. + * Otherwise, return false. + * + * Example #1 The simplest implementation of nsITextInputProcessorCallback is: + * + * function simpleCallback(aTIP, aNotification) + * { + * try { + * switch (aNotification.type) { + * case "request-to-commit": + * aTIP.commitComposition(); + * break; + * case "request-to-cancel": + * aTIP.cancelComposition(); + * break; + * } + * } catch (e) { + * return false; + * } + * return true; + * } + * + * var TIP = Components.classes["@mozilla.org/text-input-processor;1"]. + * createInstance(Components.interfaces.nsITextInputProcessor); + * if (!TIP.init(window, simpleCallback)) { + * return; + * } + */ + boolean onNotify(in nsITextInputProcessor aTextInputProcessor, + in nsITextInputProcessorNotification aNotification); +}; diff --git a/dom/interfaces/canvas/moz.build b/dom/interfaces/canvas/moz.build new file mode 100644 index 000000000..26f24c75d --- /dev/null +++ b/dom/interfaces/canvas/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMCanvasRenderingContext2D.idl', + 'nsIDOMWebGLRenderingContext.idl', +] + +XPIDL_MODULE = 'dom_canvas' + diff --git a/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl b/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl new file mode 100644 index 000000000..a26e81563 --- /dev/null +++ b/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * This interface remains only for the constants, for a context, use the + * WebIDL/Paris bindings instead (CanvasRenderingContext2D.webidl). + * The constants are used by CanvasRenderingContext2D::DrawWindow and are + * used in WindowsPreviewPerTab.jsm and some extensions. The constants can + * be referenced directly via a canvas context 2d rather than this interface, + * and that should be preferred in new code. + */ +[uuid(4417cab7-c7eb-4e0c-b00a-c43842f0cba8)] +interface nsIDOMCanvasRenderingContext2D : nsISupports +{ + // Show the caret if appropriate when drawing + const unsigned long DRAWWINDOW_DRAW_CARET = 0x01; + // Don't flush pending layout notifications that could otherwise + // be batched up + const unsigned long DRAWWINDOW_DO_NOT_FLUSH = 0x02; + // Draw scrollbars and scroll the viewport if they are present + const unsigned long DRAWWINDOW_DRAW_VIEW = 0x04; + // Use the widget layer manager if available. This means hardware + // acceleration may be used, but it might actually be slower or + // lower quality than normal. It will however more accurately reflect + // the pixels rendered to the screen. + const unsigned long DRAWWINDOW_USE_WIDGET_LAYERS = 0x08; + // Don't synchronously decode images - draw what we have + const unsigned long DRAWWINDOW_ASYNC_DECODE_IMAGES = 0x10; +}; diff --git a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl new file mode 100644 index 000000000..a6d75e722 --- /dev/null +++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[builtinclass, uuid(f1a2fd3a-c6ac-4ee2-a700-5d285d5e3fff)] +interface nsIDOMWebGLRenderingContext : nsISupports +{ + // get an underlying GL parameter, without any WebGL intervention. + // Most useful for querying GL_VENDOR/GL_RENDERER for identifying + // the underlying renderer to the user. + [noscript] DOMString mozGetUnderlyingParamString(in unsigned long pname); +}; diff --git a/dom/interfaces/core/moz.build b/dom/interfaces/core/moz.build new file mode 100644 index 000000000..415432a83 --- /dev/null +++ b/dom/interfaces/core/moz.build @@ -0,0 +1,28 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMAttr.idl', + 'nsIDOMCDATASection.idl', + 'nsIDOMCharacterData.idl', + 'nsIDOMComment.idl', + 'nsIDOMDocument.idl', + 'nsIDOMDocumentFragment.idl', + 'nsIDOMDocumentType.idl', + 'nsIDOMDOMException.idl', + 'nsIDOMDOMImplementation.idl', + 'nsIDOMElement.idl', + 'nsIDOMMozNamedAttrMap.idl', + 'nsIDOMNode.idl', + 'nsIDOMNodeList.idl', + 'nsIDOMNSEditableElement.idl', + 'nsIDOMProcessingInstruction.idl', + 'nsIDOMText.idl', + 'nsIDOMXMLDocument.idl', +] + +XPIDL_MODULE = 'dom_core' + diff --git a/dom/interfaces/core/nsIDOMAttr.idl b/dom/interfaces/core/nsIDOMAttr.idl new file mode 100644 index 000000000..f4971ba44 --- /dev/null +++ b/dom/interfaces/core/nsIDOMAttr.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +/** + * The nsIDOMAttr interface represents an attribute in an "Element" object. + * Typically the allowable values for the attribute are defined in a document + * type definition. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[builtinclass, uuid(7db491e8-a3a3-4432-ad67-e6c33e24ac6d)] +interface nsIDOMAttr : nsIDOMNode +{ + readonly attribute DOMString name; + readonly attribute boolean specified; + attribute DOMString value; + // raises(DOMException) on setting + + // Introduced in DOM Level 2: + readonly attribute nsIDOMElement ownerElement; + + readonly attribute boolean isId; +}; diff --git a/dom/interfaces/core/nsIDOMCDATASection.idl b/dom/interfaces/core/nsIDOMCDATASection.idl new file mode 100644 index 000000000..c0595c58c --- /dev/null +++ b/dom/interfaces/core/nsIDOMCDATASection.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMText.idl" + +/** + * CDATA sections are used to escape blocks of text containing characters + * that would otherwise be regarded as markup. + * Their primary purpose is for including material such as XML fragments, + * without needing to escape all the delimiters. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[uuid(e14ef131-34cc-40c8-9c99-a403c001184a)] +interface nsIDOMCDATASection : nsIDOMText +{ +}; diff --git a/dom/interfaces/core/nsIDOMCharacterData.idl b/dom/interfaces/core/nsIDOMCharacterData.idl new file mode 100644 index 000000000..96cfd40e7 --- /dev/null +++ b/dom/interfaces/core/nsIDOMCharacterData.idl @@ -0,0 +1,42 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +/** + * The nsIDOMCharacterData interface extends nsIDOMNode with a set of + * attributes and methods for accessing character data in the DOM. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[uuid(4109a2d2-e7af-445d-bb72-c7c9b875f35e)] +interface nsIDOMCharacterData : nsIDOMNode +{ + attribute DOMString data; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + readonly attribute unsigned long length; + DOMString substringData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void appendData(in DOMString arg) + raises(DOMException); + void insertData(in unsigned long offset, + in DOMString arg) + raises(DOMException); + void deleteData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void replaceData(in unsigned long offset, + in unsigned long count, + in DOMString arg) + raises(DOMException); + + [binaryname(MozRemove)] + void remove(); +}; diff --git a/dom/interfaces/core/nsIDOMComment.idl b/dom/interfaces/core/nsIDOMComment.idl new file mode 100644 index 000000000..f7d372167 --- /dev/null +++ b/dom/interfaces/core/nsIDOMComment.idl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCharacterData.idl" + +/** + * The nsIDOMComment interface inherits from nsIDOMCharacterData and represents + * the content of a comment, i.e., all the characters between the starting + * '<!--' and ending '-->'. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[uuid(e7866ff8-b7fc-494f-87c0-fb017d8a4d30)] +interface nsIDOMComment : nsIDOMCharacterData +{ +}; diff --git a/dom/interfaces/core/nsIDOMDOMException.idl b/dom/interfaces/core/nsIDOMDOMException.idl new file mode 100644 index 000000000..5206a5f4c --- /dev/null +++ b/dom/interfaces/core/nsIDOMDOMException.idl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * In general, DOM methods return specific error values in ordinary + * processing situations, such as out-of-bound errors. + * However, DOM operations can raise exceptions in "exceptional" + * circumstances, i.e., when an operation is impossible to perform + * (either for logical reasons, because data is lost, or because the + * implementation has become unstable) + * + * For more information on this interface please see + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception + */ + +[uuid(5bd766d3-57a9-4833-995d-dbe21da29595)] +interface nsIDOMDOMException : nsISupports +{ + const unsigned short INDEX_SIZE_ERR = 1; + const unsigned short DOMSTRING_SIZE_ERR = 2; // historical + const unsigned short HIERARCHY_REQUEST_ERR = 3; + const unsigned short WRONG_DOCUMENT_ERR = 4; + const unsigned short INVALID_CHARACTER_ERR = 5; + const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical + const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; + const unsigned short NOT_FOUND_ERR = 8; + const unsigned short NOT_SUPPORTED_ERR = 9; + const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical + const unsigned short INVALID_STATE_ERR = 11; + const unsigned short SYNTAX_ERR = 12; + const unsigned short INVALID_MODIFICATION_ERR = 13; + const unsigned short NAMESPACE_ERR = 14; + const unsigned short INVALID_ACCESS_ERR = 15; + const unsigned short VALIDATION_ERR = 16; // historical + const unsigned short TYPE_MISMATCH_ERR = 17; + const unsigned short SECURITY_ERR = 18; + const unsigned short NETWORK_ERR = 19; + const unsigned short ABORT_ERR = 20; + const unsigned short URL_MISMATCH_ERR = 21; + const unsigned short QUOTA_EXCEEDED_ERR = 22; + const unsigned short TIMEOUT_ERR = 23; + const unsigned short INVALID_NODE_TYPE_ERR = 24; + const unsigned short DATA_CLONE_ERR = 25; + const unsigned short INVALID_POINTER_ERR = 26; + + readonly attribute unsigned short code; +}; + diff --git a/dom/interfaces/core/nsIDOMDOMImplementation.idl b/dom/interfaces/core/nsIDOMDOMImplementation.idl new file mode 100644 index 000000000..60e902840 --- /dev/null +++ b/dom/interfaces/core/nsIDOMDOMImplementation.idl @@ -0,0 +1,42 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMDOMImplementation interface provides a number of methods for + * performing operations that are independent of any particular instance + * of the document object model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[uuid(03a6f574-99ec-42f8-9e6c-812a4a9bcbf7)] +interface nsIDOMDOMImplementation : nsISupports +{ + boolean hasFeature(in DOMString feature, + in DOMString version); + + nsIDOMDocumentType createDocumentType(in DOMString qualifiedName, + in DOMString publicId, + in DOMString systemId) + raises(DOMException); + + nsIDOMDocument createDocument(in DOMString namespaceURI, + in DOMString qualifiedName, + in nsIDOMDocumentType doctype) + raises(DOMException); + + /** + * Returns an HTML document with a basic DOM already constructed and with an + * appropriate title element. + * + * @param title the title of the Document + * @see <http://www.whatwg.org/html/#creating-documents> + */ + nsIDOMDocument createHTMLDocument([Null(Stringify)] + in DOMString title); +}; diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl new file mode 100644 index 000000000..6070a99ac --- /dev/null +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -0,0 +1,415 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +%{ C++ +#include "jspubtd.h" + +// windows.h #defines CreateEvent +#ifdef CreateEvent +#undef CreateEvent +#endif +%} + +interface mozIDOMWindowProxy; +interface nsIDOMNodeIterator; +interface nsIDOMNodeFilter; +interface nsIDOMTreeWalker; +interface nsIDOMLocation; + +/** + * The nsIDOMDocument interface represents the entire HTML or XML document. + * Conceptually, it is the root of the document tree, and provides the + * primary access to the document's data. + * Since elements, text nodes, comments, processing instructions, etc. + * cannot exist outside the context of a Document, the nsIDOMDocument + * interface also contains the factory methods needed to create these + * objects. + * + * For more information on this interface please see + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html + */ + +[uuid(b15fa0f4-97c1-4388-af62-2ceff7a89bdf)] +interface nsIDOMDocument : nsIDOMNode +{ + readonly attribute nsIDOMDocumentType doctype; + readonly attribute nsIDOMDOMImplementation implementation; + readonly attribute nsIDOMElement documentElement; + nsIDOMElement createElement([Null(Stringify)] in DOMString tagName) + raises(DOMException); + nsIDOMDocumentFragment createDocumentFragment(); + nsIDOMText createTextNode(in DOMString data); + nsIDOMComment createComment(in DOMString data); + nsIDOMCDATASection createCDATASection(in DOMString data) + raises(DOMException); + nsIDOMProcessingInstruction createProcessingInstruction(in DOMString target, + in DOMString data) + raises(DOMException); + nsIDOMAttr createAttribute(in DOMString name) + raises(DOMException); + nsIDOMNodeList getElementsByTagName(in DOMString tagname); + + // Introduced in DOM Level 2: + [optional_argc] nsIDOMNode importNode(in nsIDOMNode importedNode, + [optional] in boolean deep) + raises(DOMException); + // Introduced in DOM Level 2: + nsIDOMElement createElementNS(in DOMString namespaceURI, + [Null(Stringify)] in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + nsIDOMAttr createAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + nsIDOMElement getElementById(in DOMString elementId); + // Introduced in DOM Level 3: + readonly attribute DOMString inputEncoding; + // Introduced in DOM Level 3: + readonly attribute DOMString documentURI; + // Alias introduced for all documents in recent DOM standards + readonly attribute DOMString URL; + // Introduced in DOM Level 3: + nsIDOMNode adoptNode(in nsIDOMNode source) + raises(DOMException); + + /** + * Create a range + * + * @see http://html5.org/specs/dom-range.html#dom-document-createrange + */ + nsIDOMRange createRange(); + + [optional_argc] nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, + [optional] in unsigned long whatToShow, + [optional] in nsIDOMNodeFilter filter) + raises(DOMException); + [optional_argc] nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, + [optional] in unsigned long whatToShow, + [optional] in nsIDOMNodeFilter filter) + raises(DOMException); + + nsIDOMEvent createEvent(in DOMString eventType) + raises(DOMException); + + + // HTML + /** + * The window associated with this document. + * + * @see <http://www.whatwg.org/html/#dom-document-defaultview> + */ + readonly attribute mozIDOMWindowProxy defaultView; + + /** + * @see <http://www.whatwg.org/html/#dom-document-characterset> + */ + readonly attribute DOMString characterSet; + /** + * @see <http://www.whatwg.org/html/#dom-document-dir> + */ + attribute DOMString dir; + + /** + * @see <http://www.whatwg.org/html/#dom-document-location> + */ + readonly attribute nsIDOMLocation location; + + /** + * @see <http://www.whatwg.org/html/#document.title> + */ + attribute DOMString title; + + /** + * @see <http://www.whatwg.org/html/#dom-document-readystate> + */ + readonly attribute DOMString readyState; + /** + * @see <http://www.whatwg.org/html/#dom-document-lastmodified> + */ + readonly attribute DOMString lastModified; + /** + * @see <http://www.whatwg.org/html/#dom-document-referrer> + */ + readonly attribute DOMString referrer; + + /** + * @see <http://www.whatwg.org/html/#dom-document-hasfocus> + */ + boolean hasFocus(); + + /** + * @see <http://www.whatwg.org/html/#dom-document-activeelement> + */ + readonly attribute nsIDOMElement activeElement; + + /** + * Retrieve elements matching all classes listed in a + * space-separated string. + * + * @see <http://www.whatwg.org/html/#dom-document-getelementsbyclassname> + */ + nsIDOMNodeList getElementsByClassName(in DOMString classes); + + + // CSSOM + /** + * @see <http://dev.w3.org/csswg/cssom/#dom-document-stylesheets> + */ + readonly attribute nsIDOMStyleSheetList styleSheets; + + /** + * This attribute must return the preferred style sheet set as set by the + * author. It is determined from the order of style sheet declarations and + * the Default-Style HTTP headers, as eventually defined elsewhere in the Web + * Apps 1.0 specification. If there is no preferred style sheet set, this + * attribute must return the empty string. The case of this attribute must + * exactly match the case given by the author where the preferred style sheet + * is specified or implied. This attribute must never return null. + * + * @see <http://dev.w3.org/csswg/cssom/#dom-document-preferredStyleSheetSet> + */ + readonly attribute DOMString preferredStyleSheetSet; + + /** + * This attribute indicates which style sheet set is in use. This attribute + * is live; changing the disabled attribute on style sheets directly will + * change the value of this attribute. + * + * If all the sheets that are enabled and have a title have the same title + * (by case-sensitive comparisons) then the value of this attribute must be + * exactly equal to the title of the first enabled style sheet with a title + * in the styleSheets list. Otherwise, if style sheets from different sets + * are enabled, then the return value must be null (there is no way to + * determine what the currently selected style sheet set is in those + * conditions). Otherwise, either all style sheets that have a title are + * disabled, or there are no alternate style sheets, and + * selectedStyleSheetSet must return the empty string. + * + * Setting this attribute to the null value must have no effect. + * + * Setting this attribute to a non-null value must call + * enableStyleSheetsForSet() with that value as the function's argument, and + * set lastStyleSheetSet to that value. + * + * From the DOM's perspective, all views have the same + * selectedStyleSheetSet. If a UA supports multiple views with different + * selected alternate style sheets, then this attribute (and the StyleSheet + * interface's disabled attribute) must return and set the value for the + * default view. + * + * @see <http://dev.w3.org/csswg/cssom/#dom-document-selectedStyleSheetSet> + */ + [binaryname(MozSelectedStyleSheetSet)] + attribute DOMString selectedStyleSheetSet; + + /* + * This property must initially have the value null. Its value changes when + * the selectedStyleSheetSet attribute is set. + * + * @see <http://dev.w3.org/csswg/cssom/#dom-document-lastStyleSheetSet> + */ + readonly attribute DOMString lastStyleSheetSet; + + /** + * This must return the live list of the currently available style sheet + * sets. This list is constructed by enumerating all the style sheets for + * this document available to the implementation, in the order they are + * listed in the styleSheets attribute, adding the title of each style sheet + * with a title to the list, avoiding duplicates by dropping titles that + * match (case-sensitively) titles that have already been added to the + * list. + * + * @see <http://dev.w3.org/csswg/cssom/#dom-document-styleSheetSets> + */ + readonly attribute nsISupports styleSheetSets; + + /** + * Calling this method must change the disabled attribute on each StyleSheet + * object with a title attribute with a length greater than 0 in the + * styleSheets attribute, so that all those whose title matches the name + * argument are enabled, and all others are disabled. Title matches must be + * case-sensitive. Calling this method with the empty string disables all + * alternate and preferred style sheets (but does not change the state of + * persistent style sheets, that is those with no title attribute). + * + * Calling this method with a null value must have no effect. + * + * Style sheets that do not have a title are never affected by this + * method. This method does not change the values of the lastStyleSheetSet or + * preferredStyleSheetSet attributes. + * + * @see <http://dev.w3.org/csswg/cssom/#dom-document-enableStyleSheetsForSet> + */ + [binaryname(MozEnableStyleSheetsForSet)] + void enableStyleSheetsForSet(in DOMString name); + + + // CSSOM-View + /** + * Returns the element from the caller's document at the given point, + * relative to the upper-left-most point in the (possibly scrolled) + * window or frame. + * + * If the element at the given point belongs to another document (such as + * an iframe's subdocument), the element in the calling document's DOM + * (e.g. the iframe) is returned. If the element at the given point is + * anonymous or XBL generated content, such as a textbox's scrollbars, then + * the first non-anonymous parent element (that is, the textbox) is returned. + * + * This method returns null if either coordinate is negative, or if the + * specified point lies outside the visible bounds of the document. + * + * Callers from XUL documents should wait until the onload event has fired + * before calling this method. + * + * @see <http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint> + */ + nsIDOMElement elementFromPoint(in float x, in float y); + + + // Mozilla extensions + /** + * @see <https://developer.mozilla.org/en/DOM/document.contentType> + */ + readonly attribute DOMString contentType; + + /** + * True if this document is synthetic : stand alone image, video, audio file, + * etc. + */ + readonly attribute boolean mozSyntheticDocument; + + /** + * Returns the script element whose script is currently being processed. + * + * @see <https://developer.mozilla.org/en/DOM/document.currentScript> + */ + readonly attribute nsIDOMElement currentScript; + + /** + * Release the current mouse capture if it is on an element within this + * document. + * + * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture> + */ + void releaseCapture(); + + /** + * Use the given DOM element as the source image of target |-moz-element()|. + * + * This function introduces a new special ID (called "image element ID"), + * which is only used by |-moz-element()|, and associates it with the given + * DOM element. Image elements ID's have the higher precedence than general + * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called, + * |-moz-element(#<id>)| uses |<element>| as the source image even if there + * is another element with id attribute = |<id>|. To unregister an image + * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|. + * + * Example: + * <script> + * canvas = document.createElement("canvas"); + * canvas.setAttribute("width", 100); + * canvas.setAttribute("height", 100); + * // draw to canvas + * document.mozSetImageElement("canvasbg", canvas); + * </script> + * <div style="background-image: -moz-element(#canvasbg);"></div> + * + * @param aImageElementId an image element ID to associate with + * |aImageElement| + * @param aImageElement a DOM element to be used as the source image of + * |-moz-element(#aImageElementId)|. If this is null, the function will + * unregister the image element ID |aImageElementId|. + * + * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement> + */ + void mozSetImageElement(in DOMString aImageElementId, + in nsIDOMElement aImageElement); + + /** + * Element which is currently the full-screen element as per the DOM + * full-screen api. + * + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> + */ + readonly attribute nsIDOMElement mozFullScreenElement; + + /** + * Causes the document to leave DOM full-screen mode, if it's in + * full-screen mode, as per the DOM full-screen api. + * + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> + */ + void mozCancelFullScreen(); + + /** + * Denotes whether this document is in DOM full-screen mode, as per the DOM + * full-screen api. + * + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> + */ + readonly attribute boolean mozFullScreen; + + /** + * Denotes whether the full-screen-api.enabled is true, no windowed + * plugins are present, and all ancestor documents have the + * allowfullscreen attribute set. + * + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> + */ + readonly attribute boolean mozFullScreenEnabled; + + /** + * The element to which the mouse pointer is locked, if any, as per the + * DOM pointer lock api. + * + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> + */ + readonly attribute nsIDOMElement mozPointerLockElement; + + /** + * Retrieve the location of the caret position (DOM node and character + * offset within that node), given a point. + * + * @param x Horizontal point at which to determine the caret position, in + * page coordinates. + * @param y Vertical point at which to determine the caret position, in + * page coordinates. + */ + nsISupports /* CaretPosition */ caretPositionFromPoint(in float x, in float y); + + /** + * Exit pointer is lock if locked, as per the DOM pointer lock api. + * + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> + */ + void mozExitPointerLock(); + + /** + * Visibility API implementation. + */ + readonly attribute boolean hidden; + readonly attribute DOMString visibilityState; + + /** + * Returns "BackCompat" if we're in quirks mode or "CSS1Compat" if we're in + * strict mode. (XML documents are always in strict mode.) + */ + readonly attribute DOMString compatMode; + + /** + * Return nodes that match a given CSS selector. + * + * @see <http://dev.w3.org/2006/webapi/selectors-api/> + */ + nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors); + nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors); +}; diff --git a/dom/interfaces/core/nsIDOMDocumentFragment.idl b/dom/interfaces/core/nsIDOMDocumentFragment.idl new file mode 100644 index 000000000..b4f4823a0 --- /dev/null +++ b/dom/interfaces/core/nsIDOMDocumentFragment.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +/** + * DocumentFragment is a "lightweight" or "minimal" Document object. + * nsIDOMDocumentFragment is used in situations where the Document + * interface can potentially be a heavyweight interface. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[builtinclass, uuid(48eb8d72-95bb-402e-a8fc-f2b187abcbdb)] +interface nsIDOMDocumentFragment : nsIDOMNode +{ + /** + * Return nodes that match a given CSS selector. + * + * @see <http://dev.w3.org/2006/webapi/selectors-api/> + */ + nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors); + nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors); +}; diff --git a/dom/interfaces/core/nsIDOMDocumentType.idl b/dom/interfaces/core/nsIDOMDocumentType.idl new file mode 100644 index 000000000..0ce6fc4c8 --- /dev/null +++ b/dom/interfaces/core/nsIDOMDocumentType.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +/** + * Each Document has a doctype attribute whose value is either null + * or a DocumentType object. + * The nsIDOMDocumentType interface in the DOM Core provides an + * interface to the list of entities that are defined for the document. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +[uuid(cd7467b9-0f26-4787-a359-66e80ba8db92)] +interface nsIDOMDocumentType : nsIDOMNode +{ + readonly attribute DOMString name; + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; + readonly attribute DOMString internalSubset; + + [binaryname(MozRemove)] + void remove(); +}; diff --git a/dom/interfaces/core/nsIDOMElement.idl b/dom/interfaces/core/nsIDOMElement.idl new file mode 100644 index 000000000..403661394 --- /dev/null +++ b/dom/interfaces/core/nsIDOMElement.idl @@ -0,0 +1,229 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMNode.idl" + +interface nsIDOMMozNamedAttrMap; + +%{C++ +// Undo the windows.h damage +#undef GetMessage +#undef CreateEvent +#undef GetClassName +#undef GetBinaryType +#undef RemoveDirectory +%} + +/** + * The nsIDOMElement interface represents an element in an HTML or + * XML document. + * + * For more information on this interface please see + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element + */ + +[uuid(6289999b-1008-4269-b42a-413ec5a9d3f4)] +interface nsIDOMElement : nsIDOMNode +{ + readonly attribute DOMString tagName; + + attribute DOMString id; + attribute DOMString className; + /** + * Returns a DOMTokenList object reflecting the class attribute. + */ + readonly attribute nsISupports classList; + + readonly attribute nsIDOMMozNamedAttrMap attributes; + DOMString getAttribute(in DOMString name); + DOMString getAttributeNS(in DOMString namespaceURI, + in DOMString localName); + void setAttribute(in DOMString name, + in DOMString value); + void setAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName, + in DOMString value); + void removeAttribute(in DOMString name); + void removeAttributeNS(in DOMString namespaceURI, + in DOMString localName); + boolean hasAttribute(in DOMString name); + boolean hasAttributeNS(in DOMString namespaceURI, + in DOMString localName); + boolean hasAttributes(); + + // Obsolete methods. + nsIDOMAttr getAttributeNode(in DOMString name); + nsIDOMAttr setAttributeNode(in nsIDOMAttr newAttr); + nsIDOMAttr removeAttributeNode(in nsIDOMAttr oldAttr); + nsIDOMAttr getAttributeNodeNS(in DOMString namespaceURI, + in DOMString localName); + nsIDOMAttr setAttributeNodeNS(in nsIDOMAttr newAttr) + raises(DOMException); + + nsIDOMHTMLCollection getElementsByTagName(in DOMString name); + nsIDOMHTMLCollection getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + /** + * Retrieve elements matching all classes listed in a + * space-separated string. + */ + nsIDOMHTMLCollection getElementsByClassName(in DOMString classes); + + /** + * Returns a live nsIDOMNodeList of the current child elements. + */ + [binaryname(ChildElements)] + readonly attribute nsIDOMNodeList children; + /** + * Similar as the attributes on nsIDOMNode, but navigates just elements + * rather than all nodes. + */ + readonly attribute nsIDOMElement firstElementChild; + readonly attribute nsIDOMElement lastElementChild; + readonly attribute nsIDOMElement previousElementSibling; + readonly attribute nsIDOMElement nextElementSibling; + /** + * Returns the number of child nodes that are nsIDOMElements. + */ + readonly attribute unsigned long childElementCount; + + [binaryname(MozRemove)] + void remove(); + + // CSSOM View + /** + * Retrieve a list of rectangles, one for each CSS border-box associated with + * the element. The coordinates are in CSS pixels, and relative to + * the top-left of the document's viewport, unless the document + * has an SVG foreignobject ancestor, in which case the coordinates are + * relative to the top-left of the content box of the nearest SVG foreignobject + * ancestor. The coordinates are calculated as if every scrollable element + * is scrolled to its default position. + * + * Note: the boxes of overflowing children do not affect these rectangles. + * Note: some elements have empty CSS boxes. Those return empty rectangles, + * but the coordinates may still be meaningful. + * Note: some elements have no CSS boxes (including display:none elements, + * HTML AREA elements, and SVG elements that do not render). Those return + * an empty list. + */ + nsIDOMClientRectList getClientRects(); + + /** + * Returns the union of all rectangles in the getClientRects() list. Empty + * rectangles are ignored, except that if all rectangles are empty, + * we return an empty rectangle positioned at the top-left of the first + * rectangle in getClientRects(). + */ + nsIDOMClientRect getBoundingClientRect(); + + /** + * The vertical scroll position of the element, or 0 if the element is not + * scrollable. This property may be assigned a value to change the + * vertical scroll position. + */ + attribute long scrollTop; + + /** + * The horizontal scroll position of the element, or 0 if the element is not + * scrollable. This property may be assigned a value to change the + * horizontal scroll position. + */ + attribute long scrollLeft; + + /** + * The width of the scrollable area of the element. If the element is not + * scrollable, scrollWidth is equivalent to the offsetWidth. + */ + readonly attribute long scrollWidth; + + /** + * The height of the scrollable area of the element. If the element is not + * scrollable, scrollHeight is equivalent to the offsetHeight. + */ + readonly attribute long scrollHeight; + + /** + * The height in CSS pixels of the element's top border. + */ + readonly attribute long clientTop; + + /** + * The width in CSS pixels of the element's left border and scrollbar + * if it is present on the left side. + */ + readonly attribute long clientLeft; + + /** + * The height in CSS pixels of the element's padding box. If the element is + * scrollable, the scroll bars are included inside this width. + */ + readonly attribute long clientWidth; + + /** + * The width in CSS pixels of the element's padding box. If the element is + * scrollable, the scroll bars are included inside this height. + */ + readonly attribute long clientHeight; + + /* The maximum offset that the element can be scrolled to + (i.e., the value that scrollLeft/scrollTop would be clamped to if they were + set to arbitrarily large values. */ + readonly attribute long scrollLeftMax; + readonly attribute long scrollTopMax; + + + // Selectors API + /** + * Returns whether this element would be selected by the given selector + * string. + * + * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector> + */ + boolean mozMatchesSelector([Null(Stringify)] in DOMString selector); + + + // Proprietary extensions + /** + * Set this during a mousedown event to grab and retarget all mouse events + * to this element until the mouse button is released or releaseCapture is + * called. If retargetToElement is true, then all events are targetted at + * this element. If false, events can also fire at descendants of this + * element. + * + */ + void setCapture([optional] in boolean retargetToElement); + + /** + * If this element has captured the mouse, release the capture. If another + * element has captured the mouse, this method has no effect. + */ + void releaseCapture(); + + // Mozilla extensions + /** + * Requests that this element be made the full-screen element, as per the DOM + * full-screen api. + * + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> + */ + void mozRequestFullScreen(); + + /** + * Requests that this element be made the pointer-locked element, as per the DOM + * pointer lock api. + * + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> + */ + void mozRequestPointerLock(); + + /** + * Return nodes that match a given CSS selector. + * + * @see <http://dev.w3.org/2006/webapi/selectors-api/> + */ + nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors); + nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors); +}; diff --git a/dom/interfaces/core/nsIDOMMozNamedAttrMap.idl b/dom/interfaces/core/nsIDOMMozNamedAttrMap.idl new file mode 100644 index 000000000..b93786474 --- /dev/null +++ b/dom/interfaces/core/nsIDOMMozNamedAttrMap.idl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * This is a temporary, non-standard interface, to ease the transition to a + * world where Attr no longer inherits from Node. + */ + +[uuid(cb5564cd-26ec-418f-a6d6-1d57cd2c971c)] +interface nsIDOMMozNamedAttrMap : nsISupports +{ + nsIDOMAttr getNamedItem(in DOMString name); + nsIDOMAttr setNamedItem(in nsIDOMAttr arg) + raises(DOMException); + nsIDOMAttr removeNamedItem(in DOMString name) + raises(DOMException); + nsIDOMAttr item(in unsigned long index); + readonly attribute unsigned long length; + // Introduced in DOM Level 2: + nsIDOMAttr getNamedItemNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + nsIDOMAttr setNamedItemNS(in nsIDOMAttr arg) + raises(DOMException); + // Introduced in DOM Level 2: + nsIDOMAttr removeNamedItemNS(in DOMString namespaceURI, + in DOMString localName) + raises(DOMException); +}; diff --git a/dom/interfaces/core/nsIDOMNSEditableElement.idl b/dom/interfaces/core/nsIDOMNSEditableElement.idl new file mode 100644 index 000000000..67cb10488 --- /dev/null +++ b/dom/interfaces/core/nsIDOMNSEditableElement.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIEditor; + +/** + * This interface is implemented by elements which have inner editable content, + * such as HTML input and textarea. + * + * Please make sure to update the HTMLTextAreaElement and HTMLInputElement + * Web IDL interfaces to mirror this interface when changing it. + * + */ + +[scriptable, uuid(3503de34-6631-4594-b7be-c36ff6a520c4)] +interface nsIDOMNSEditableElement : nsISupports +{ + [noscript] readonly attribute nsIEditor editor; + // This is similar to set .value on nsIDOMInput/TextAreaElements, but + // handling of the value change is closer to the normal user input, so + // 'change' event for example will be dispatched when focusing out the + // element. + [noscript] void setUserInput(in DOMString input); +}; diff --git a/dom/interfaces/core/nsIDOMNode.idl b/dom/interfaces/core/nsIDOMNode.idl new file mode 100644 index 000000000..fc390dd7b --- /dev/null +++ b/dom/interfaces/core/nsIDOMNode.idl @@ -0,0 +1,111 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIVariant; + +/** + * The nsIDOMNode interface is the primary datatype for the entire + * Document Object Model. + * It represents a single node in the document tree. + * + * For more information on this interface please see + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html + */ + +[uuid(cc35b412-009b-46a3-9be0-76448f12548d)] +interface nsIDOMNode : nsISupports +{ + const unsigned short ELEMENT_NODE = 1; + const unsigned short ATTRIBUTE_NODE = 2; + const unsigned short TEXT_NODE = 3; + const unsigned short CDATA_SECTION_NODE = 4; + const unsigned short ENTITY_REFERENCE_NODE = 5; + const unsigned short ENTITY_NODE = 6; + const unsigned short PROCESSING_INSTRUCTION_NODE = 7; + const unsigned short COMMENT_NODE = 8; + const unsigned short DOCUMENT_NODE = 9; + const unsigned short DOCUMENT_TYPE_NODE = 10; + const unsigned short DOCUMENT_FRAGMENT_NODE = 11; + const unsigned short NOTATION_NODE = 12; + + readonly attribute DOMString nodeName; + attribute DOMString nodeValue; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + readonly attribute unsigned short nodeType; + readonly attribute nsIDOMNode parentNode; + readonly attribute nsIDOMElement parentElement; + readonly attribute nsIDOMNodeList childNodes; + readonly attribute nsIDOMNode firstChild; + readonly attribute nsIDOMNode lastChild; + readonly attribute nsIDOMNode previousSibling; + readonly attribute nsIDOMNode nextSibling; + // Modified in DOM Level 2: + readonly attribute nsIDOMDocument ownerDocument; + nsIDOMNode insertBefore(in nsIDOMNode newChild, + in nsIDOMNode refChild) + raises(DOMException); + nsIDOMNode replaceChild(in nsIDOMNode newChild, + in nsIDOMNode oldChild) + raises(DOMException); + nsIDOMNode removeChild(in nsIDOMNode oldChild) + raises(DOMException); + nsIDOMNode appendChild(in nsIDOMNode newChild) + raises(DOMException); + boolean hasChildNodes(); + // Modified in DOM Level 4: + [optional_argc] nsIDOMNode cloneNode([optional] in boolean deep); + // Modified in DOM Level 2: + void normalize(); + // Introduced in DOM Level 2: + readonly attribute DOMString namespaceURI; + // Modified in DOM Core + readonly attribute DOMString prefix; + + // Introduced in DOM Level 2: + readonly attribute DOMString localName; + + // For vtable compatibility (see bug 1078674) + [noscript] bool unusedPlaceholder(); + + // Introduced in DOM Level 3: + // This uses a binaryname to avoid warnings due to name collision with + // nsINode::GetBaseURI + [binaryname(DOMBaseURI)] readonly attribute DOMString baseURI; + + // DocumentPosition + const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; + const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; + const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; + const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; + const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; + const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + + // Introduced in DOM Level 3: + unsigned short compareDocumentPosition(in nsIDOMNode other) + raises(DOMException); + // Introduced in DOM Level 3: + attribute DOMString textContent; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + // Introduced in DOM Level 3: + DOMString lookupPrefix(in DOMString namespaceURI); + // Introduced in DOM Level 3: + boolean isDefaultNamespace(in DOMString namespaceURI); + // Introduced in DOM Level 3: + DOMString lookupNamespaceURI(in DOMString prefix); + // Introduced in DOM Level 3: + boolean isEqualNode(in nsIDOMNode arg); + // Introduced in DOM Level 3: + nsIVariant setUserData(in DOMString key, + in nsIVariant data); + // Introduced in DOM Level 3: + nsIVariant getUserData(in DOMString key); + + boolean contains(in nsIDOMNode aOther); +}; diff --git a/dom/interfaces/core/nsIDOMNodeList.idl b/dom/interfaces/core/nsIDOMNodeList.idl new file mode 100644 index 000000000..bb2f76f1a --- /dev/null +++ b/dom/interfaces/core/nsIDOMNodeList.idl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMNodeList interface provides the abstraction of an ordered + * collection of nodes, without defining or constraining how this collection + * is implemented. + * The items in the list are accessible via an integral index, starting from 0. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ + */ + +// NOTE: Please do not attempt to make this not scriptable, +// see https://bugzilla.mozilla.org/show_bug.cgi?id=994964#c73. +[scriptable, uuid(450cf0ba-de90-4f86-85bf-e10cc8b8713f)] +interface nsIDOMNodeList : nsISupports +{ + nsIDOMNode item(in unsigned long index); + readonly attribute unsigned long length; +}; diff --git a/dom/interfaces/core/nsIDOMProcessingInstruction.idl b/dom/interfaces/core/nsIDOMProcessingInstruction.idl new file mode 100644 index 000000000..bcf8724fc --- /dev/null +++ b/dom/interfaces/core/nsIDOMProcessingInstruction.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCharacterData.idl" + +/** + * The nsIDOMProcessingInstruction interface represents a + * "processing instruction", used in XML as a way to keep processor-specific + * information in the text of the document. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Core/ and + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html + */ + +[uuid(5a139df7-04d0-438d-bd18-d8122564258f)] +interface nsIDOMProcessingInstruction : nsIDOMCharacterData +{ + readonly attribute DOMString target; +}; diff --git a/dom/interfaces/core/nsIDOMText.idl b/dom/interfaces/core/nsIDOMText.idl new file mode 100644 index 000000000..72fcf859b --- /dev/null +++ b/dom/interfaces/core/nsIDOMText.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCharacterData.idl" + +/** + * The nsIDOMText interface inherits from nsIDOMCharacterData and represents + * the textual content (termed character data in XML) of an Element or Attr. + * + * For more information on this interface please see + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html + */ + +[uuid(67273994-6aff-4091-9de9-b788a249f783)] +interface nsIDOMText : nsIDOMCharacterData +{ + nsIDOMText splitText(in unsigned long offset) + raises(DOMException); + + /** + * The concatenation of all logically adjacent text nodes with this text + * node, where "logically adjacent" consists of all text nodes which can be + * reached by traversing the document tree in either direction without + * passing an element, comment, or processing-instruction boundary. + */ + readonly attribute DOMString wholeText; +}; diff --git a/dom/interfaces/core/nsIDOMXMLDocument.idl b/dom/interfaces/core/nsIDOMXMLDocument.idl new file mode 100644 index 000000000..218a03290 --- /dev/null +++ b/dom/interfaces/core/nsIDOMXMLDocument.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +// The only reason this interface still exists is that we have addon and Firefox +// code QIing to it and using it for instanceof via Components.interfaces, and +// the interface needs to exist in order for the shim stuff in +// xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp to work. +[uuid(89ab39cb-c568-4d85-bd34-306d5cd5164d)] +interface nsIDOMXMLDocument : nsISupports +{ +}; diff --git a/dom/interfaces/css/moz.build b/dom/interfaces/css/moz.build new file mode 100644 index 000000000..d6457a373 --- /dev/null +++ b/dom/interfaces/css/moz.build @@ -0,0 +1,34 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMCounter.idl', + 'nsIDOMCSSConditionRule.idl', + 'nsIDOMCSSCounterStyleRule.idl', + 'nsIDOMCSSFontFaceRule.idl', + 'nsIDOMCSSFontFeatureValuesRule.idl', + 'nsIDOMCSSGroupingRule.idl', + 'nsIDOMCSSImportRule.idl', + 'nsIDOMCSSKeyframeRule.idl', + 'nsIDOMCSSKeyframesRule.idl', + 'nsIDOMCSSMediaRule.idl', + 'nsIDOMCSSMozDocumentRule.idl', + 'nsIDOMCSSPageRule.idl', + 'nsIDOMCSSPrimitiveValue.idl', + 'nsIDOMCSSRule.idl', + 'nsIDOMCSSRuleList.idl', + 'nsIDOMCSSStyleDeclaration.idl', + 'nsIDOMCSSStyleRule.idl', + 'nsIDOMCSSStyleSheet.idl', + 'nsIDOMCSSSupportsRule.idl', + 'nsIDOMCSSUnknownRule.idl', + 'nsIDOMCSSValue.idl', + 'nsIDOMCSSValueList.idl', + 'nsIDOMRect.idl', +] + +XPIDL_MODULE = 'dom_css' + diff --git a/dom/interfaces/css/nsIDOMCSSConditionRule.idl b/dom/interfaces/css/nsIDOMCSSConditionRule.idl new file mode 100644 index 000000000..5949ad484 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSConditionRule.idl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSGroupingRule.idl" + +/** + * Interface in the CSS OM for at-rules that conditionally apply their + * child rules. + */ +[scriptable, uuid(44da41b2-5660-415d-8692-eae805776103)] +interface nsIDOMCSSConditionRule : nsIDOMCSSGroupingRule +{ + attribute DOMString conditionText; +}; diff --git a/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl b/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl new file mode 100644 index 000000000..0831b2238 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(9b5e48ce-d84c-4e31-aff5-34e9f4141313)] +interface nsIDOMCSSCounterStyleRule : nsIDOMCSSRule +{ + attribute DOMString name; + attribute DOMString system; + attribute DOMString symbols; + attribute DOMString additiveSymbols; + attribute DOMString negative; + attribute DOMString prefix; + attribute DOMString suffix; + attribute DOMString range; + attribute DOMString pad; + attribute DOMString speakAs; + attribute DOMString fallback; +}; diff --git a/dom/interfaces/css/nsIDOMCSSFontFaceRule.idl b/dom/interfaces/css/nsIDOMCSSFontFaceRule.idl new file mode 100644 index 000000000..18ca669f4 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSFontFaceRule.idl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(db971017-fe0c-4529-972c-8217f2fee217)] +interface nsIDOMCSSFontFaceRule : nsIDOMCSSRule +{ + readonly attribute nsIDOMCSSStyleDeclaration style; +}; diff --git a/dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl b/dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl new file mode 100644 index 000000000..1b04dde86 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSFontFeatureValuesRule.idl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(a343d27f-1da6-4fc3-9355-d4ca434f958e)] +interface nsIDOMCSSFontFeatureValuesRule : nsIDOMCSSRule +{ + attribute DOMString fontFamily; + // raises(DOMException) on setting + + attribute DOMString valueText; + // raises(DOMException) on setting +}; diff --git a/dom/interfaces/css/nsIDOMCSSGroupingRule.idl b/dom/interfaces/css/nsIDOMCSSGroupingRule.idl new file mode 100644 index 000000000..80f072d16 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSGroupingRule.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +/** + * Interface for at-rules that have child rules in the CSS OM. + */ +[scriptable, uuid(a0e3324a-f911-4baf-9591-5322c76cbb0d)] +interface nsIDOMCSSGroupingRule : nsIDOMCSSRule +{ + readonly attribute nsIDOMCSSRuleList cssRules; + + unsigned long insertRule(in DOMString rule, + in unsigned long index) + raises(DOMException); + void deleteRule(in unsigned long index) + raises(DOMException); +}; diff --git a/dom/interfaces/css/nsIDOMCSSImportRule.idl b/dom/interfaces/css/nsIDOMCSSImportRule.idl new file mode 100644 index 000000000..0909d9221 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSImportRule.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(d3b2b914-01ef-4663-beda-a6475a26f491)] +interface nsIDOMCSSImportRule : nsIDOMCSSRule +{ + readonly attribute DOMString href; + readonly attribute nsIDOMMediaList media; + readonly attribute nsIDOMCSSStyleSheet styleSheet; +}; diff --git a/dom/interfaces/css/nsIDOMCSSKeyframeRule.idl b/dom/interfaces/css/nsIDOMCSSKeyframeRule.idl new file mode 100644 index 000000000..46e7ffbb1 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSKeyframeRule.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(a281a8b4-eaa2-49a8-8b97-acc2814a57c9)] +interface nsIDOMCSSKeyframeRule : nsIDOMCSSRule +{ + attribute DOMString keyText; + readonly attribute nsIDOMCSSStyleDeclaration style; +}; diff --git a/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl b/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl new file mode 100644 index 000000000..acbb657e4 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)] +interface nsIDOMCSSKeyframesRule : nsIDOMCSSRule +{ + attribute DOMString name; + readonly attribute nsIDOMCSSRuleList cssRules; + + void appendRule(in DOMString rule); + void deleteRule(in DOMString key); + nsIDOMCSSKeyframeRule findRule(in DOMString key); +}; diff --git a/dom/interfaces/css/nsIDOMCSSMediaRule.idl b/dom/interfaces/css/nsIDOMCSSMediaRule.idl new file mode 100644 index 000000000..9be4ba143 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSMediaRule.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSConditionRule.idl" + +/** + * Interface for @media rules in the CSS OM. + */ +[scriptable, uuid(6cf9c5b2-fa0f-43c0-aa50-ef85b4756e3a)] +interface nsIDOMCSSMediaRule : nsIDOMCSSConditionRule +{ + readonly attribute nsIDOMMediaList media; +}; diff --git a/dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl b/dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl new file mode 100644 index 000000000..8b4152fce --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSMozDocumentRule.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSConditionRule.idl" + +/** + * Interface for @-moz-document rules in the CSS OM. + */ +[scriptable, uuid(2d0cef9d-c1b2-4c6c-9003-fa83040626d1)] +interface nsIDOMCSSMozDocumentRule : nsIDOMCSSConditionRule +{ + // XXX Add access to the URL list. +}; diff --git a/dom/interfaces/css/nsIDOMCSSPageRule.idl b/dom/interfaces/css/nsIDOMCSSPageRule.idl new file mode 100644 index 000000000..e586a0dbb --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSPageRule.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(c119072b-7d2f-4aeb-a90d-e2d6b606c32a)] +interface nsIDOMCSSPageRule : nsIDOMCSSRule +{ + //attribute DOMString selectorText; + // raises(DOMException) on setting + + readonly attribute nsIDOMCSSStyleDeclaration style; +}; diff --git a/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl b/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl new file mode 100644 index 000000000..152538505 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl @@ -0,0 +1,62 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSValue.idl" + +/** + * The nsIDOMCSSPrimitiveValue interface is a datatype for a primitive + * CSS value in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(f6df7293-2dc9-4cb9-9531-778caf4370e0)] +interface nsIDOMCSSPrimitiveValue : nsIDOMCSSValue +{ + // UnitTypes + const unsigned short CSS_UNKNOWN = 0; + const unsigned short CSS_NUMBER = 1; + const unsigned short CSS_PERCENTAGE = 2; + const unsigned short CSS_EMS = 3; + const unsigned short CSS_EXS = 4; + const unsigned short CSS_PX = 5; + const unsigned short CSS_CM = 6; + const unsigned short CSS_MM = 7; + const unsigned short CSS_IN = 8; + const unsigned short CSS_PT = 9; + const unsigned short CSS_PC = 10; + const unsigned short CSS_DEG = 11; + const unsigned short CSS_RAD = 12; + const unsigned short CSS_GRAD = 13; + const unsigned short CSS_MS = 14; + const unsigned short CSS_S = 15; + const unsigned short CSS_HZ = 16; + const unsigned short CSS_KHZ = 17; + const unsigned short CSS_DIMENSION = 18; + const unsigned short CSS_STRING = 19; + const unsigned short CSS_URI = 20; + const unsigned short CSS_IDENT = 21; + const unsigned short CSS_ATTR = 22; + const unsigned short CSS_COUNTER = 23; + const unsigned short CSS_RECT = 24; + const unsigned short CSS_RGBCOLOR = 25; + + readonly attribute unsigned short primitiveType; + void setFloatValue(in unsigned short unitType, + in float floatValue) + raises(DOMException); + float getFloatValue(in unsigned short unitType) + raises(DOMException); + void setStringValue(in unsigned short stringType, + in DOMString stringValue) + raises(DOMException); + DOMString getStringValue() + raises(DOMException); + nsIDOMCounter getCounterValue() + raises(DOMException); + nsIDOMRect getRectValue() + raises(DOMException); +}; diff --git a/dom/interfaces/css/nsIDOMCSSRule.idl b/dom/interfaces/css/nsIDOMCSSRule.idl new file mode 100644 index 000000000..f4cc55773 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSRule.idl @@ -0,0 +1,56 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +%{C++ +namespace mozilla { +namespace css { +class Rule; +} +} +%} + +[ptr] native Rule(mozilla::css::Rule); + +/** + * The nsIDOMCSSRule interface is a datatype for a CSS style rule in + * the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[scriptable, uuid(4d6b3bad-f53c-4585-82f6-62982e27ede8)] +interface nsIDOMCSSRule : nsISupports +{ + // RuleType + const unsigned short UNKNOWN_RULE = 0; + const unsigned short STYLE_RULE = 1; + const unsigned short CHARSET_RULE = 2; + const unsigned short IMPORT_RULE = 3; + const unsigned short MEDIA_RULE = 4; + const unsigned short FONT_FACE_RULE = 5; + const unsigned short PAGE_RULE = 6; + const unsigned short KEYFRAMES_RULE = 7; + const unsigned short KEYFRAME_RULE = 8; + // When layout.css.prefixes.animations is disabled/removed, + // we should remove these two MOZ_* constants. + const unsigned short MOZ_KEYFRAMES_RULE = 7; + const unsigned short MOZ_KEYFRAME_RULE = 8; + const unsigned short NAMESPACE_RULE = 10; + const unsigned short COUNTER_STYLE_RULE = 11; + const unsigned short SUPPORTS_RULE = 12; + const unsigned short FONT_FEATURE_VALUES_RULE = 14; + + readonly attribute unsigned short type; + attribute DOMString cssText; + // raises(DOMException) on setting + + readonly attribute nsIDOMCSSStyleSheet parentStyleSheet; + readonly attribute nsIDOMCSSRule parentRule; + + [noscript, nostdcall, notxpcom] Rule getCSSRule(); +}; diff --git a/dom/interfaces/css/nsIDOMCSSRuleList.idl b/dom/interfaces/css/nsIDOMCSSRuleList.idl new file mode 100644 index 000000000..ffe905f27 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSRuleList.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMCSSRuleList interface is a datatype for a list of CSS + * style rules in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[scriptable, uuid(a6cf90c0-15b3-11d2-932e-00805f8add32)] +interface nsIDOMCSSRuleList : nsISupports +{ + readonly attribute unsigned long length; + nsIDOMCSSRule item(in unsigned long index); +}; diff --git a/dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl b/dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl new file mode 100644 index 000000000..b0d569c93 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMCSSStyleDeclaration interface is a datatype for a CSS + * style declaration in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(a6cf90be-15b3-11d2-932e-00805f8add32)] +interface nsIDOMCSSStyleDeclaration : nsISupports +{ + attribute DOMString cssText; + // raises(DOMException) on setting + + DOMString getPropertyValue(in DOMString propertyName); + nsIDOMCSSValue getPropertyCSSValue(in DOMString propertyName); + DOMString removeProperty(in DOMString propertyName) + raises(DOMException); + DOMString getPropertyPriority(in DOMString propertyName); + void setProperty(in DOMString propertyName, + in DOMString value, + [optional] in DOMString priority) + raises(DOMException); + readonly attribute unsigned long length; + DOMString item(in unsigned long index); + readonly attribute nsIDOMCSSRule parentRule; +}; diff --git a/dom/interfaces/css/nsIDOMCSSStyleRule.idl b/dom/interfaces/css/nsIDOMCSSStyleRule.idl new file mode 100644 index 000000000..d94d22d93 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSStyleRule.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(b5e9af48-a7c2-4f88-aae3-58307af4b5a5)] +interface nsIDOMCSSStyleRule : nsIDOMCSSRule +{ + attribute DOMString selectorText; + // raises(DOMException) on setting + + readonly attribute nsIDOMCSSStyleDeclaration style; +}; diff --git a/dom/interfaces/css/nsIDOMCSSStyleSheet.idl b/dom/interfaces/css/nsIDOMCSSStyleSheet.idl new file mode 100644 index 000000000..b9e13134e --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSStyleSheet.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMStyleSheet.idl" + +/** + * The nsIDOMCSSStyleSheet interface is a datatype for a CSS style + * sheet in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(a6cf90c2-15b3-11d2-932e-00805f8add32)] +interface nsIDOMCSSStyleSheet : nsIDOMStyleSheet +{ + readonly attribute nsIDOMCSSRule ownerRule; + readonly attribute nsIDOMCSSRuleList cssRules; + + unsigned long insertRule(in DOMString rule, + in unsigned long index) + raises(DOMException); + void deleteRule(in unsigned long index) + raises(DOMException); +}; diff --git a/dom/interfaces/css/nsIDOMCSSSupportsRule.idl b/dom/interfaces/css/nsIDOMCSSSupportsRule.idl new file mode 100644 index 000000000..953d558fb --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSSupportsRule.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSConditionRule.idl" + +/** + * Interface for @supports rules in the CSS OM. + */ +[scriptable, uuid(0b9e63a1-1bd7-4caf-850e-148b762b14d2)] +interface nsIDOMCSSSupportsRule : nsIDOMCSSConditionRule +{ +}; diff --git a/dom/interfaces/css/nsIDOMCSSUnknownRule.idl b/dom/interfaces/css/nsIDOMCSSUnknownRule.idl new file mode 100644 index 000000000..6dfb5ec69 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSUnknownRule.idl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(98f4c27b-fb35-4355-8fd9-546c4697d71a)] +interface nsIDOMCSSUnknownRule : nsIDOMCSSRule +{ +}; diff --git a/dom/interfaces/css/nsIDOMCSSValue.idl b/dom/interfaces/css/nsIDOMCSSValue.idl new file mode 100644 index 000000000..52139fbd6 --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSValue.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMCSSValue interface is a datatype for a CSS value in the + * Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(009f7ea5-9e80-41be-b008-db62f10823f2)] +interface nsIDOMCSSValue : nsISupports +{ + // UnitTypes + const unsigned short CSS_INHERIT = 0; + const unsigned short CSS_PRIMITIVE_VALUE = 1; + const unsigned short CSS_VALUE_LIST = 2; + const unsigned short CSS_CUSTOM = 3; + + attribute DOMString cssText; + // raises(DOMException) on setting + + readonly attribute unsigned short cssValueType; +}; diff --git a/dom/interfaces/css/nsIDOMCSSValueList.idl b/dom/interfaces/css/nsIDOMCSSValueList.idl new file mode 100644 index 000000000..a797df1bc --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSValueList.idl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" +#include "nsIDOMCSSValue.idl" + +[uuid(92364ed1-e364-4175-bc52-c2fe9671cbc7)] +interface nsIDOMCSSValueList : nsIDOMCSSValue +{ +}; diff --git a/dom/interfaces/css/nsIDOMCounter.idl b/dom/interfaces/css/nsIDOMCounter.idl new file mode 100644 index 000000000..b5c408fbe --- /dev/null +++ b/dom/interfaces/css/nsIDOMCounter.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(31adb439-0055-402d-9b1d-d5ca94f3f55b)] +interface nsIDOMCounter : nsISupports +{ + readonly attribute DOMString identifier; + readonly attribute DOMString listStyle; + readonly attribute DOMString separator; +}; diff --git a/dom/interfaces/css/nsIDOMRect.idl b/dom/interfaces/css/nsIDOMRect.idl new file mode 100644 index 000000000..4de84796c --- /dev/null +++ b/dom/interfaces/css/nsIDOMRect.idl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(71735f62-ac5c-4236-9a1f-5ffb280d531c)] +interface nsIDOMRect : nsISupports +{ + readonly attribute nsIDOMCSSPrimitiveValue top; + readonly attribute nsIDOMCSSPrimitiveValue right; + readonly attribute nsIDOMCSSPrimitiveValue bottom; + readonly attribute nsIDOMCSSPrimitiveValue left; +}; diff --git a/dom/interfaces/events/moz.build b/dom/interfaces/events/moz.build new file mode 100644 index 000000000..fb1dc6a21 --- /dev/null +++ b/dom/interfaces/events/moz.build @@ -0,0 +1,35 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMAnimationEvent.idl', + 'nsIDOMBeforeUnloadEvent.idl', + 'nsIDOMClipboardEvent.idl', + 'nsIDOMCommandEvent.idl', + 'nsIDOMCustomEvent.idl', + 'nsIDOMDataContainerEvent.idl', + 'nsIDOMDataTransfer.idl', + 'nsIDOMDragEvent.idl', + 'nsIDOMEvent.idl', + 'nsIDOMEventListener.idl', + 'nsIDOMEventTarget.idl', + 'nsIDOMFocusEvent.idl', + 'nsIDOMKeyEvent.idl', + 'nsIDOMMouseEvent.idl', + 'nsIDOMMouseScrollEvent.idl', + 'nsIDOMMutationEvent.idl', + 'nsIDOMNotifyPaintEvent.idl', + 'nsIDOMNSEvent.idl', + 'nsIDOMPaintRequest.idl', + 'nsIDOMScrollAreaEvent.idl', + 'nsIDOMSimpleGestureEvent.idl', + 'nsIDOMTransitionEvent.idl', + 'nsIDOMUIEvent.idl', + 'nsIDOMWheelEvent.idl', +] + +XPIDL_MODULE = 'dom_events' + diff --git a/dom/interfaces/events/nsIDOMAnimationEvent.idl b/dom/interfaces/events/nsIDOMAnimationEvent.idl new file mode 100644 index 000000000..2f4e527db --- /dev/null +++ b/dom/interfaces/events/nsIDOMAnimationEvent.idl @@ -0,0 +1,20 @@ +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * Animation events are defined in: + * http://www.w3.org/TR/css3-animations/#animation-events- + * http://dev.w3.org/csswg/css3-animations/#animation-events- + */ + +[builtinclass, uuid(ce6d1db3-53b8-4ade-9baa-70f4947200a2)] +interface nsIDOMAnimationEvent : nsISupports +{ + readonly attribute DOMString animationName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; diff --git a/dom/interfaces/events/nsIDOMBeforeUnloadEvent.idl b/dom/interfaces/events/nsIDOMBeforeUnloadEvent.idl new file mode 100644 index 000000000..3fe0451db --- /dev/null +++ b/dom/interfaces/events/nsIDOMBeforeUnloadEvent.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * The nsIDOMBeforeUnloadEvent interface is the interface for events + * sent to handlers of the "beforeunload" event. This event is + * non-standard. Interface derived from Microsoft IE's event + * implementation. + * + * http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events.asp + * + */ + +[builtinclass, uuid(26c83933-a5a4-455e-8c46-69fa24dfa991)] +interface nsIDOMBeforeUnloadEvent : nsISupports +{ + /** + * Attribute used to pass back a return value from a beforeunload + * handler + */ + attribute DOMString returnValue; +}; diff --git a/dom/interfaces/events/nsIDOMClipboardEvent.idl b/dom/interfaces/events/nsIDOMClipboardEvent.idl new file mode 100644 index 000000000..a92093a13 --- /dev/null +++ b/dom/interfaces/events/nsIDOMClipboardEvent.idl @@ -0,0 +1,22 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" +#include "nsISupports.idl" + +interface nsIDOMDataTransfer; + +[builtinclass, uuid(b54d6144-3980-4895-83c7-82f158bc1cf5)] +interface nsIDOMClipboardEvent : nsISupports +{ + readonly attribute nsIDOMDataTransfer clipboardData; + + // The constructor must be used from script to initialize + // clipboard events. + [noscript] void initClipboardEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in nsIDOMDataTransfer clipboardData); +}; diff --git a/dom/interfaces/events/nsIDOMCommandEvent.idl b/dom/interfaces/events/nsIDOMCommandEvent.idl new file mode 100644 index 000000000..3d1b8adc7 --- /dev/null +++ b/dom/interfaces/events/nsIDOMCommandEvent.idl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[builtinclass, uuid(73a50e55-3eaa-4a38-a588-9b68a6d65032)] +interface nsIDOMCommandEvent : nsISupports +{ + readonly attribute DOMString command; + + void initCommandEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean canCancelArg, + in DOMString command); +}; diff --git a/dom/interfaces/events/nsIDOMCustomEvent.idl b/dom/interfaces/events/nsIDOMCustomEvent.idl new file mode 100644 index 000000000..878052719 --- /dev/null +++ b/dom/interfaces/events/nsIDOMCustomEvent.idl @@ -0,0 +1,19 @@ +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +interface nsIVariant; + +[builtinclass, uuid(5be16b03-36f9-4ca8-b2c5-0daadf3cd1b3)] +interface nsIDOMCustomEvent : nsISupports +{ + + readonly attribute nsIVariant detail; + + void initCustomEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in nsIVariant detailArg); +}; diff --git a/dom/interfaces/events/nsIDOMDataContainerEvent.idl b/dom/interfaces/events/nsIDOMDataContainerEvent.idl new file mode 100644 index 000000000..fce27fc12 --- /dev/null +++ b/dom/interfaces/events/nsIDOMDataContainerEvent.idl @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIVariant.idl" + +[builtinclass, uuid(a9f1f528-d106-4fea-8663-2d7f64b627a9)] +interface nsIDOMDataContainerEvent : nsISupports +{ + /** + * Return the data associated with the given key. + * + * @param key the key + * @return the data associated with the key + */ + nsIVariant getData(in DOMString key); + + /** + * Set the data for the given key. + * + * @param key the data key + * @param data the data + * @throws NS_ERROR_UNEXPECTED if the method is called during event + * dispatch + */ + void setData(in DOMString key, in nsIVariant data); +}; + diff --git a/dom/interfaces/events/nsIDOMDataTransfer.idl b/dom/interfaces/events/nsIDOMDataTransfer.idl new file mode 100644 index 000000000..ada7b4fb8 --- /dev/null +++ b/dom/interfaces/events/nsIDOMDataTransfer.idl @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIVariant; +interface nsIDOMFileList; + +[builtinclass, uuid(655078bf-1675-4aa0-a48d-a133e864ce57)] +interface nsIDOMDataTransfer : nsISupports +{ + /** + * The actual effect that will be used, and should always be one of the + * possible values of effectAllowed. + * + * For dragstart, drag and dragleave events, the dropEffect is initialized + * to none. Any value assigned to the dropEffect will be set, but the value + * isn't used for anything. + * + * For the dragenter and dragover events, the dropEffect will be initialized + * based on what action the user is requesting. How this is determined is + * platform specific, but typically the user can press modifier keys to + * adjust which action is desired. Within an event handler for the dragenter + * and dragover events, the dropEffect should be modified if the action the + * user is requesting is not the one that is desired. + * + * For the drop and dragend events, the dropEffect will be initialized to + * the action that was desired, which will be the value that the dropEffect + * had after the last dragenter or dragover event. + * + * Possible values: + * copy - a copy of the source item is made at the new location + * move - an item is moved to a new location + * link - a link is established to the source at the new location + * none - the item may not be dropped + * + * Assigning any other value has no effect and retains the old value. + */ + attribute DOMString dropEffect; + + /* + * Specifies the effects that are allowed for this drag. You may set this in + * the dragstart event to set the desired effects for the source, and within + * the dragenter and dragover events to set the desired effects for the + * target. The value is not used for other events. + * + * Possible values: + * copy - a copy of the source item is made at the new location + * move - an item is moved to a new location + * link - a link is established to the source at the new location + * copyLink, copyMove, linkMove, all - combinations of the above + * none - the item may not be dropped + * uninitialized - the default value when the effect has not been set, + * equivalent to all. + * + * Assigning any other value has no effect and retains the old value. + */ + attribute DOMString effectAllowed; + + /** + * Holds a list of all the local files available on this data transfer. + * A dataTransfer containing no files will return an empty list, and an + * invalid index access on the resulting file list will return null. + */ + readonly attribute nsIDOMFileList files; + + /** + * Set the image to be used for dragging if a custom one is desired. Most of + * the time, this would not be set, as a default image is created from the + * node that was dragged. + * + * If the node is an HTML img element, an HTML canvas element or a XUL image + * element, the image data is used. Otherwise, image should be a visible + * node and the drag image will be created from this. If image is null, any + * custom drag image is cleared and the default is used instead. + * + * The coordinates specify the offset into the image where the mouse cursor + * should be. To center the image for instance, use values that are half the + * width and height. + * + * @param image a node to use + * @param x the horizontal offset + * @param y the vertical offset + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + void setDragImage(in nsIDOMElement image, in long x, in long y); + + /* + * Set the drag source. Usually you would not change this, but it will + * affect which node the drag and dragend events are fired at. The + * default target is the node that was dragged. + * + * @param element drag source to use + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + void addElement(in nsIDOMElement element); + + /** + * The number of items being dragged. + */ + readonly attribute unsigned long mozItemCount; + + /** + * Sets the drag cursor state. Primarily used to control the cursor during + * tab drags, but could be expanded to other uses. XXX Currently implemented + * on Win32 only. + * + * Possible values: + * auto - use default system behavior. + * default - set the cursor to an arrow during the drag operation. + * + * Values other than 'default' are indentical to setting mozCursor to + * 'auto'. + */ + attribute DOMString mozCursor; + + /** + * Holds a list of the format types of the data that is stored for an item + * at the specified index. If the index is not in the range from 0 to + * itemCount - 1, an empty string list is returned. + */ + nsISupports mozTypesAt(in unsigned long index); + + /** + * Will be true when the user has cancelled the drag (typically by pressing + * Escape) and when the drag has been cancelled unexpectedly. This will be + * false otherwise, including when the drop has been rejected by its target. + * This property is only relevant for the dragend event. + */ + readonly attribute boolean mozUserCancelled; + + /** + * The node that the mouse was pressed over to begin the drag. For external + * drags, or if the caller cannot access this node, this will be null. + */ + readonly attribute nsIDOMNode mozSourceNode; + + /* + * Integer version of dropEffect, set to one of the constants in nsIDragService. + */ + [noscript] attribute unsigned long dropEffectInt; + + /* + * Integer version of effectAllowed, set to one or a combination of the + * constants in nsIDragService. + */ + [noscript] attribute unsigned long effectAllowedInt; +}; diff --git a/dom/interfaces/events/nsIDOMDragEvent.idl b/dom/interfaces/events/nsIDOMDragEvent.idl new file mode 100644 index 000000000..9f59eb51e --- /dev/null +++ b/dom/interfaces/events/nsIDOMDragEvent.idl @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" +#include "nsIDOMMouseEvent.idl" + +interface nsIDOMDataTransfer; + +[builtinclass, uuid(d5c0d4c2-c646-4b4b-836e-48408b9c7b80)] +interface nsIDOMDragEvent : nsIDOMMouseEvent +{ + readonly attribute nsIDOMDataTransfer dataTransfer; +}; diff --git a/dom/interfaces/events/nsIDOMEvent.idl b/dom/interfaces/events/nsIDOMEvent.idl new file mode 100644 index 000000000..69eb9384b --- /dev/null +++ b/dom/interfaces/events/nsIDOMEvent.idl @@ -0,0 +1,221 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMEventTarget; + +[ptr] native WidgetEvent(mozilla::WidgetEvent); +[ptr] native DOMEventPtr(mozilla::dom::Event); +[ptr] native IPCMessagePtr(IPC::Message); +[ptr] native ConstIPCMessagePtr(const IPC::Message); +[ptr] native PickleIterator(PickleIterator); +[ptr] native EventTargetPtr(mozilla::dom::EventTarget); +%{C++ +#ifdef ERROR +#undef ERROR +#endif + +#include "mozilla/EventForwards.h" +class nsPresContext; +class nsInvalidateRequestList; +namespace IPC { +class Message; +} +class PickleIterator; +namespace mozilla { +namespace dom { +class Event; +class EventTarget; +} // namespace dom +} // namespace mozilla +%} + +/** + * The nsIDOMEvent interface is the primary datatype for all events in + * the Document Object Model. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html + */ + +[builtinclass, uuid(f58daacf-4d1a-4002-8fd7-06b614dfbcf6)] +interface nsIDOMEvent : nsISupports +{ + // PhaseType + /** + * The event isn't being dispatched. + */ + const unsigned short NONE = 0; + /** + * The current event phase is the capturing phase. + */ + const unsigned short CAPTURING_PHASE = 1; + + /** + * The event is currently being evaluated at the target EventTarget. + */ + const unsigned short AT_TARGET = 2; + + /** + * The current event phase is the bubbling phase. + */ + const unsigned short BUBBLING_PHASE = 3; + + /** + * The name of the event (case-insensitive). The name must be an XML + * name. + */ + readonly attribute DOMString type; + + /** + * Used to indicate the EventTarget to which the event was originally + * dispatched. + */ + readonly attribute nsIDOMEventTarget target; + + /** + * Used to indicate the EventTarget whose EventListeners are currently + * being processed. This is particularly useful during capturing and + * bubbling. + */ + readonly attribute nsIDOMEventTarget currentTarget; + + /** + * Used to indicate which phase of event flow is currently being + * evaluated. + */ + readonly attribute unsigned short eventPhase; + + /** + * Used to indicate whether or not an event is a bubbling event. If the + * event can bubble the value is true, else the value is false. + */ + readonly attribute boolean bubbles; + + /** + * Used to indicate whether or not an event can have its default action + * prevented. If the default action can be prevented the value is true, + * else the value is false. + */ + readonly attribute boolean cancelable; + + /** + * Used to specify the time (in milliseconds relative to the epoch) at + * which the event was created. Due to the fact that some systems may + * not provide this information the value of timeStamp may be not + * available for all events. When not available, a value of 0 will be + * returned. Examples of epoch time are the time of the system start or + * 0:0:0 UTC 1st January 1970. + */ + readonly attribute DOMTimeStamp timeStamp; + + /** + * The stopPropagation method is used prevent further propagation of an + * event during event flow. If this method is called by any + * EventListener the event will cease propagating through the tree. The + * event will complete dispatch to all listeners on the current + * EventTarget before event flow stops. This method may be used during + * any stage of event flow. + */ + void stopPropagation(); + + /** + * If an event is cancelable, the preventDefault method is used to + * signify that the event is to be canceled, meaning any default action + * normally taken by the implementation as a result of the event will + * not occur. If, during any stage of event flow, the preventDefault + * method is called the event is canceled. Any default action associated + * with the event will not occur. Calling this method for a + * non-cancelable event has no effect. Once preventDefault has been + * called it will remain in effect throughout the remainder of the + * event's propagation. This method may be used during any stage of + * event flow. + */ + void preventDefault(); + + /** + * The initEvent method is used to initialize the value of an Event + * created through the DocumentEvent interface. This method may only be + * called before the Event has been dispatched via the dispatchEvent + * method, though it may be called multiple times during that phase if + * necessary. If called multiple times the final invocation takes + * precedence. If called from a subclass of Event interface only the + * values specified in the initEvent method are modified, all other + * attributes are left unchanged. + * + * @param eventTypeArg Specifies the event type. This type may be + * any event type currently defined in this + * specification or a new event type.. The string + * must be an XML name. + * Any new event type must not begin with any + * upper, lower, or mixed case version of the + * string "DOM". This prefix is reserved for + * future DOM event sets. It is also strongly + * recommended that third parties adding their + * own events use their own prefix to avoid + * confusion and lessen the probability of + * conflicts with other new events. + * @param canBubbleArg Specifies whether or not the event can bubble. + * @param cancelableArg Specifies whether or not the event's default + * action can be prevented. + */ + [notxpcom,nostdcall] + void initEvent(in DOMString eventTypeArg, + in boolean canBubbleArg, + in boolean cancelableArg); + + /** + * Used to indicate whether preventDefault() has been called for this event. + */ + readonly attribute boolean defaultPrevented; + + /** + * Prevents other event listeners from being triggered and, + * unlike Event.stopPropagation() its effect is immediate. + */ + void stopImmediatePropagation(); + + const long ALT_MASK = 0x00000001; + const long CONTROL_MASK = 0x00000002; + const long SHIFT_MASK = 0x00000004; + const long META_MASK = 0x00000008; + + /** The original target of the event, before any retargetings. */ + readonly attribute nsIDOMEventTarget originalTarget; + /** + * The explicit original target of the event. If the event was retargeted + * for some reason other than an anonymous boundary crossing, this will be set + * to the target before the retargeting occurs. For example, mouse events + * are retargeted to their parent node when they happen over text nodes (bug + * 185889), and in that case .target will show the parent and + * .explicitOriginalTarget will show the text node. + * .explicitOriginalTarget differs from .originalTarget in that it will never + * contain anonymous content. + */ + readonly attribute nsIDOMEventTarget explicitOriginalTarget; + + /** + * @deprecated Use nsIDOMEvent::defaultPrevented. + * To be removed in bug 691151. + */ + boolean getPreventDefault(); + + readonly attribute boolean isTrusted; + attribute boolean cancelBubble; + + [noscript] void duplicatePrivateData(); + [noscript] void setTarget(in nsIDOMEventTarget aTarget); + [notxpcom] boolean IsDispatchStopped(); + [notxpcom] WidgetEvent WidgetEventPtr(); + [noscript,notxpcom] void SetTrusted(in boolean aTrusted); + [notxpcom] void Serialize(in IPCMessagePtr aMsg, + in boolean aSerializeInterfaceType); + [notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, in PickleIterator aIter); + [noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner); + [notxpcom] DOMEventPtr InternalDOMEvent(); + [noscript] void stopCrossProcessForwarding(); +}; diff --git a/dom/interfaces/events/nsIDOMEventListener.idl b/dom/interfaces/events/nsIDOMEventListener.idl new file mode 100644 index 000000000..347ae6b61 --- /dev/null +++ b/dom/interfaces/events/nsIDOMEventListener.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMEventListener interface is a callback interface for + * listening to events in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Events/ + */ + +[scriptable, function, uuid(df31c120-ded6-11d1-bd85-00805f8ae3f4)] +interface nsIDOMEventListener : nsISupports +{ + /** + * This method is called whenever an event occurs of the type for which + * the EventListener interface was registered. + * + * @param evt The Event contains contextual information about the + * event. It also contains the stopPropagation and + * preventDefault methods which are used in determining the + * event's flow and default action. + */ + void handleEvent(in nsIDOMEvent event); +}; diff --git a/dom/interfaces/events/nsIDOMEventTarget.idl b/dom/interfaces/events/nsIDOMEventTarget.idl new file mode 100644 index 000000000..a7e3aae5a --- /dev/null +++ b/dom/interfaces/events/nsIDOMEventTarget.idl @@ -0,0 +1,304 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +%{C++ +#include "mozilla/EventForwards.h" +#include "mozilla/dom/Nullable.h" +#include "js/TypeDecls.h" + +using mozilla::dom::Nullable; + +namespace mozilla { +class EventChainPostVisitor; +class EventChainPreVisitor; +class EventListenerManager; +namespace dom { +class EventTarget; +} // namespace dom +} // namespace mozilla + +class nsPresContext; +%} + +/** + * The nsIDOMEventTarget interface is the interface implemented by all + * event targets in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Events/ + */ + +[ptr] native WidgetEventPtr(mozilla::WidgetEvent); +[ptr] native nsPresContextPtr(nsPresContext); +[ptr] native nsEventStatusPtr(nsEventStatus); +[ptr] native JSContextPtr(JSContext); +[ref] native EventChainPostVisitorRef(mozilla::EventChainPostVisitor); +[ref] native EventChainPreVisitorRef(mozilla::EventChainPreVisitor); +[ptr] native EventListenerManagerPtr(mozilla::EventListenerManager); +[ptr] native EventTargetPtr(mozilla::dom::EventTarget); + +interface nsIScriptContext; +interface nsIDOMEventListener; +interface nsIDOMEvent; + +[scriptable, builtinclass, uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)] +interface nsIDOMEventTarget : nsISupports +{ + /** + * This method allows the registration of event listeners on the event target. + * If an EventListener is added to an EventTarget while it is processing an + * event, it will not be triggered by the current actions but may be + * triggered during a later stage of event flow, such as the bubbling phase. + * + * If multiple identical EventListeners are registered on the same + * EventTarget with the same parameters the duplicate instances are + * discarded. They do not cause the EventListener to be called twice + * and since they are discarded they do not need to be removed with the + * removeEventListener method. + * + * @param type The event type for which the user is registering + * @param listener The listener parameter takes an interface + * implemented by the user which contains the methods + * to be called when the event occurs. + * @param useCapture If true, useCapture indicates that the user + * wishes to initiate capture. After initiating + * capture, all events of the specified type will be + * dispatched to the registered EventListener before + * being dispatched to any EventTargets beneath them + * in the tree. Events which are bubbling upward + * through the tree will not trigger an + * EventListener designated to use capture. + * @param wantsUntrusted If false, the listener will not receive any + * untrusted events (see above), if true, the + * listener will receive events whether or not + * they're trusted + */ + [optional_argc] void addEventListener(in DOMString type, + in nsIDOMEventListener listener, + [optional] in boolean useCapture, + [optional] in boolean wantsUntrusted); + + /** + * addSystemEventListener() adds an event listener of aType to the system + * group. Typically, core code should use system group for listening to + * content (i.e., non-chrome) element's events. If core code uses + * nsIDOMEventTarget::AddEventListener for a content node, it means + * that the listener cannot listen the event when web content calls + * stopPropagation() of the event. + * + * @param aType An event name you're going to handle. + * @param aListener An event listener. + * @param aUseCapture TRUE if you want to listen the event in capturing + * phase. Otherwise, FALSE. + * @param aWantsUntrusted TRUE if you want to handle untrusted events. + * Otherwise, FALSE. + * @return NS_OK if succeed. Otherwise, NS_ERROR_*. + */ + [noscript, optional_argc] void addSystemEventListener( + in DOMString type, + in nsIDOMEventListener listener, + [optional] in boolean aUseCapture, + [optional] in boolean aWantsUntrusted); + +%{C++ + // non-virtual so it won't affect the vtable + nsresult AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + bool aUseCapture) + { + return AddEventListener(aType, aListener, aUseCapture, false, 1); + } + // non-virtual so it won't affect the vtable + nsresult AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + bool aUseCapture, + bool aWantsUntrusted) + { + return AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted, 2); + } + // non-virtual so it won't affect the vtable + nsresult AddSystemEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + bool aUseCapture) + { + return AddSystemEventListener(aType, aListener, aUseCapture, false, 1); + } + // non-virtual so it won't affect the vtable + nsresult AddSystemEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + bool aUseCapture, + bool aWantsUntrusted) + { + return AddSystemEventListener(aType, aListener, aUseCapture, + aWantsUntrusted, 2); + } +%} + + /** + * This method allows the removal of event listeners from the event + * target. If an EventListener is removed from an EventTarget while it + * is processing an event, it will not be triggered by the current actions. + * EventListeners can never be invoked after being removed. + * Calling removeEventListener with arguments which do not identify any + * currently registered EventListener on the EventTarget has no effect. + * + * @param type Specifies the event type of the EventListener being + * removed. + * @param listener The EventListener parameter indicates the + * EventListener to be removed. + * @param useCapture Specifies whether the EventListener being + * removed was registered as a capturing listener or + * not. If a listener was registered twice, one with + * capture and one without, each must be removed + * separately. Removal of a capturing listener does + * not affect a non-capturing version of the same + * listener, and vice versa. + */ + void removeEventListener(in DOMString type, + in nsIDOMEventListener listener, + [optional] in boolean useCapture); + + /** + * removeSystemEventListener() should be used if you have used + * addSystemEventListener(). + */ + [noscript] void removeSystemEventListener( + in DOMString type, + in nsIDOMEventListener listener, + [optional] in boolean aUseCapture); + + /** + * This method allows the dispatch of events into the implementations + * event model. Events dispatched in this manner will have the same + * capturing and bubbling behavior as events dispatched directly by the + * implementation. The target of the event is the EventTarget on which + * dispatchEvent is called. + * + * @param evt Specifies the event type, behavior, and contextual + * information to be used in processing the event. + * @return Indicates whether any of the listeners which handled the + * event called preventDefault. If preventDefault was called + * the value is false, else the value is true. + * @throws INVALID_STATE_ERR: Raised if the Event's type was + * not specified by initializing the event before + * dispatchEvent was called. Specification of the Event's + * type as null or an empty string will also trigger this + * exception. + */ + boolean dispatchEvent(in nsIDOMEvent evt) + raises(DOMException); + + /** + * Returns the nsIDOMEventTarget object which should be used as the target + * of DOMEvents. + * Usually |this| is returned, but for example global object returns + * the outer object. + */ + [notxpcom, nostdcall] EventTargetPtr GetTargetForDOMEvent(); + + /** + * Returns the nsIDOMEventTarget object which should be used as the target + * of the event and when constructing event target chain. + * Usually |this| is returned, but for example global object returns + * the inner object. + */ + [notxpcom, nostdcall] EventTargetPtr GetTargetForEventTargetChain(); + + /** + * Called before the capture phase of the event flow. + * This is used to create the event target chain and implementations + * should set the necessary members of EventChainPreVisitor. + * At least aVisitor.mCanHandle must be set, + * usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE. + * First one tells that this object can handle the aVisitor.mEvent event and + * the latter one is the possible parent object for the event target chain. + * @see EventDispatcher.h for more documentation about aVisitor. + * + * @param aVisitor the visitor object which is used to create the + * event target chain for event dispatching. + * + * @note Only EventDispatcher should call this method. + */ + [noscript, nostdcall] + void PreHandleEvent(in EventChainPreVisitorRef aVisitor); + + /** + * If EventChainPreVisitor.mWantsWillHandleEvent is set PR_TRUE, + * called just before possible event handlers on this object will be called. + */ + [noscript, nostdcall] + void WillHandleEvent(in EventChainPostVisitorRef aVisitor); + + /** + * Called after the bubble phase of the system event group. + * The default handling of the event should happen here. + * @param aVisitor the visitor object which is used during post handling. + * + * @see EventDispatcher.h for documentation about aVisitor. + * @note Only EventDispatcher should call this method. + */ + [noscript, nostdcall] + void PostHandleEvent(in EventChainPostVisitorRef aVisitor); + + /** + * Dispatch an event. + * @param aEvent the event that is being dispatched. + * @param aDOMEvent the event that is being dispatched, use if you want to + * dispatch nsIDOMEvent, not only WidgetEvent. + * @param aPresContext the current presentation context, can be nullptr. + * @param aEventStatus the status returned from the function, can be nullptr. + * + * @note If both aEvent and aDOMEvent are used, aEvent must be the internal + * event of the aDOMEvent. + * + * If aDOMEvent is not nullptr (in which case aEvent can be nullptr) it is used + * for dispatching, otherwise aEvent is used. + * + * @deprecated This method is here just until all the callers outside Gecko + * have been converted to use nsIDOMEventTarget::dispatchEvent. + */ + [noscript, nostdcall] + void DispatchDOMEvent(in WidgetEventPtr aEvent, + in nsIDOMEvent aDOMEvent, + in nsPresContextPtr aPresContext, + in nsEventStatusPtr aEventStatus); + + /** + * Get the script context in which the event handlers should be run. + * May return null. + * @note Caller *must* check the value of aRv. + */ + [notxpcom, nostdcall] + nsIScriptContext GetContextForEventHandlers(out nsresult aRv); +}; + +%{C++ + +#define NS_IMPL_DOMTARGET_DEFAULTS(_class) \ +mozilla::dom::EventTarget* _class::GetTargetForDOMEvent() { return this; } \ +mozilla::dom::EventTarget* _class::GetTargetForEventTargetChain() { return this; } \ +nsresult _class::WillHandleEvent(mozilla::EventChainPostVisitor& aVisitor) { return NS_OK; } + +#define NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(aClass) \ +NS_IMETHODIMP \ +aClass::RemoveSystemEventListener(const nsAString& aType, \ + nsIDOMEventListener *aListener, \ + bool aUseCapture) \ +{ \ + mozilla::EventListenerManager* listenerManager = \ + GetExistingListenerManager(); \ + if (!listenerManager) { \ + return NS_OK; \ + } \ + mozilla::EventListenerFlags flags; \ + flags.mInSystemGroup = true; \ + flags.mCapture = aUseCapture; \ + listenerManager->RemoveEventListenerByType(aListener, aType, flags); \ + return NS_OK; \ +} + +%} diff --git a/dom/interfaces/events/nsIDOMFocusEvent.idl b/dom/interfaces/events/nsIDOMFocusEvent.idl new file mode 100644 index 000000000..78be87ee8 --- /dev/null +++ b/dom/interfaces/events/nsIDOMFocusEvent.idl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMUIEvent.idl" + +[builtinclass, uuid(ceab9fcd-2cae-42cb-b692-effa7ec48848)] +interface nsIDOMFocusEvent : nsIDOMUIEvent +{ + readonly attribute nsIDOMEventTarget relatedTarget; +}; diff --git a/dom/interfaces/events/nsIDOMKeyEvent.idl b/dom/interfaces/events/nsIDOMKeyEvent.idl new file mode 100644 index 000000000..ee026232a --- /dev/null +++ b/dom/interfaces/events/nsIDOMKeyEvent.idl @@ -0,0 +1,258 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMUIEvent.idl" + +[builtinclass, uuid(2e52eb99-670d-469a-b51f-8efee2dd091d)] +interface nsIDOMKeyEvent : nsIDOMUIEvent +{ + const unsigned long DOM_VK_CANCEL = 0x03; + const unsigned long DOM_VK_HELP = 0x06; + const unsigned long DOM_VK_BACK_SPACE = 0x08; + const unsigned long DOM_VK_TAB = 0x09; + const unsigned long DOM_VK_CLEAR = 0x0C; + const unsigned long DOM_VK_RETURN = 0x0D; + // DOM_VK_ENTER has been never used for representing native key events. + // Therefore, it's removed for preventing developers being confused. + // const unsigned long DOM_VK_ENTER = 0x0E; + const unsigned long DOM_VK_SHIFT = 0x10; + const unsigned long DOM_VK_CONTROL = 0x11; + const unsigned long DOM_VK_ALT = 0x12; + const unsigned long DOM_VK_PAUSE = 0x13; + const unsigned long DOM_VK_CAPS_LOCK = 0x14; + const unsigned long DOM_VK_KANA = 0x15; + const unsigned long DOM_VK_HANGUL = 0x15; + const unsigned long DOM_VK_EISU = 0x16; // Japanese Mac keyboard only + const unsigned long DOM_VK_JUNJA = 0x17; + const unsigned long DOM_VK_FINAL = 0x18; + const unsigned long DOM_VK_HANJA = 0x19; + const unsigned long DOM_VK_KANJI = 0x19; + const unsigned long DOM_VK_ESCAPE = 0x1B; + const unsigned long DOM_VK_CONVERT = 0x1C; + const unsigned long DOM_VK_NONCONVERT = 0x1D; + const unsigned long DOM_VK_ACCEPT = 0x1E; + const unsigned long DOM_VK_MODECHANGE = 0x1F; + const unsigned long DOM_VK_SPACE = 0x20; + const unsigned long DOM_VK_PAGE_UP = 0x21; + const unsigned long DOM_VK_PAGE_DOWN = 0x22; + const unsigned long DOM_VK_END = 0x23; + const unsigned long DOM_VK_HOME = 0x24; + const unsigned long DOM_VK_LEFT = 0x25; + const unsigned long DOM_VK_UP = 0x26; + const unsigned long DOM_VK_RIGHT = 0x27; + const unsigned long DOM_VK_DOWN = 0x28; + const unsigned long DOM_VK_SELECT = 0x29; + const unsigned long DOM_VK_PRINT = 0x2A; + const unsigned long DOM_VK_EXECUTE = 0x2B; + const unsigned long DOM_VK_PRINTSCREEN = 0x2C; + const unsigned long DOM_VK_INSERT = 0x2D; + const unsigned long DOM_VK_DELETE = 0x2E; + + // DOM_VK_0 - DOM_VK_9 match their ascii values + const unsigned long DOM_VK_0 = 0x30; + const unsigned long DOM_VK_1 = 0x31; + const unsigned long DOM_VK_2 = 0x32; + const unsigned long DOM_VK_3 = 0x33; + const unsigned long DOM_VK_4 = 0x34; + const unsigned long DOM_VK_5 = 0x35; + const unsigned long DOM_VK_6 = 0x36; + const unsigned long DOM_VK_7 = 0x37; + const unsigned long DOM_VK_8 = 0x38; + const unsigned long DOM_VK_9 = 0x39; + + const unsigned long DOM_VK_COLON = 0x3A; + const unsigned long DOM_VK_SEMICOLON = 0x3B; + const unsigned long DOM_VK_LESS_THAN = 0x3C; + const unsigned long DOM_VK_EQUALS = 0x3D; + const unsigned long DOM_VK_GREATER_THAN = 0x3E; + const unsigned long DOM_VK_QUESTION_MARK = 0x3F; + const unsigned long DOM_VK_AT = 0x40; + + // DOM_VK_A - DOM_VK_Z match their ascii values + const unsigned long DOM_VK_A = 0x41; + const unsigned long DOM_VK_B = 0x42; + const unsigned long DOM_VK_C = 0x43; + const unsigned long DOM_VK_D = 0x44; + const unsigned long DOM_VK_E = 0x45; + const unsigned long DOM_VK_F = 0x46; + const unsigned long DOM_VK_G = 0x47; + const unsigned long DOM_VK_H = 0x48; + const unsigned long DOM_VK_I = 0x49; + const unsigned long DOM_VK_J = 0x4A; + const unsigned long DOM_VK_K = 0x4B; + const unsigned long DOM_VK_L = 0x4C; + const unsigned long DOM_VK_M = 0x4D; + const unsigned long DOM_VK_N = 0x4E; + const unsigned long DOM_VK_O = 0x4F; + const unsigned long DOM_VK_P = 0x50; + const unsigned long DOM_VK_Q = 0x51; + const unsigned long DOM_VK_R = 0x52; + const unsigned long DOM_VK_S = 0x53; + const unsigned long DOM_VK_T = 0x54; + const unsigned long DOM_VK_U = 0x55; + const unsigned long DOM_VK_V = 0x56; + const unsigned long DOM_VK_W = 0x57; + const unsigned long DOM_VK_X = 0x58; + const unsigned long DOM_VK_Y = 0x59; + const unsigned long DOM_VK_Z = 0x5A; + + const unsigned long DOM_VK_WIN = 0x5B; + const unsigned long DOM_VK_CONTEXT_MENU = 0x5D; + const unsigned long DOM_VK_SLEEP = 0x5F; + + // Numpad keys + const unsigned long DOM_VK_NUMPAD0 = 0x60; + const unsigned long DOM_VK_NUMPAD1 = 0x61; + const unsigned long DOM_VK_NUMPAD2 = 0x62; + const unsigned long DOM_VK_NUMPAD3 = 0x63; + const unsigned long DOM_VK_NUMPAD4 = 0x64; + const unsigned long DOM_VK_NUMPAD5 = 0x65; + const unsigned long DOM_VK_NUMPAD6 = 0x66; + const unsigned long DOM_VK_NUMPAD7 = 0x67; + const unsigned long DOM_VK_NUMPAD8 = 0x68; + const unsigned long DOM_VK_NUMPAD9 = 0x69; + const unsigned long DOM_VK_MULTIPLY = 0x6A; + const unsigned long DOM_VK_ADD = 0x6B; + const unsigned long DOM_VK_SEPARATOR = 0x6C; + const unsigned long DOM_VK_SUBTRACT = 0x6D; + const unsigned long DOM_VK_DECIMAL = 0x6E; + const unsigned long DOM_VK_DIVIDE = 0x6F; + + const unsigned long DOM_VK_F1 = 0x70; + const unsigned long DOM_VK_F2 = 0x71; + const unsigned long DOM_VK_F3 = 0x72; + const unsigned long DOM_VK_F4 = 0x73; + const unsigned long DOM_VK_F5 = 0x74; + const unsigned long DOM_VK_F6 = 0x75; + const unsigned long DOM_VK_F7 = 0x76; + const unsigned long DOM_VK_F8 = 0x77; + const unsigned long DOM_VK_F9 = 0x78; + const unsigned long DOM_VK_F10 = 0x79; + const unsigned long DOM_VK_F11 = 0x7A; + const unsigned long DOM_VK_F12 = 0x7B; + const unsigned long DOM_VK_F13 = 0x7C; + const unsigned long DOM_VK_F14 = 0x7D; + const unsigned long DOM_VK_F15 = 0x7E; + const unsigned long DOM_VK_F16 = 0x7F; + const unsigned long DOM_VK_F17 = 0x80; + const unsigned long DOM_VK_F18 = 0x81; + const unsigned long DOM_VK_F19 = 0x82; + const unsigned long DOM_VK_F20 = 0x83; + const unsigned long DOM_VK_F21 = 0x84; + const unsigned long DOM_VK_F22 = 0x85; + const unsigned long DOM_VK_F23 = 0x86; + const unsigned long DOM_VK_F24 = 0x87; + + const unsigned long DOM_VK_NUM_LOCK = 0x90; + const unsigned long DOM_VK_SCROLL_LOCK = 0x91; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_OEM_FJ_JISHO = 0x92; + const unsigned long DOM_VK_WIN_OEM_FJ_MASSHOU = 0x93; + const unsigned long DOM_VK_WIN_OEM_FJ_TOUROKU = 0x94; + const unsigned long DOM_VK_WIN_OEM_FJ_LOYA = 0x95; + const unsigned long DOM_VK_WIN_OEM_FJ_ROYA = 0x96; + + const unsigned long DOM_VK_CIRCUMFLEX = 0xA0; + const unsigned long DOM_VK_EXCLAMATION = 0xA1; + const unsigned long DOM_VK_DOUBLE_QUOTE = 0xA2; + const unsigned long DOM_VK_HASH = 0xA3; + const unsigned long DOM_VK_DOLLAR = 0xA4; + const unsigned long DOM_VK_PERCENT = 0xA5; + const unsigned long DOM_VK_AMPERSAND = 0xA6; + const unsigned long DOM_VK_UNDERSCORE = 0xA7; + const unsigned long DOM_VK_OPEN_PAREN = 0xA8; + const unsigned long DOM_VK_CLOSE_PAREN = 0xA9; + const unsigned long DOM_VK_ASTERISK = 0xAA; + const unsigned long DOM_VK_PLUS = 0xAB; + const unsigned long DOM_VK_PIPE = 0xAC; + const unsigned long DOM_VK_HYPHEN_MINUS = 0xAD; + + const unsigned long DOM_VK_OPEN_CURLY_BRACKET = 0xAE; + const unsigned long DOM_VK_CLOSE_CURLY_BRACKET = 0xAF; + + const unsigned long DOM_VK_TILDE = 0xB0; + + const unsigned long DOM_VK_VOLUME_MUTE = 0xB5; + const unsigned long DOM_VK_VOLUME_DOWN = 0xB6; + const unsigned long DOM_VK_VOLUME_UP = 0xB7; + + const unsigned long DOM_VK_COMMA = 0xBC; + const unsigned long DOM_VK_PERIOD = 0xBE; + const unsigned long DOM_VK_SLASH = 0xBF; + const unsigned long DOM_VK_BACK_QUOTE = 0xC0; + const unsigned long DOM_VK_OPEN_BRACKET = 0xDB; // square bracket + const unsigned long DOM_VK_BACK_SLASH = 0xDC; + const unsigned long DOM_VK_CLOSE_BRACKET = 0xDD; // square bracket + const unsigned long DOM_VK_QUOTE = 0xDE; // Apostrophe + + const unsigned long DOM_VK_META = 0xE0; + const unsigned long DOM_VK_ALTGR = 0xE1; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3; + const unsigned long DOM_VK_WIN_ICO_00 = 0xE4; + const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6; + const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9; + const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA; + const unsigned long DOM_VK_WIN_OEM_PA1 = 0xEB; + const unsigned long DOM_VK_WIN_OEM_PA2 = 0xEC; + const unsigned long DOM_VK_WIN_OEM_PA3 = 0xED; + const unsigned long DOM_VK_WIN_OEM_WSCTRL = 0xEE; + const unsigned long DOM_VK_WIN_OEM_CUSEL = 0xEF; + const unsigned long DOM_VK_WIN_OEM_ATTN = 0xF0; + const unsigned long DOM_VK_WIN_OEM_FINISH = 0xF1; + const unsigned long DOM_VK_WIN_OEM_COPY = 0xF2; + const unsigned long DOM_VK_WIN_OEM_AUTO = 0xF3; + const unsigned long DOM_VK_WIN_OEM_ENLW = 0xF4; + const unsigned long DOM_VK_WIN_OEM_BACKTAB = 0xF5; + + // Following keys are not used on most keyboards. However, for compatibility + // with other browsers on Windows, we should define them. + const unsigned long DOM_VK_ATTN = 0xF6; + const unsigned long DOM_VK_CRSEL = 0xF7; + const unsigned long DOM_VK_EXSEL = 0xF8; + const unsigned long DOM_VK_EREOF = 0xF9; + const unsigned long DOM_VK_PLAY = 0xFA; + const unsigned long DOM_VK_ZOOM = 0xFB; + const unsigned long DOM_VK_PA1 = 0xFD; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE; + + readonly attribute unsigned long charCode; + readonly attribute unsigned long keyCode; + + readonly attribute boolean altKey; + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean metaKey; + + void initKeyEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in mozIDOMWindow viewArg, + in boolean ctrlKeyArg, + in boolean altKeyArg, + in boolean shiftKeyArg, + in boolean metaKeyArg, + in unsigned long keyCodeArg, + in unsigned long charCodeArg); + + bool getModifierState(in DOMString keyArg); + + const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; + const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; + const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; + const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; + + readonly attribute unsigned long location; + readonly attribute boolean repeat; + + readonly attribute DOMString key; +}; diff --git a/dom/interfaces/events/nsIDOMMouseEvent.idl b/dom/interfaces/events/nsIDOMMouseEvent.idl new file mode 100644 index 000000000..3452f32fe --- /dev/null +++ b/dom/interfaces/events/nsIDOMMouseEvent.idl @@ -0,0 +1,69 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMUIEvent.idl" + +/** + * The nsIDOMMouseEvent interface is the datatype for all mouse events + * in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Events/ + */ + +[builtinclass, uuid(5bdab8d8-7933-4c5c-b6d1-ab34481237f7)] +interface nsIDOMMouseEvent : nsIDOMUIEvent +{ + readonly attribute long screenX; + readonly attribute long screenY; + + readonly attribute long mozMovementX; + readonly attribute long mozMovementY; + + readonly attribute long clientX; + readonly attribute long clientY; + + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + + readonly attribute short button; + readonly attribute unsigned short buttons; + readonly attribute nsIDOMEventTarget relatedTarget; + + void initMouseEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in mozIDOMWindow viewArg, + in long detailArg, + in long screenXArg, + in long screenYArg, + in long clientXArg, + in long clientYArg, + in boolean ctrlKeyArg, + in boolean altKeyArg, + in boolean shiftKeyArg, + in boolean metaKeyArg, + in unsigned short buttonArg, + in nsIDOMEventTarget relatedTargetArg); + + + // Finger or touch pressure event value + // ranges between 0.0 and 1.0 + readonly attribute float mozPressure; + + const unsigned short MOZ_SOURCE_UNKNOWN = 0; + const unsigned short MOZ_SOURCE_MOUSE = 1; + const unsigned short MOZ_SOURCE_PEN = 2; + const unsigned short MOZ_SOURCE_ERASER = 3; + const unsigned short MOZ_SOURCE_CURSOR = 4; + const unsigned short MOZ_SOURCE_TOUCH = 5; + const unsigned short MOZ_SOURCE_KEYBOARD = 6; + + readonly attribute unsigned short mozInputSource; + + bool getModifierState(in DOMString keyArg); +}; diff --git a/dom/interfaces/events/nsIDOMMouseScrollEvent.idl b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl new file mode 100644 index 000000000..cd159680f --- /dev/null +++ b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMMouseEvent.idl" + +[builtinclass, uuid(327bdd54-f772-4015-b856-9692154a066c)] +interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent +{ + const long HORIZONTAL_AXIS = 1; + const long VERTICAL_AXIS = 2; +}; diff --git a/dom/interfaces/events/nsIDOMMutationEvent.idl b/dom/interfaces/events/nsIDOMMutationEvent.idl new file mode 100644 index 000000000..6b1b136f3 --- /dev/null +++ b/dom/interfaces/events/nsIDOMMutationEvent.idl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIDOMNode.idl" + +[builtinclass, uuid(30c9997f-bc4c-4890-b890-febb6ae3051b)] +interface nsIDOMMutationEvent : nsISupports +{ + const unsigned short MODIFICATION = 1; + const unsigned short ADDITION = 2; + const unsigned short REMOVAL = 3; + + readonly attribute nsIDOMNode relatedNode; + readonly attribute DOMString prevValue; + readonly attribute DOMString newValue; + readonly attribute DOMString attrName; + readonly attribute unsigned short attrChange; + void initMutationEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in nsIDOMNode relatedNodeArg, + in DOMString prevValueArg, + in DOMString newValueArg, + in DOMString attrNameArg, + in unsigned short attrChangeArg); +}; diff --git a/dom/interfaces/events/nsIDOMNSEvent.idl b/dom/interfaces/events/nsIDOMNSEvent.idl new file mode 100644 index 000000000..49e2ae6db --- /dev/null +++ b/dom/interfaces/events/nsIDOMNSEvent.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +%{C++ +#ifdef ERROR +#undef ERROR +#endif +%} + +[uuid(2580b4a2-6d85-4ca6-9be2-98f3406ad296)] +interface nsIDOMNSEvent : nsISupports +{ + const long ALT_MASK = 0x00000001; + const long CONTROL_MASK = 0x00000002; + const long SHIFT_MASK = 0x00000004; + const long META_MASK = 0x00000008; +}; diff --git a/dom/interfaces/events/nsIDOMNotifyPaintEvent.idl b/dom/interfaces/events/nsIDOMNotifyPaintEvent.idl new file mode 100644 index 000000000..6df07a1c8 --- /dev/null +++ b/dom/interfaces/events/nsIDOMNotifyPaintEvent.idl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIDOMClientRectList.idl" +#include "nsIDOMClientRect.idl" + +interface nsIDOMPaintRequestList; + +/** + * The nsIDOMNotifyPaintEvent interface is used for the MozDOMAfterPaint + * event, which fires at a window when painting has happened in + * that window. + */ +[builtinclass, uuid(63f573a0-3e4e-474b-a0c2-bb4ca93febaa)] +interface nsIDOMNotifyPaintEvent : nsISupports +{ + /** + * Get a list of rectangles which are affected. The rectangles are in CSS pixels + * relative to the viewport origin. + * If the caller is not trusted (e.g., regular Web content) then only painting + * caused by the current document is reported; in particular, painting in subdocuments + * is not reported. + */ + readonly attribute nsIDOMClientRectList clientRects; + /** + * Get the bounding box of the rectangles which are affected. The rectangle + * is in CSS pixels relative to the viewport origin. + * If the caller is not trusted (e.g., regular Web content) then only painting + * caused by the current document is reported; in particular, painting in subdocuments + * is not reported. + */ + readonly attribute nsIDOMClientRect boundingClientRect; + + readonly attribute nsISupports /* PaintRequestList */ paintRequests; + + readonly attribute unsigned long long transactionId; +}; + diff --git a/dom/interfaces/events/nsIDOMPaintRequest.idl b/dom/interfaces/events/nsIDOMPaintRequest.idl new file mode 100644 index 000000000..64f107ed9 --- /dev/null +++ b/dom/interfaces/events/nsIDOMPaintRequest.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMClientRect; + +/** + * These objects are exposed by the MozDOMAfterPaint event. Each one represents + * a request to repaint a rectangle that was generated by the browser. + */ +[uuid(9eb5268f-73a4-41da-9790-d21fcefd5ffa)] +interface nsIDOMPaintRequest : nsISupports +{ + /** + * The client rect where invalidation was triggered. + */ + readonly attribute nsIDOMClientRect clientRect; + /** + * The reason for the request, as a string. If an empty string, then we don't know + * the reason (this is common). Reasons include "scroll repaint", meaning that we + * needed to repaint the rectangle due to scrolling, and "scroll copy", meaning + * that we updated the rectangle due to scrolling but instead of painting + * manually, we were able to do a copy from another area of the screen. + */ + [binaryname(XPCOMReason)] + readonly attribute DOMString reason; +}; diff --git a/dom/interfaces/events/nsIDOMScrollAreaEvent.idl b/dom/interfaces/events/nsIDOMScrollAreaEvent.idl new file mode 100644 index 000000000..56f4c5938 --- /dev/null +++ b/dom/interfaces/events/nsIDOMScrollAreaEvent.idl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMUIEvent.idl" + +[builtinclass, uuid(5883e564-e676-4652-9421-7df6132016b2)] +interface nsIDOMScrollAreaEvent : nsIDOMUIEvent +{ +}; diff --git a/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl new file mode 100644 index 000000000..bc4a395bf --- /dev/null +++ b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl @@ -0,0 +1,182 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "nsIDOMMouseEvent.idl" + +/** + * The nsIDOMSimpleGestureEvent interface is the datatype for all + * Mozilla-specific simple gesture events in the Document Object Model. + * + * The following events are generated: + * + * MozSwipeGestureMayStart - Generated when the user starts a horizontal + * swipe across the input device, but before we know whether the user + * is actually scrolling past a scroll edge. + * This event asks two questions: Should a swipe really be started, and + * in which directions should the user be able to swipe? The first + * question is answered by event listeners by calling or not calling + * preventDefault() on the event. Since a swipe swallows all scroll + * events, the default action of the swipe start event is *not* to + * start a swipe. Call preventDefault() if you want a swipe to be + * started. Doing so won't necessarily result in a swipe being started, + * it only communicates an intention. Once Gecko determines whether a + * swipe should actually be started, it will send a MozSwipeGestureStart + * event. + * The second question (swipe-able directions) is answered in the + * allowedDirections field. + * + * MozSwipeGestureStart - This event signals the start of a swipe. + * It guarantees a future MozSwipeGestureEnd event that will signal + * the end of a swipe animation. + * + * MozSwipeGestureUpdate - Generated periodically while the user is + * continuing a horizontal swipe gesture. The "delta" value represents + * the current absolute gesture amount. This event may even be sent + * after a MozSwipeGesture event fired in order to allow for fluid + * completion of a swipe animation. The direction value is meaningless + * on swipe update events. + * + * MozSwipeGestureEnd - Generated when the swipe animation is completed. + * + * MozSwipeGesture - Generated when the user releases a swipe across + * across the input device. This event signals that the actual swipe + * operation is complete, even though the animation might not be finished + * yet. This event can be sent without accompanying start / update / end + * events, and it can also be handled on its own if the consumer doesn't + * want to handle swipe animation events. + * Only the direction value has any significance, the delta value is + * meaningless. + * + * MozMagnifyGestureStart - Generated when the user begins the magnify + * ("pinch") gesture. The "delta" value represents the initial + * movement. + * + * MozMagnifyGestureUpdate - Generated periodically while the user is + * continuing the magnify ("pinch") gesture. The "delta" value + * represents the movement since the last MozMagnifyGestureStart or + * MozMagnifyGestureUpdate event. + * + * MozMagnifyGesture - Generated when the user has completed the + * magnify ("pinch") gesture. If you only want to receive a single + * event when the magnify gesture is complete, you only need to hook + * this event and can safely ignore the MozMagnifyGestureStart and the + * MozMagnifyGestureUpdate events. The "delta" value is the cumulative + * amount represented by the user's gesture. + * + * MozRotateGestureStart - Generated when the user begins the rotation + * gesture. The "delta" value represents the initial rotation. + * + * MozRotateGestureUpdate - Generated periodically while the user is + * continuing the rotation gesture. The "delta" value represents the + * rotation since the last MozRotateGestureStart or + * MozRotateGestureUpdate event. + * + * MozRotateGesture - Generated when the user has completed the + * rotation gesture. If you only want to receive a single event when + * the rotation gesture is complete, you only need to hook this event + * and can safely ignore the MozRotateGestureStart and the + * MozRotateGestureUpdate events. The "delta" value is the cumulative + * amount of rotation represented by the user's gesture. + * + * MozTapGesture - Generated when the user executes a two finger + * tap gesture on the input device. Client coordinates contain the + * center point of the tap. + * (XXX On OS X, only Lion (10.7) and up) + * + * MozPressTapGesture - Generated when the user executes a press + * and tap two finger gesture (first finger down, second finger down, + * second finger up, first finger up) on the input device. + * Client coordinates contain the center pivot point of the action. + * (XXX Not implemented on Mac) + * + * MozEdgeUIGesture - Generated when the user swipes the display to + * invoke edge ui. + * (XXX Win8 only) + * + * Default behavior: + * + * Some operating systems support default behaviors for gesture events + * when they are not handled by the application. Consumers should + * use event.preventDefault() to prevent default behavior when + * consuming events. + */ + +[builtinclass, uuid(c397f9a2-4266-4291-b282-3efd6d7afc57)] +interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent +{ + /* Swipe direction constants */ + const unsigned long DIRECTION_UP = 1; + const unsigned long DIRECTION_DOWN = 2; + const unsigned long DIRECTION_LEFT = 4; + const unsigned long DIRECTION_RIGHT = 8; + + /* Rotational direction constants */ + const unsigned long ROTATION_COUNTERCLOCKWISE = 1; + const unsigned long ROTATION_CLOCKWISE = 2; + + /* Read-write value for swipe events. + * + * Reports the directions that can be swiped to; multiple directions + * should be OR'ed together. + * + * The allowedDirections field is designed to be set on SwipeGestureMayStart + * events by event listeners. Its value after event dispatch determines + * the behavior of the swipe animation that might be about to begin. + * Specifically, if the user swipes in a direction that can't be swiped + * to, the animation will have a bounce effect. + * Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events + * will carry the allowDirections value that was set on the SwipeMayStart + * event. Changing this field on non-SwipeGestureMayStart events doesn't + * have any effect. + */ + attribute unsigned long allowedDirections; + + /* Direction of a gesture. Diagonals are indicated by OR'ing the + * applicable constants together. + * + * Swipes gestures may occur in any direction. + * + * Magnify gestures do not have a direction. + * + * Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or + * ROTATION_CLOCKWISE. + */ + readonly attribute unsigned long direction; + + /* Delta value for magnify, rotate and swipe gestures. + * + * For rotation, the value is in degrees and is positive for + * clockwise rotation and negative for counterclockwise + * rotation. + * + * For magnification, the value will be positive for a "zoom in" + * (i.e, increased magnification) and negative for a "zoom out" + * (i.e., decreased magnification). The particular units + * represented by the "delta" are currently implementation specific. + * + * XXX - The units for measuring magnification are currently + * unspecified because the units used by Mac OS X are currently + * undocumented. The values are typically in the range of 0.0 to + * 100.0, but it is only safe currently to rely on the delta being + * positive or negative. + * + * For swipe start, update and end events, the value is a fraction + * of one "page". If the resulting swipe will have DIRECTION_LEFT, the + * delta value will be positive; for DIRECTION_RIGHT, delta is negative. + * If this seems backwards to you, look at it this way: If the current + * page is pushed to the right during the animation (positive delta), + * the page left to the current page will be visible after the swipe + * (DIRECTION_LEFT). + * + * Units on Windows represent the difference between the initial + * and current/final width between the two touch points on the input + * device and are measured in pixels. + */ + readonly attribute double delta; + + /* Click count value for taps. */ + readonly attribute unsigned long clickCount; +}; diff --git a/dom/interfaces/events/nsIDOMTransitionEvent.idl b/dom/interfaces/events/nsIDOMTransitionEvent.idl new file mode 100644 index 000000000..5809d1427 --- /dev/null +++ b/dom/interfaces/events/nsIDOMTransitionEvent.idl @@ -0,0 +1,19 @@ +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * Transition events are defined in: + * http://www.w3.org/TR/css3-transitions/#transition-events- + * http://dev.w3.org/csswg/css3-transitions/#transition-events- + */ + +[builtinclass, uuid(ee3499bf-0f14-4bb6-829c-19ad24fd4a85)] +interface nsIDOMTransitionEvent : nsISupports { + readonly attribute DOMString propertyName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; diff --git a/dom/interfaces/events/nsIDOMUIEvent.idl b/dom/interfaces/events/nsIDOMUIEvent.idl new file mode 100644 index 000000000..a44fdb2f9 --- /dev/null +++ b/dom/interfaces/events/nsIDOMUIEvent.idl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIDOMWindow.idl" + +interface mozIDOMWindow; +interface mozIDOMWindowProxy; + +/** + * The nsIDOMUIEvent interface is the datatype for all UI events in the + * Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Events/ + */ + +%{C++ +namespace mozilla { +namespace dom { +class Event; +} +} +%} + +[ptr] native EventPtr(mozilla::dom::Event); + +[builtinclass, uuid(85ae52eb-37fa-4fd9-a2e6-c7d0f2a521b3)] +interface nsIDOMUIEvent : nsISupports +{ + readonly attribute mozIDOMWindowProxy view; + readonly attribute long detail; + void initUIEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in mozIDOMWindow viewArg, + in long detailArg); + + const long SCROLL_PAGE_UP = -32768; + const long SCROLL_PAGE_DOWN = 32768; + + readonly attribute long layerX; + readonly attribute long layerY; + readonly attribute long pageX; + readonly attribute long pageY; + readonly attribute unsigned long which; + readonly attribute nsIDOMNode rangeParent; + readonly attribute long rangeOffset; + + readonly attribute boolean isChar; + + [notxpcom, nostdcall] EventPtr AsEvent(); +}; diff --git a/dom/interfaces/events/nsIDOMWheelEvent.idl b/dom/interfaces/events/nsIDOMWheelEvent.idl new file mode 100644 index 000000000..2416bc070 --- /dev/null +++ b/dom/interfaces/events/nsIDOMWheelEvent.idl @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMMouseEvent.idl" + +[builtinclass, uuid(d320d075-b29d-4edd-b3a3-3ffd460640de)] +interface nsIDOMWheelEvent : nsIDOMMouseEvent +{ + const unsigned long DOM_DELTA_PIXEL = 0x00; + const unsigned long DOM_DELTA_LINE = 0x01; + const unsigned long DOM_DELTA_PAGE = 0x02; +}; diff --git a/dom/interfaces/geolocation/moz.build b/dom/interfaces/geolocation/moz.build new file mode 100644 index 000000000..37d12600e --- /dev/null +++ b/dom/interfaces/geolocation/moz.build @@ -0,0 +1,17 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMGeoGeolocation.idl', + 'nsIDOMGeoPosition.idl', + 'nsIDOMGeoPositionCallback.idl', + 'nsIDOMGeoPositionCoords.idl', + 'nsIDOMGeoPositionError.idl', + 'nsIDOMGeoPositionErrorCallback.idl', +] + +XPIDL_MODULE = 'dom_geolocation' + diff --git a/dom/interfaces/geolocation/nsIDOMGeoGeolocation.idl b/dom/interfaces/geolocation/nsIDOMGeoGeolocation.idl new file mode 100644 index 000000000..1b54b6e2f --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoGeolocation.idl @@ -0,0 +1,32 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMGeoPositionCallback; +interface nsIDOMGeoPositionErrorCallback; + +%{C++ +namespace mozilla { +namespace dom { +struct PositionOptions; +} // namespace dom +} // namespace mozilla + +#include "mozilla/UniquePtr.h" +%} + +native PositionOptionsRef(mozilla::UniquePtr<mozilla::dom::PositionOptions>&&); + +[builtinclass, uuid(9142ab45-0ab5-418c-9bab-338a6d271d4f)] +interface nsIDOMGeoGeolocation : nsISupports +{ + int32_t watchPosition(in nsIDOMGeoPositionCallback callback, + in nsIDOMGeoPositionErrorCallback errorCallback, + in PositionOptionsRef options); + void getCurrentPosition(in nsIDOMGeoPositionCallback callback, + in nsIDOMGeoPositionErrorCallback errorCallback, + in PositionOptionsRef options); + void clearWatch(in long watchId); +}; diff --git a/dom/interfaces/geolocation/nsIDOMGeoPosition.idl b/dom/interfaces/geolocation/nsIDOMGeoPosition.idl new file mode 100644 index 000000000..621df8cbd --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoPosition.idl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" +#include "nsIDOMGeoPositionCoords.idl" + +[scriptable, uuid(dd9f7e81-0f74-4fb5-b361-37019bf60c3f)] +interface nsIDOMGeoPosition : nsISupports +{ + readonly attribute DOMTimeStamp timestamp; + readonly attribute nsIDOMGeoPositionCoords coords; +}; diff --git a/dom/interfaces/geolocation/nsIDOMGeoPositionCallback.idl b/dom/interfaces/geolocation/nsIDOMGeoPositionCallback.idl new file mode 100644 index 000000000..9abb6b793 --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoPositionCallback.idl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" + +interface nsIDOMGeoPosition; + +[scriptable, function, uuid(527E8B53-6F29-4B6A-8D04-5C1666A4C4C1)] +interface nsIDOMGeoPositionCallback : nsISupports { + void handleEvent(in nsIDOMGeoPosition position); +}; diff --git a/dom/interfaces/geolocation/nsIDOMGeoPositionCoords.idl b/dom/interfaces/geolocation/nsIDOMGeoPositionCoords.idl new file mode 100644 index 000000000..a25fb9822 --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoPositionCoords.idl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" + +[scriptable, uuid(B31702D0-6DAC-4FA0-B93B-F043E71C8F9A)] +interface nsIDOMGeoPositionCoords : nsISupports +{ + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute double altitude; + readonly attribute double accuracy; + readonly attribute double altitudeAccuracy; + readonly attribute double heading; + readonly attribute double speed; +}; diff --git a/dom/interfaces/geolocation/nsIDOMGeoPositionError.idl b/dom/interfaces/geolocation/nsIDOMGeoPositionError.idl new file mode 100644 index 000000000..720836a92 --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoPositionError.idl @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" + +// undef the GetMessage macro defined in winuser.h from the MS Platform SDK +%{C++ +#ifdef GetMessage +#undef GetMessage +#endif +%} + +[uuid(85255CC3-07BA-49FD-BC9B-18D2963DAF7F)] +interface nsIDOMGeoPositionError : nsISupports +{ + const unsigned short PERMISSION_DENIED = 1; + const unsigned short POSITION_UNAVAILABLE = 2; + const unsigned short TIMEOUT = 3; + + readonly attribute short code; + readonly attribute AString message; +}; diff --git a/dom/interfaces/geolocation/nsIDOMGeoPositionErrorCallback.idl b/dom/interfaces/geolocation/nsIDOMGeoPositionErrorCallback.idl new file mode 100644 index 000000000..e2b707d8a --- /dev/null +++ b/dom/interfaces/geolocation/nsIDOMGeoPositionErrorCallback.idl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "domstubs.idl" + +interface nsIDOMGeoPositionError; + +[scriptable, function, uuid(7D9B09D9-4843-43EB-A7A7-67F7DDA6B3C4)] +interface nsIDOMGeoPositionErrorCallback : nsISupports { + void handleEvent(in nsIDOMGeoPositionError positionError); +}; diff --git a/dom/interfaces/html/moz.build b/dom/interfaces/html/moz.build new file mode 100644 index 000000000..895a87314 --- /dev/null +++ b/dom/interfaces/html/moz.build @@ -0,0 +1,61 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMHTMLAnchorElement.idl', + 'nsIDOMHTMLAppletElement.idl', + 'nsIDOMHTMLAreaElement.idl', + 'nsIDOMHTMLBaseElement.idl', + 'nsIDOMHTMLBodyElement.idl', + 'nsIDOMHTMLButtonElement.idl', + 'nsIDOMHTMLCanvasElement.idl', + 'nsIDOMHTMLCollection.idl', + 'nsIDOMHTMLDirectoryElement.idl', + 'nsIDOMHTMLDocument.idl', + 'nsIDOMHTMLElement.idl', + 'nsIDOMHTMLEmbedElement.idl', + 'nsIDOMHTMLFieldSetElement.idl', + 'nsIDOMHTMLFormElement.idl', + 'nsIDOMHTMLFrameElement.idl', + 'nsIDOMHTMLFrameSetElement.idl', + 'nsIDOMHTMLHeadElement.idl', + 'nsIDOMHTMLHRElement.idl', + 'nsIDOMHTMLHtmlElement.idl', + 'nsIDOMHTMLIFrameElement.idl', + 'nsIDOMHTMLImageElement.idl', + 'nsIDOMHTMLInputElement.idl', + 'nsIDOMHTMLLabelElement.idl', + 'nsIDOMHTMLLIElement.idl', + 'nsIDOMHTMLLinkElement.idl', + 'nsIDOMHTMLMapElement.idl', + 'nsIDOMHTMLMediaElement.idl', + 'nsIDOMHTMLMenuElement.idl', + 'nsIDOMHTMLMenuItemElement.idl', + 'nsIDOMHTMLMetaElement.idl', + 'nsIDOMHTMLObjectElement.idl', + 'nsIDOMHTMLOListElement.idl', + 'nsIDOMHTMLOptGroupElement.idl', + 'nsIDOMHTMLOptionElement.idl', + 'nsIDOMHTMLOptionsCollection.idl', + 'nsIDOMHTMLParagraphElement.idl', + 'nsIDOMHTMLPictureElement.idl', + 'nsIDOMHTMLPreElement.idl', + 'nsIDOMHTMLQuoteElement.idl', + 'nsIDOMHTMLScriptElement.idl', + 'nsIDOMHTMLSelectElement.idl', + 'nsIDOMHTMLSourceElement.idl', + 'nsIDOMHTMLStyleElement.idl', + 'nsIDOMHTMLTableCellElement.idl', + 'nsIDOMHTMLTextAreaElement.idl', + 'nsIDOMHTMLUListElement.idl', + 'nsIDOMMozBrowserFrame.idl', + 'nsIDOMTimeRanges.idl', + 'nsIDOMValidityState.idl', + 'nsIMozBrowserFrame.idl', +] + +XPIDL_MODULE = 'dom_html' + diff --git a/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl b/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl new file mode 100644 index 000000000..8a38cdf95 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLAnchorElement interface is the interface to a [X]HTML + * a element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(339c01c8-2d41-4626-b231-eec63f0241b6)] +interface nsIDOMHTMLAnchorElement : nsISupports +{ + attribute DOMString href; + attribute DOMString target; + + attribute DOMString ping; + attribute DOMString download; + + attribute DOMString rel; + attribute DOMString hreflang; + attribute DOMString type; + + /** + * An alias for the textContent attribute. + */ + [Null(Stringify)] + attribute DOMString text; + + // URL decomposition IDL attributes + attribute DOMString protocol; + attribute DOMString host; + attribute DOMString hostname; + attribute DOMString port; + attribute DOMString pathname; + attribute DOMString search; + attribute DOMString hash; + + + attribute DOMString charset; + attribute DOMString coords; + attribute DOMString name; + attribute DOMString rev; + attribute DOMString shape; + + DOMString toString(); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLAppletElement.idl b/dom/interfaces/html/nsIDOMHTMLAppletElement.idl new file mode 100644 index 000000000..69760c143 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLAppletElement.idl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLAppletElement interface is the interface to a [X]HTML + * applet element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(0b7d12c9-4cd3-47db-99c6-0b5ff910446c)] +interface nsIDOMHTMLAppletElement : nsISupports +{ + attribute DOMString align; + attribute DOMString alt; + attribute DOMString archive; + attribute DOMString code; + attribute DOMString codeBase; + attribute DOMString height; + // Modified in DOM Level 2: + attribute long hspace; + attribute DOMString name; + // Modified in DOM Level 2: + attribute DOMString object; + // Modified in DOM Level 2: + attribute long vspace; + attribute DOMString width; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLAreaElement.idl b/dom/interfaces/html/nsIDOMHTMLAreaElement.idl new file mode 100644 index 000000000..d1c9bf1e9 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLAreaElement.idl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLAreaElement interface is the interface to a [X]HTML + * area element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(40c78026-36dc-40ca-9221-de73267e9e99)] +interface nsIDOMHTMLAreaElement : nsISupports +{ + attribute DOMString alt; + attribute DOMString coords; + attribute DOMString shape; + attribute DOMString href; + attribute DOMString target; + + attribute DOMString ping; + attribute DOMString download; + + // URL decomposition IDL attributes + attribute DOMString protocol; + attribute DOMString host; + attribute DOMString hostname; + attribute DOMString port; + attribute DOMString pathname; + attribute DOMString search; + attribute DOMString hash; + + attribute boolean noHref; + DOMString toString(); + +}; diff --git a/dom/interfaces/html/nsIDOMHTMLBaseElement.idl b/dom/interfaces/html/nsIDOMHTMLBaseElement.idl new file mode 100644 index 000000000..6a54b0ac9 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLBaseElement.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLBaseElement interface is the interface to a [X]HTML + * base element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(a348ac22-7880-4613-af4c-984ec2ef5adc)] +interface nsIDOMHTMLBaseElement : nsISupports +{ + attribute DOMString href; + attribute DOMString target; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLBodyElement.idl b/dom/interfaces/html/nsIDOMHTMLBodyElement.idl new file mode 100644 index 000000000..52937bf33 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLBodyElement.idl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +%{ C++ +#include "jspubtd.h" +%} + +/** + * The nsIDOMHTMLBodyElement interface is the interface to a [X]HTML + * body element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(068630db-2c00-43dd-b167-495757a88236)] +interface nsIDOMHTMLBodyElement : nsISupports +{ + attribute DOMString aLink; + attribute DOMString background; + attribute DOMString bgColor; + attribute DOMString link; + attribute DOMString text; + attribute DOMString vLink; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl new file mode 100644 index 000000000..42a4dfeb9 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLButtonElement interface is the interface to a [X]HTML + * button element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +interface nsIDOMValidityState; + +[uuid(44b7a468-7dba-4f0c-9b4e-ee46dc0f26c7)] +interface nsIDOMHTMLButtonElement : nsISupports +{ + attribute boolean autofocus; + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString formAction; + attribute DOMString formEnctype; + attribute DOMString formMethod; + attribute boolean formNoValidate; + attribute DOMString formTarget; + + attribute DOMString name; + attribute DOMString type; + attribute DOMString value; + + // The following lines are part of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); +}; + diff --git a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl new file mode 100644 index 000000000..8e589629e --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl @@ -0,0 +1,47 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLCanvasElement interface is the interface to a HTML + * <canvas> element. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#graphics + * + * @status UNDER_DEVELOPMENT + */ + +interface nsIDOMBlob; +interface nsIVariant; +interface nsIInputStreamCallback; + +[uuid(4e8f1316-b601-471d-8f44-3c650d91ee9b)] +interface nsIDOMHTMLCanvasElement : nsISupports +{ + attribute unsigned long width; + attribute unsigned long height; + attribute boolean mozOpaque; + + // Valid calls are: + // toDataURL(); -- defaults to image/png + // toDataURL(type); -- uses given type + // toDataURL(type, params); -- uses given type, and any valid parameters + [implicit_jscontext] + DOMString toDataURL([optional] in DOMString type, + [optional] in jsval params); + + // Valid calls are + // mozGetAsFile(name); -- defaults to image/png + // mozGetAsFile(name, type); -- uses given type + // The return value is a File object. + nsISupports mozGetAsFile(in DOMString name, [optional] in DOMString type); + + // A Mozilla-only extension to get a canvas context backed by double-buffered + // shared memory. Only privileged callers can call this. + nsISupports MozGetIPCContext(in DOMString contextId); +}; + diff --git a/dom/interfaces/html/nsIDOMHTMLCollection.idl b/dom/interfaces/html/nsIDOMHTMLCollection.idl new file mode 100644 index 000000000..310a4e73c --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLCollection.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMHTMLCollection interface is an interface to a collection + * of [X]HTML elements. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(bb07f567-5b37-4172-92aa-7d00ceed4809)] +interface nsIDOMHTMLCollection : nsISupports +{ + readonly attribute unsigned long length; + + nsIDOMNode item(in unsigned long index); + nsIDOMNode namedItem(in DOMString name); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl b/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl new file mode 100644 index 000000000..12255ec80 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLDirectoryElement interface is the interface to a + * [X]HTML dir element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +// Exists so that | element instanceof Ci.nsIDOMHTMLDirectoryElement | works. +[uuid(8cfff7a4-8b14-4ce0-97b0-babe78da16f8)] +interface nsIDOMHTMLDirectoryElement : nsISupports +{ +}; diff --git a/dom/interfaces/html/nsIDOMHTMLDocument.idl b/dom/interfaces/html/nsIDOMHTMLDocument.idl new file mode 100644 index 000000000..6813ccf2e --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl @@ -0,0 +1,99 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMDocument.idl" + +/** + * The nsIDOMHTMLDocument interface is the interface to a [X]HTML + * document object. + * + * @see <http://www.whatwg.org/html/> + */ +interface nsISelection; + +[uuid(cd31e61f-cfc2-4b91-9385-17b6a2d0633d)] +interface nsIDOMHTMLDocument : nsIDOMDocument +{ + attribute DOMString domain; + attribute DOMString cookie; + + readonly attribute nsIDOMHTMLHeadElement head; + attribute nsIDOMHTMLElement body; + + readonly attribute nsIDOMHTMLCollection images; + readonly attribute nsIDOMHTMLCollection embeds; + // mapped to attribute embeds for NS4 compat + readonly attribute nsIDOMHTMLCollection plugins; + readonly attribute nsIDOMHTMLCollection links; + readonly attribute nsIDOMHTMLCollection forms; + readonly attribute nsIDOMHTMLCollection scripts; + nsIDOMNodeList getElementsByName(in DOMString elementName); + + // If aContentType is not something supported by nsHTMLDocument and + // the HTML content sink, trying to write to the document will + // probably throw. + // Pass aReplace = true to trigger a replacement of the previous + // document in session history; pass false for normal history handling. + [implicit_jscontext, optional_argc] + nsISupports open([optional] in DOMString aContentTypeOrUrl, + [optional] in DOMString aReplaceOrName, + [optional] in DOMString aFeatures); + void close(); + + [implicit_jscontext] + void write([optional, Null(Stringify)] in DOMString text); + [implicit_jscontext] + void writeln([optional, Null(Stringify)] in DOMString text); + + /** + * Midas additions + */ + attribute DOMString designMode; + + boolean execCommand(in DOMString commandID, + [optional] in boolean doShowUI, + [optional] in DOMString value); + + // returns true if the command is enabled (false otherwise) + boolean queryCommandEnabled(in DOMString commandID); + + // returns true if the command is in a indeterminate state (false otherwise) + boolean queryCommandIndeterm(in DOMString commandID); + + // returns true if the command has been executed (false otherwise) + boolean queryCommandState(in DOMString commandID); + + // returns true if the command is supported on the current range + boolean queryCommandSupported(in DOMString commandID); + + // returns the current value of the document or current selection for command + DOMString queryCommandValue(in DOMString commandID); + + + // Obsolete APIs + attribute DOMString fgColor; + attribute DOMString bgColor; + attribute DOMString linkColor; + attribute DOMString vlinkColor; + attribute DOMString alinkColor; + + readonly attribute nsIDOMHTMLCollection anchors; + readonly attribute nsIDOMHTMLCollection applets; + + void clear(); + + + // DOM Range + nsISelection getSelection(); + + + // More obsolete APIs + /** + * @deprecated These are old Netscape 4 methods. Do not use, + * the implementation is no-op. + */ + void captureEvents(); + void releaseEvents(); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLElement.idl b/dom/interfaces/html/nsIDOMHTMLElement.idl new file mode 100644 index 000000000..63a1f9572 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLElement.idl @@ -0,0 +1,67 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIVariant.idl" + +interface nsIDOMHTMLMenuElement; + +/** + * The nsIDOMHTMLElement interface is the primary [X]HTML element + * interface. It represents a single [X]HTML element in the document + * tree. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ +[uuid(b0c42392-d0e7-4f6a-beb5-a698ce648945)] +interface nsIDOMHTMLElement : nsIDOMElement +{ + // metadata attributes + attribute DOMString title; + attribute DOMString lang; + attribute DOMString dir; + readonly attribute nsISupports dataset; + + // user interaction + /** + * Indicates that the element is not yet, or is no longer, relevant. + * + * See <http://www.whatwg.org/html5/#the-hidden-attribute>. + */ + attribute boolean hidden; + [binaryname(DOMClick)] + void click(); + attribute long tabIndex; + void focus(); + [binaryname(DOMBlur)] + void blur(); + attribute DOMString accessKey; + readonly attribute DOMString accessKeyLabel; + attribute boolean draggable; + attribute DOMString contentEditable; + readonly attribute boolean isContentEditable; + readonly attribute nsIDOMHTMLMenuElement contextMenu; + attribute boolean spellcheck; + + + // DOM Parsing and Serialization + attribute DOMString innerHTML; + attribute DOMString outerHTML; + void insertAdjacentHTML(in DOMString position, + in DOMString text); + + + // CSSOM View + [optional_argc] void scrollIntoView([optional] in boolean top); + readonly attribute nsIDOMElement offsetParent; + readonly attribute long offsetTop; + readonly attribute long offsetLeft; + readonly attribute long offsetWidth; + readonly attribute long offsetHeight; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl b/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl new file mode 100644 index 000000000..498f58fad --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLEmbedElement interface is the interface to a [X]HTML + * embed element. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element + */ + +[uuid(adae53da-713d-4570-81ad-dabdd6d46241)] +interface nsIDOMHTMLEmbedElement : nsISupports +{ + attribute DOMString align; + attribute DOMString height; + attribute DOMString name; + attribute DOMString src; + attribute DOMString type; + attribute DOMString width; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl new file mode 100644 index 000000000..32a21e72a --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLFieldSetElement interface is the interface to a + * [X]HTML fieldset element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +interface nsIDOMValidityState; + +[uuid(e3d91535-9da3-4c4b-a809-f17d85a4fb9f)] +interface nsIDOMHTMLFieldSetElement : nsISupports +{ + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString name; + + readonly attribute DOMString type; + + readonly attribute nsIDOMHTMLCollection elements; + + // The following lines are parte of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLFormElement.idl b/dom/interfaces/html/nsIDOMHTMLFormElement.idl new file mode 100644 index 000000000..8cb776795 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLFormElement.idl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLFormElement interface is the interface to a [X]HTML + * form element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(ad9b2ad0-9d29-43f6-b1a2-a1fd24627e6b)] +interface nsIDOMHTMLFormElement : nsISupports +{ + attribute DOMString acceptCharset; + attribute DOMString action; + attribute DOMString autocomplete; + attribute DOMString enctype; + attribute DOMString encoding; + attribute DOMString method; + attribute DOMString name; + attribute boolean noValidate; + attribute DOMString target; + + readonly attribute nsIDOMHTMLCollection elements; + readonly attribute long length; + + void submit(); + void reset(); + boolean checkValidity(); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLFrameElement.idl b/dom/interfaces/html/nsIDOMHTMLFrameElement.idl new file mode 100644 index 000000000..25f693947 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLFrameElement.idl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLFrameElement interface is the interface to a [X]HTML + * frame element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(012a8982-c9d3-4614-91e2-18ee51c97c06)] +interface nsIDOMHTMLFrameElement : nsISupports +{ + attribute DOMString frameBorder; + attribute DOMString longDesc; + attribute DOMString marginHeight; + attribute DOMString marginWidth; + attribute DOMString name; + attribute boolean noResize; + attribute DOMString scrolling; + attribute DOMString src; + // Introduced in DOM Level 2: + readonly attribute nsIDOMDocument contentDocument; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl new file mode 100644 index 000000000..87105caec --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +%{ C++ +#include "jspubtd.h" +%} + +/** + * The nsIDOMHTMLFrameSetElement interface is the interface to a + * [X]HTML frameset element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(14b29269-c387-4cff-8463-b0871ca0be3a)] +interface nsIDOMHTMLFrameSetElement : nsISupports +{ + attribute DOMString cols; + attribute DOMString rows; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLHRElement.idl b/dom/interfaces/html/nsIDOMHTMLHRElement.idl new file mode 100644 index 000000000..b5f036b5a --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLHRElement.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLHRElement interface is the interface to a [X]HTML hr + * element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(30771953-b9f4-44de-b0fe-e490949af98b)] +interface nsIDOMHTMLHRElement : nsISupports +{ + attribute DOMString align; + attribute boolean noShade; + attribute DOMString size; + attribute DOMString width; + attribute DOMString color; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLHeadElement.idl b/dom/interfaces/html/nsIDOMHTMLHeadElement.idl new file mode 100644 index 000000000..86554a869 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLHeadElement.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLHeadElement interface is the interface to a [X]HTML + * head element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(59b80014-00f5-412d-846f-725494122d42)] +interface nsIDOMHTMLHeadElement : nsISupports +{ +}; diff --git a/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl b/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl new file mode 100644 index 000000000..3026ed53d --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLHtmlElement interface is the interface to a [X]HTML + * html element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(6a5d2ce7-2c45-43c1-bdab-9df7a06caed1)] +interface nsIDOMHTMLHtmlElement : nsISupports +{ + attribute DOMString version; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl b/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl new file mode 100644 index 000000000..2fc1384d6 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLIFrameElement interface is the interface to a [X]HTML + * iframe element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(9fd7b656-1055-4cb2-b8b1-ed13efe24457)] +interface nsIDOMHTMLIFrameElement : nsISupports +{ + attribute DOMString align; + attribute DOMString frameBorder; + attribute DOMString height; + attribute DOMString longDesc; + attribute DOMString marginHeight; + attribute DOMString marginWidth; + attribute DOMString name; + attribute DOMString scrolling; + attribute DOMString src; + attribute DOMString srcdoc; + attribute DOMString width; + // Introduced in DOM Level 2: + readonly attribute nsIDOMDocument contentDocument; + + attribute boolean allowFullscreen; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLImageElement.idl b/dom/interfaces/html/nsIDOMHTMLImageElement.idl new file mode 100644 index 000000000..64574ca79 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLImageElement.idl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLImageElement interface is the interface to a [X]HTML + * img element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(ec18e71c-4f5c-4cc3-aa36-5273168644dc)] +interface nsIDOMHTMLImageElement : nsISupports +{ + attribute DOMString alt; + attribute DOMString src; + attribute DOMString srcset; + attribute DOMString sizes; + attribute DOMString useMap; + attribute boolean isMap; + attribute unsigned long width; + attribute unsigned long height; + readonly attribute unsigned long naturalWidth; + readonly attribute unsigned long naturalHeight; + readonly attribute boolean complete; + + + attribute DOMString name; + attribute DOMString align; + attribute DOMString border; + attribute long hspace; + attribute DOMString longDesc; + attribute long vspace; + attribute DOMString lowsrc; + + readonly attribute DOMString currentSrc; + + // These attributes are offsets from the closest view (to mimic + // NS4's "offset-from-layer" behavior). + readonly attribute long x; + readonly attribute long y; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLInputElement.idl b/dom/interfaces/html/nsIDOMHTMLInputElement.idl new file mode 100644 index 000000000..a57575b17 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl @@ -0,0 +1,109 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +interface nsIControllers; +interface nsIDOMFileList; +interface nsIDOMValidityState; + + /** + * The nsIDOMHTMLInputElement interface is the interface to a [X]HTML + * input element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)] +interface nsIDOMHTMLInputElement : nsISupports +{ + attribute DOMString accept; + attribute DOMString alt; + + attribute DOMString autocomplete; + attribute boolean autofocus; + attribute boolean defaultChecked; + attribute boolean checked; + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString formAction; + attribute DOMString formEnctype; + attribute DOMString formMethod; + attribute boolean formNoValidate; + attribute DOMString formTarget; + + readonly attribute nsIDOMFileList files; + + attribute unsigned long height; + attribute boolean indeterminate; + + attribute DOMString inputMode; + + readonly attribute nsIDOMHTMLElement list; + attribute DOMString max; + attribute long maxLength; + attribute DOMString min; + attribute long minLength; + + attribute boolean multiple; + attribute DOMString name; + + attribute DOMString pattern; + attribute DOMString placeholder; + attribute boolean readOnly; + attribute boolean required; + attribute DOMString step; + + attribute DOMString align; + + attribute unsigned long size; + attribute unsigned long width; + attribute DOMString src; + + attribute DOMString type; + attribute DOMString defaultValue; + attribute DOMString value; + attribute double valueAsNumber; + // valustAsDate is only supported via WebIDL, because it's intimately + // tied to JS Date objects and xpidl support for that sort of thing is + // terrible. + + [optional_argc] void stepDown([optional] in long n); + [optional_argc] void stepUp([optional] in long n); + + // The following lines are part of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); + + void select(); + attribute long selectionStart; + attribute long selectionEnd; + void setSelectionRange(in long selectionStart, in long selectionEnd, [optional] in DOMString direction); + attribute DOMString selectionDirection; + + + attribute DOMString useMap; + readonly attribute nsIControllers controllers; + readonly attribute long textLength; + + void mozGetFileNameArray([optional] out unsigned long aLength, + [array,size_is(aLength), retval] out wstring aFileNames); + void mozSetFileNameArray([array,size_is(aLength)] in wstring aFileNames, + in unsigned long aLength); + + /** + * This non-standard method prevents to check types manually to know if the + * element is a text field. + */ + boolean mozIsTextField(in boolean aExcludePassword); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLLIElement.idl b/dom/interfaces/html/nsIDOMHTMLLIElement.idl new file mode 100644 index 000000000..93271afd8 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLLIElement.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLLIElement interface is the interface to a [X]HTML li + * element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(17bd5c1c-3746-4268-a9f6-45018025f09c)] +interface nsIDOMHTMLLIElement : nsISupports +{ + attribute DOMString type; + attribute long value; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLLabelElement.idl b/dom/interfaces/html/nsIDOMHTMLLabelElement.idl new file mode 100644 index 000000000..02c4c1ed7 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLLabelElement.idl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLLabelElement interface is the interface to a [X]HTML + * label element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(efc0eaf2-5756-4388-a229-fbec2033529d)] +interface nsIDOMHTMLLabelElement : nsISupports +{ + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString htmlFor; + readonly attribute nsIDOMHTMLElement control; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLLinkElement.idl b/dom/interfaces/html/nsIDOMHTMLLinkElement.idl new file mode 100644 index 000000000..27cc8fae3 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLLinkElement.idl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLLinkElement interface is the interface to a [X]HTML + * link element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(ee50b7ab-0015-4fbe-89e0-e3feacd4ffde)] +interface nsIDOMHTMLLinkElement : nsISupports +{ + [binaryname(MozDisabled)] + attribute boolean disabled; + attribute DOMString charset; + attribute DOMString href; + attribute DOMString hreflang; + attribute DOMString media; + attribute DOMString rel; + attribute DOMString rev; + attribute DOMString target; + attribute DOMString type; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLMapElement.idl b/dom/interfaces/html/nsIDOMHTMLMapElement.idl new file mode 100644 index 000000000..0d0d37f29 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLMapElement.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLMapElement interface is the interface to a [X]HTML + * map element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(3f49f8c6-2e9d-4323-b30c-2404d5ff1f57)] +interface nsIDOMHTMLMapElement : nsISupports +{ + readonly attribute nsIDOMHTMLCollection areas; + attribute DOMString name; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl new file mode 100644 index 000000000..68c15c00c --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" +#include "nsIDOMTimeRanges.idl" + +/** + * The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML + * <audio> and <video> elements. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#htmlmediaelement + * + * @status UNDER_DEVELOPMENT + */ + +// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK +%{C++ +#ifdef GetCurrentTime +#undef GetCurrentTime +#endif +#include "Visibility.h" +%} + +native Visibility(mozilla::Visibility); + +[uuid(c041d76c-15ce-47ad-b61d-e8755a6db638)] +interface nsIDOMHTMLMediaElement : nsISupports +{ + // network state + attribute DOMString src; + readonly attribute DOMString currentSrc; + const unsigned short NETWORK_EMPTY = 0; + const unsigned short NETWORK_IDLE = 1; + const unsigned short NETWORK_LOADING = 2; + const unsigned short NETWORK_NO_SOURCE = 3; + readonly attribute unsigned short networkState; + attribute DOMString preload; + readonly attribute nsIDOMTimeRanges buffered; + void load(); + DOMString canPlayType(in DOMString type); + + // ready state + const unsigned short HAVE_NOTHING = 0; + const unsigned short HAVE_METADATA = 1; + const unsigned short HAVE_CURRENT_DATA = 2; + const unsigned short HAVE_FUTURE_DATA = 3; + const unsigned short HAVE_ENOUGH_DATA = 4; + readonly attribute unsigned short readyState; + readonly attribute boolean seeking; + + // playback state + attribute double currentTime; + readonly attribute double duration; + readonly attribute boolean paused; + attribute double defaultPlaybackRate; + attribute double playbackRate; + attribute boolean mozPreservesPitch; + readonly attribute nsIDOMTimeRanges played; + readonly attribute nsIDOMTimeRanges seekable; + readonly attribute boolean ended; + readonly attribute boolean mozAutoplayEnabled; + attribute boolean autoplay; + attribute boolean loop; + void play(); + void pause(); + + // controls + attribute boolean controls; + attribute double volume; + attribute boolean muted; + attribute boolean defaultMuted; + + // Mozilla extension: stream capture + readonly attribute boolean mozAudioCaptured; + + // Mozilla extension: return embedded metadata from the stream as a + // JSObject with key:value pairs for each tag. This can be used by + // player interfaces to display the song title, artist, etc. + [implicit_jscontext] + jsval mozGetMetadata(); + + // Mozilla extension: provides access to the fragment end time if + // the media element has a fragment URI for the currentSrc, otherwise + // it is equal to the media duration. + readonly attribute double mozFragmentEnd; + + // Mozilla extension: an audio channel type for media elements. + // An exception is thrown if the app tries to change the audio channel type + // without the permission (manifest file for B2G apps). + // The supported values are: + // * normal (default value) + // Automatically paused if "notification" or higher priority channel + // is played + // Use case: normal applications + // * content + // Automatically paused if "notification" or higher priority channel + // is played. Also paused if another app starts using "content" + // channel. Using this channel never affects applications using + // the "normal" channel. + // Use case: video/audio players + // * notification + // Automatically paused if "alarm" or higher priority channel is played. + // Use case: New email, incoming SMS + // * alarm + // Automatically paused if "telephony" or higher priority channel is + // played. + // User case: Alarm clock, calendar alarms + // * telephony + // Automatically paused if "ringer" or higher priority + // channel is played. + // Use case: dialer, voip + // * ringer + // Automatically paused if "publicnotification" or higher priority + // channel is played. + // Use case: dialer, voip + // * publicnotification + // Always plays in speaker, even when headphones are plugged in. + // Use case: Camera shutter sound. + attribute DOMString mozAudioChannelType; + + // In addition the media element has this new events: + // * onmozinterruptbegin - called when the media element is interrupted + // because of the audiochannel manager. + // * onmozinterruptend - called when the interruption is concluded + + [notxpcom] boolean isVideo(); + + /** + * Called by layout to announce when the frame associated with this content + * has changed its visibility state. + * + * @param aOldVisibility The previous visibility state. + * @param aNewVisibility The new visibility state. + */ + [noscript, notxpcom] void onVisibilityChange(in Visibility aNewVisibility); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLMenuElement.idl b/dom/interfaces/html/nsIDOMHTMLMenuElement.idl new file mode 100644 index 000000000..b062ba690 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLMenuElement.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLMenuElement interface is the interface to a [X]HTML + * menu element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(a1ca9af6-f865-4fdf-901d-5858bb0ad5ea)] +interface nsIDOMHTMLMenuElement : nsISupports +{ + attribute boolean compact; + + attribute DOMString type; + attribute DOMString label; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl b/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl new file mode 100644 index 000000000..99c533554 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLMenuItemElement interface is the interface to a HTML + * <menuitem> element. + */ + +[uuid(979d6e44-5930-4232-b405-873939655c19)] +interface nsIDOMHTMLMenuItemElement : nsISupports +{ + attribute DOMString type; + attribute DOMString label; + attribute DOMString icon; + attribute boolean disabled; + + // This should be 'default' but in the IDL implementation + // this has been renamed 'defaultChecked'. + attribute boolean defaultChecked; + + attribute boolean checked; + attribute DOMString radiogroup; + + // Currently not implemented. + // readonly attribute HTMLElement? command; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLMetaElement.idl b/dom/interfaces/html/nsIDOMHTMLMetaElement.idl new file mode 100644 index 000000000..544327beb --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLMetaElement.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLMetaElement interface is the interface to a [X]HTML + * meta element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(2a3f789e-0667-464f-a8d7-6f58513443d9)] +interface nsIDOMHTMLMetaElement : nsISupports +{ + attribute DOMString content; + attribute DOMString httpEquiv; + attribute DOMString name; + attribute DOMString scheme; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLOListElement.idl b/dom/interfaces/html/nsIDOMHTMLOListElement.idl new file mode 100644 index 000000000..833ee1615 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLOListElement.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLOListElement interface is the interface to a [X]HTML + * ol element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(d899642a-53e2-4eb4-9d65-4a666a45ee01)] +interface nsIDOMHTMLOListElement : nsISupports +{ + attribute boolean compact; + attribute boolean reversed; + attribute long start; + attribute DOMString type; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLObjectElement.idl b/dom/interfaces/html/nsIDOMHTMLObjectElement.idl new file mode 100644 index 000000000..87dc35e2f --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLObjectElement.idl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLObjectElement interface is the interface to a [X]HTML + * object element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +interface nsIDOMValidityState; + +[uuid(baf443d2-da5d-40c9-be3c-c65a69a25250)] +interface nsIDOMHTMLObjectElement : nsISupports +{ + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString code; + attribute DOMString align; + attribute DOMString archive; + attribute DOMString border; + attribute DOMString codeBase; + attribute DOMString codeType; + attribute DOMString data; + attribute boolean declare; + attribute DOMString height; + attribute long hspace; + attribute DOMString name; + attribute DOMString standby; + attribute DOMString type; + attribute DOMString useMap; + attribute long vspace; + attribute DOMString width; + // Introduced in DOM Level 2: + readonly attribute nsIDOMDocument contentDocument; + + // The following lines are parte of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl b/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl new file mode 100644 index 000000000..d2b1a2df1 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLOptGroupElement interface is the interface to a + * [X]HTML optgroup element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(6fa79f99-4ce4-4634-840a-867fcfb32dba)] +interface nsIDOMHTMLOptGroupElement : nsISupports +{ + attribute boolean disabled; + attribute DOMString label; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLOptionElement.idl b/dom/interfaces/html/nsIDOMHTMLOptionElement.idl new file mode 100644 index 000000000..7ff7a90ab --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLOptionElement.idl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLOptionElement interface is the interface to a [X]HTML + * option element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(c2b3e9ff-6b36-4158-ace3-05a9c5b8e1c1)] +interface nsIDOMHTMLOptionElement : nsISupports +{ + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString label; + attribute boolean defaultSelected; + attribute boolean selected; + attribute DOMString value; + + attribute DOMString text; + readonly attribute long index; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLOptionsCollection.idl b/dom/interfaces/html/nsIDOMHTMLOptionsCollection.idl new file mode 100644 index 000000000..04592656f --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLOptionsCollection.idl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" +#include "nsIDOMHTMLCollection.idl" + +interface nsIDOMHTMLOptionElement; +interface nsIDOMHTMLSelectElement; + +/** + * The nsIDOMHTMLOptionsCollection interface is the interface to a + * collection of [X]HTML option elements. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +// Introduced in DOM Level 2: +[uuid(4173cc53-30f6-4d12-a770-981ba53164e2)] +interface nsIDOMHTMLOptionsCollection : nsISupports +{ + attribute unsigned long length; + // raises(DOMException) on setting + + // FIXME item should just be inherited from nsIDOMHTMLCollection + nsIDOMNode item(in unsigned long index); + + // FIXME namedItem (and getNamedItem) should return a NodeList if there are + // multiple matching items + nsIDOMNode namedItem(in DOMString name); + + attribute long selectedIndex; + + [noscript] void setOption(in unsigned long index, + in nsIDOMHTMLOptionElement option); + + [noscript] readonly attribute nsIDOMHTMLSelectElement select; + + // This add method implementation means the following + // since IDL doesn't support overloading. + // void add(in nsIDOMHTMLOptionElement, + // [optional] in nsIDOMHTMLOptionElement) + // void add(in nsIDOMHTMLOptionElement, in long) + void add(in nsIDOMHTMLOptionElement option, + [optional] in nsIVariant before); + void remove(in long index); +}; diff --git a/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl b/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl new file mode 100644 index 000000000..8ad4ec31b --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLParagraphElement interface is the interface to a + * [X]HTML p element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(b494e517-2388-4a63-80e7-2f73be3c38a3)] +interface nsIDOMHTMLParagraphElement : nsISupports +{ + attribute DOMString align; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLPictureElement.idl b/dom/interfaces/html/nsIDOMHTMLPictureElement.idl new file mode 100644 index 000000000..18f819c0b --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLPictureElement.idl @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +[scriptable, uuid(e0e5ac7f-b969-494c-a61e-9d740e38abba)] +interface nsIDOMHTMLPictureElement : nsISupports +{ +}; diff --git a/dom/interfaces/html/nsIDOMHTMLPreElement.idl b/dom/interfaces/html/nsIDOMHTMLPreElement.idl new file mode 100644 index 000000000..9013c4b0b --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLPreElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLPreElement interface is the interface to a [X]HTML + * pre element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(a2441b77-ad22-4275-b1dd-1b58c044fd04)] +interface nsIDOMHTMLPreElement : nsISupports +{ + attribute long width; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl b/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl new file mode 100644 index 000000000..6e422a4bf --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLQuoteElement interface is the interface to a [X]HTML + * q element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(f02502b5-32a6-4df7-8a57-1416553a3188)] +interface nsIDOMHTMLQuoteElement : nsISupports +{ + attribute DOMString cite; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl new file mode 100644 index 000000000..ec4cb5b77 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLScriptElement interface is the interface to a [X]HTML + * script element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(fe96dc1c-40e4-4974-9354-e3fce663c3d5)] +interface nsIDOMHTMLScriptElement : nsISupports +{ + attribute DOMString src; + attribute boolean async; + attribute boolean defer; + attribute DOMString type; + attribute DOMString charset; + attribute DOMString text; + + attribute DOMString htmlFor; + attribute DOMString event; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl new file mode 100644 index 000000000..ff5708943 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl @@ -0,0 +1,60 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" +#include "nsIDOMHTMLOptionsCollection.idl" + +/** + * The nsIDOMHTMLSelectElement interface is the interface to a [X]HTML + * select element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +interface nsIDOMValidityState; + +[uuid(d8914a2d-3556-4b66-911c-a84c4394e7fa)] +interface nsIDOMHTMLSelectElement : nsISupports +{ + attribute boolean autofocus; + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute boolean multiple; + attribute DOMString name; + attribute unsigned long size; + + readonly attribute DOMString type; + + readonly attribute nsIDOMHTMLOptionsCollection options; + attribute unsigned long length; + nsIDOMNode item(in unsigned long index); + nsIDOMNode namedItem(in DOMString name); + // This add method implementation means the following + // since IDL doesn't support overfload. + // void add(in nsIDOMHTMLElement, [optional] in nsIDOMHTMLElement) + // void add(in nsIDOMHTMLElement, in long) + void add(in nsIDOMHTMLElement element, + [optional] in nsIVariant before) + raises(DOMException); + void remove(in long index); + + readonly attribute nsIDOMHTMLCollection selectedOptions; + attribute long selectedIndex; + attribute DOMString value; + + // The following lines are part of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); + + attribute boolean required; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLSourceElement.idl b/dom/interfaces/html/nsIDOMHTMLSourceElement.idl new file mode 100644 index 000000000..907e4b632 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLSourceElement.idl @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLSourceElement interface is the interface to a HTML + * <source> element. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#source + * + * @status UNDER_DEVELOPMENT + */ + +[uuid(1deb68f8-2ed6-4a41-b8c8-e0f86510f799)] +interface nsIDOMHTMLSourceElement : nsISupports +{ + attribute DOMString src; + attribute DOMString type; + attribute DOMString srcset; + attribute DOMString sizes; + attribute DOMString media; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLStyleElement.idl b/dom/interfaces/html/nsIDOMHTMLStyleElement.idl new file mode 100644 index 000000000..789bb0489 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLStyleElement.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLStyleElement interface is the interface to a [X]HTML + * style element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(fa326d22-8739-4eef-a80e-6449bde605d2)] +interface nsIDOMHTMLStyleElement : nsISupports +{ + [binaryname(MozDisabled)] + attribute boolean disabled; + attribute DOMString media; + attribute DOMString type; + attribute boolean scoped; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl b/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl new file mode 100644 index 000000000..65b92969f --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLTableCellElement interface is the interface to a + * [X]HTML td element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(3203c36f-33fd-4628-8c88-77e82d38df1e)] +interface nsIDOMHTMLTableCellElement : nsISupports +{ + readonly attribute long cellIndex; + attribute DOMString abbr; + attribute DOMString align; + attribute DOMString axis; + attribute DOMString bgColor; + attribute DOMString ch; + attribute DOMString chOff; + attribute long colSpan; + attribute DOMString headers; + attribute DOMString height; + attribute boolean noWrap; + attribute long rowSpan; + attribute DOMString scope; + attribute DOMString vAlign; + attribute DOMString width; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl new file mode 100644 index 000000000..509b0c916 --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl @@ -0,0 +1,67 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +interface nsIControllers; +interface nsIDOMValidityState; + +/** + * The nsIDOMHTMLTextAreaElement interface is the interface to a + * [X]HTML textarea element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(7a4aeb2e-fcf3-443e-b002-ca1c8ea322e9)] +interface nsIDOMHTMLTextAreaElement : nsISupports +{ + attribute boolean autofocus; + attribute unsigned long cols; + attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute long maxLength; + attribute long minLength; + attribute DOMString name; + attribute DOMString placeholder; + attribute boolean readOnly; + attribute boolean required; + attribute unsigned long rows; + /** + * Reflects the wrap content attribute. Possible values are "soft", "hard" and + * "off". "soft" is the default. + */ + [Null(Stringify)] + attribute DOMString wrap; + + readonly attribute DOMString type; + attribute DOMString defaultValue; + attribute DOMString value; + readonly attribute long textLength; + + // The following lines are part of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); + + void select(); + attribute long selectionStart; + attribute long selectionEnd; + void setSelectionRange(in long selectionStart, in long selectionEnd, [optional] in DOMString direction); + attribute DOMString selectionDirection; + + + // Mozilla extensions + // Please make sure to update the HTMLTextAreaElement Web IDL interface to + // mirror the list of Mozilla extensions here when changing it. + readonly attribute nsIControllers controllers; +}; diff --git a/dom/interfaces/html/nsIDOMHTMLUListElement.idl b/dom/interfaces/html/nsIDOMHTMLUListElement.idl new file mode 100644 index 000000000..c4942da7e --- /dev/null +++ b/dom/interfaces/html/nsIDOMHTMLUListElement.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMHTMLElement.idl" + +/** + * The nsIDOMHTMLUListElement interface is the interface to a [X]HTML + * ul element. + * + * This interface is trying to follow the DOM Level 2 HTML specification: + * http://www.w3.org/TR/DOM-Level-2-HTML/ + * + * with changes from the work-in-progress WHATWG HTML specification: + * http://www.whatwg.org/specs/web-apps/current-work/ + */ + +[uuid(8ba1ee8d-36a4-43fc-9148-5144c2a29c96)] +interface nsIDOMHTMLUListElement : nsISupports +{ + attribute boolean compact; + attribute DOMString type; +}; diff --git a/dom/interfaces/html/nsIDOMMozBrowserFrame.idl b/dom/interfaces/html/nsIDOMMozBrowserFrame.idl new file mode 100644 index 000000000..75602bcfb --- /dev/null +++ b/dom/interfaces/html/nsIDOMMozBrowserFrame.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(4CAFE116-581B-4194-B0DE-7F02378FC51D)] +interface nsIDOMMozBrowserFrame : nsISupports +{ + /** + * <iframe> element may have the mozbrowser attribute. + * + * The mozbrowser attribute has no effect unless the <iframe> element is + * contained in a document privileged to create browser frames. + * + * An <iframe> element in a privileged document with the mozbrowser attribute + * emits a variety of events when various things happen inside the frame. + * + * This will be documented eventually, but for more information at the moment, + * see dom/browser-element/BrowserElement{Child,Parent}.js. + * + */ + attribute boolean mozbrowser; +}; diff --git a/dom/interfaces/html/nsIDOMTimeRanges.idl b/dom/interfaces/html/nsIDOMTimeRanges.idl new file mode 100644 index 000000000..7e738fa8b --- /dev/null +++ b/dom/interfaces/html/nsIDOMTimeRanges.idl @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "domstubs.idl" + +[uuid(c43448db-0bab-461d-b648-1ca14a967f7e)] +interface nsIDOMTimeRanges : nsISupports +{ + /* The number of ranges represented by the time range object */ + readonly attribute unsigned long length; + + /* The position of the start of the index'd range, in seconds measured + from the start of the timeline that this object represents */ + double start(in unsigned long index); + + /* The position of the end of the index'd range, in seconds measured + from the start of the timeline that this object represents */ + double end(in unsigned long index); +}; diff --git a/dom/interfaces/html/nsIDOMValidityState.idl b/dom/interfaces/html/nsIDOMValidityState.idl new file mode 100644 index 000000000..fdd24a6fb --- /dev/null +++ b/dom/interfaces/html/nsIDOMValidityState.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMValidityState interface is the interface to a ValidityState + * object which represents the validity states of an element. + * + * For more information on this interface please see + * http://www.whatwg.org/specs/web-apps/current-work/#validitystate + */ + +[uuid(00bed276-f1f7-492f-a039-dbd9b9efc10b)] +interface nsIDOMValidityState : nsISupports +{ + readonly attribute boolean valueMissing; + readonly attribute boolean typeMismatch; + readonly attribute boolean patternMismatch; + readonly attribute boolean tooLong; + readonly attribute boolean tooShort; + readonly attribute boolean rangeUnderflow; + readonly attribute boolean rangeOverflow; + readonly attribute boolean stepMismatch; + readonly attribute boolean badInput; + readonly attribute boolean customError; + readonly attribute boolean valid; +}; diff --git a/dom/interfaces/html/nsIMozBrowserFrame.idl b/dom/interfaces/html/nsIMozBrowserFrame.idl new file mode 100644 index 000000000..a9dccdd1c --- /dev/null +++ b/dom/interfaces/html/nsIMozBrowserFrame.idl @@ -0,0 +1,89 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMMozBrowserFrame.idl" + +interface nsITabParent; + +[scriptable, builtinclass, uuid(0c0a862c-1a47-43c0-ae9e-d51835e3e1a6)] +interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame +{ + /** + * Gets whether this frame really is a browser or app frame. + * + * In order to really be a browser frame, this frame's + * nsIDOMMozBrowserFrame::mozbrowser attribute must be true, and the frame + * may have to pass various security checks. + */ + [infallible] readonly attribute boolean reallyIsBrowserOrApp; + + /** + * Gets whether this frame really is an app frame. + * + * In order to really be an app frame, this frame must really be a browser + * frame (this requirement will go away eventually), and the frame's mozapp + * attribute must point to the manifest of a valid app. + */ + [infallible] readonly attribute boolean reallyIsApp; + + /** + * Gets whether this frame is an isolated frame. + * + * By default, browser frames are isolated, meaning they have a principal + * where OriginAttributes.mIsInIsolatedMozBrowser == true. This isolates + * storage and other origin related items from non-browser apps, xul:browsers, + * etc. + * + * Isolation can be disabled by setting the frame's isolated attribute to + * false. Disabling isolation is only allowed if the containing document has + * browser permission (or equivalent access). + */ + [infallible] readonly attribute boolean isolated; + + /** + * Gets this frame's app manifest URL, if the frame really is an app frame. + * Otherwise, returns the empty string. + * + * This method is guaranteed not to fail. + */ + readonly attribute AString appManifestURL; + + /** + * Normally, a frame tries to create its frame loader when its src is + * modified, or its contentWindow is accessed. + * + * disallowCreateFrameLoader prevents the frame element from creating its + * frame loader (in the same way that not being inside a document prevents the + * creation of a frame loader). allowCreateFrameLoader lifts this restriction. + * + * These methods are not re-entrant -- it is an error to call + * disallowCreateFrameLoader twice without first calling allowFrameLoader. + * + * It's also an error to call either method if we already have a frame loader. + */ + void disallowCreateFrameLoader(); + void allowCreateFrameLoader(); + + /** + * Create a remote (i.e., out-of-process) frame loader attached to the given + * tab parent. + * + * It is an error to call this method if we already have a frame loader. + */ + void createRemoteFrameLoader(in nsITabParent aTabParent); + + /** + * Initialize the API, and add frame message listener that supports API + * invocations. + */ + [noscript] void initializeBrowserAPI(); + + /** + * Notify frame scripts that support the API to destroy. + */ + [noscript] void destroyBrowserFrameScripts(); +}; diff --git a/dom/interfaces/json/moz.build b/dom/interfaces/json/moz.build new file mode 100644 index 000000000..ab57486a5 --- /dev/null +++ b/dom/interfaces/json/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIJSON.idl', +] + +XPIDL_MODULE = 'dom_json' + diff --git a/dom/interfaces/json/nsIJSON.idl b/dom/interfaces/json/nsIJSON.idl new file mode 100644 index 000000000..b09e4e069 --- /dev/null +++ b/dom/interfaces/json/nsIJSON.idl @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIInputStream; +interface nsIOutputStream; +interface nsIScriptGlobalObject; + +[ptr] native JSValPtr(JS::Value); +[ptr] native JSContext(JSContext); + +%{C++ +#include "js/TypeDecls.h" +%} + +/** + * Don't use this! Use JSON.parse and JSON.stringify directly. + */ +[scriptable, uuid(083aebb0-7790-43b2-ae81-9e404e626236)] +interface nsIJSON : nsISupports +{ + /** + * New users should use JSON.stringify! + * The encode() method is only present for backward compatibility. + * encode() is not a conforming JSON stringify implementation! + */ + [deprecated,implicit_jscontext,optional_argc] + AString encode([optional] in jsval value); + + /** + * New users should use JSON.stringify. + * You may also want to have a look at nsIConverterOutputStream. + * + * The encodeToStream() method is only present for backward compatibility. + * encodeToStream() is not a conforming JSON stringify implementation! + */ + [deprecated,implicit_jscontext,optional_argc] + void encodeToStream(in nsIOutputStream stream, + in string charset, + in boolean writeBOM, + [optional] in jsval value); + + /** + * New users should use JSON.parse! + * The decode() method is only present for backward compatibility. + */ + [deprecated,implicit_jscontext] + jsval decode(in AString str); + + [implicit_jscontext] + jsval decodeFromStream(in nsIInputStream stream, + in long contentLength); + + [noscript] AString encodeFromJSVal(in JSValPtr value, in JSContext cx); + + // Make sure you GCroot the result of this function before using it. + [noscript] jsval decodeToJSVal(in AString str, in JSContext cx); +}; diff --git a/dom/interfaces/notification/moz.build b/dom/interfaces/notification/moz.build new file mode 100644 index 000000000..9e263b9f7 --- /dev/null +++ b/dom/interfaces/notification/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsINotificationStorage.idl', +] + +XPIDL_MODULE = 'dom_notification' + diff --git a/dom/interfaces/notification/nsINotificationStorage.idl b/dom/interfaces/notification/nsINotificationStorage.idl new file mode 100644 index 000000000..5edbcac3c --- /dev/null +++ b/dom/interfaces/notification/nsINotificationStorage.idl @@ -0,0 +1,133 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(c1622232-259c-43b0-b52e-89c39dcd9796)] +interface nsINotificationStorageCallback : nsISupports +{ + /** + * Callback function used to pass single notification back + * into C++ land for Notification.get return data. + * + * @param id: a uuid for this notification + * @param title: the notification title + * @param dir: the notification direction, + * possible values are "ltr", "rtl", "auto" + * @param lang: the notification language + * @param body: the notification body + * @param tag: the notification tag + */ + void handle(in DOMString id, + in DOMString title, + in DOMString dir, + in DOMString lang, + in DOMString body, + in DOMString tag, + in DOMString icon, + in DOMString data, + in DOMString behavior, + in DOMString serviceWorkerRegistrationScope); + + /** + * Callback function used to notify C++ the we have returned + * all notification objects for this Notification.get call. + */ + void done(); +}; + +/** + * Interface for notification persistence layer. + */ +[scriptable, uuid(17f85e52-fe57-440e-9ba1-5c312ca02b95)] +interface nsINotificationStorage : nsISupports +{ + + /** + * Add/replace a notification to the persistence layer. + * + * @param origin: the origin/app of this notification + * @param id: a uuid for this notification + * @param title: the notification title + * @param dir: the notification direction, + * possible values are "ltr", "rtl", "auto" + * @param lang: the notification language + * @param body: the notification body + * @param tag: notification tag, will replace any existing + * notifications with same origin/tag pair + * @param alertName: the alert identifier as used by system app. + * Stored in the database to avoid re-computing + * it. Built from origin and tag or id depending + * whether there is a tag defined. + * @param registrationID: Opaque string that identifies the service worker + * registration this Notification is associated with. + * May be empty. Only set for Notifications created by + * showNotification(). + */ + void put(in DOMString origin, + in DOMString id, + in DOMString title, + in DOMString dir, + in DOMString lang, + in DOMString body, + in DOMString tag, + in DOMString icon, + in DOMString alertName, + in DOMString data, + in DOMString behavior, + in DOMString serviceWorkerRegistrationScope); + + /** + * Retrieve a list of notifications. + * + * @param origin: the origin/app for which to fetch notifications from + * @param tag: used to fetch only a specific tag + * @param callback: nsINotificationStorageCallback, used for + * returning notifications objects + */ + void get(in DOMString origin, + in DOMString tag, + in nsINotificationStorageCallback aCallback); + + /** + * Retrieve a notification by ID. + * + * @param origin: the origin/app for which to fetch notifications. + * @param id: the id of the notification. + * @param callback: nsINotificationStorageCallback whose Handle method will + * be called *at most once* if the notification with that ID is found. Not + * called if that ID is not found. Done() will be called right after + * Handle(). + */ + void getByID(in DOMString origin, + in DOMString id, + in nsINotificationStorageCallback aCallback); + + /** + * Remove a notification from storage. + * + * @param origin: the origin/app to delete the notification from + * @param id: the uuid for the notification to delete + */ + void delete(in DOMString origin, + in DOMString id); + + /** + * Notifications are not supposed to be persistent, according to spec, at + * least for now. But we want to be able to have this behavior on B2G. Thus, + * this method will check if the origin sending the notifications is a valid + * registered app with a manifest or not. Hence, a webpage that has none + * will have its notification sent and available (via Notification.get()) + * during the life time of the page. + * + * @param origin: Origin from which the notification is sent. + * + * @return boolean + */ + boolean canPut(in DOMString origin); +}; + +%{C++ +#define NS_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/notificationStorage;1" +%} diff --git a/dom/interfaces/offline/moz.build b/dom/interfaces/offline/moz.build new file mode 100644 index 000000000..1589c31d5 --- /dev/null +++ b/dom/interfaces/offline/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMOfflineResourceList.idl', +] + +XPIDL_MODULE = 'dom_offline' + diff --git a/dom/interfaces/offline/nsIDOMOfflineResourceList.idl b/dom/interfaces/offline/nsIDOMOfflineResourceList.idl new file mode 100644 index 000000000..dc7637640 --- /dev/null +++ b/dom/interfaces/offline/nsIDOMOfflineResourceList.idl @@ -0,0 +1,101 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(6044702d-e4a9-420c-b711-558b7d6a3b9f)] +interface nsIDOMOfflineResourceList : nsISupports +{ + /** + * Get the list of dynamically-managed entries. + */ + readonly attribute nsISupports mozItems; + + /** + * Check that an entry exists in the list of dynamically-managed entries. + * + * @param uri + * The resource to check. + */ + boolean mozHasItem(in DOMString uri); + + /** + * Get the number of dynamically-managed entries. + * @status DEPRECATED + * Clients should use the "items" attribute. + */ + readonly attribute unsigned long mozLength; + + /** + * Get the URI of a dynamically-managed entry. + * @status DEPRECATED + * Clients should use the "items" attribute. + */ + DOMString mozItem(in unsigned long index); + + /** + * Add an item to the list of dynamically-managed entries. The resource + * will be fetched into the application cache. + * + * @param uri + * The resource to add. + */ + void mozAdd(in DOMString uri); + + /** + * Remove an item from the list of dynamically-managed entries. If this + * was the last reference to a URI in the application cache, the cache + * entry will be removed. + * + * @param uri + * The resource to remove. + */ + void mozRemove(in DOMString uri); + + /** + * State of the application cache this object is associated with. + */ + + /* This object is not associated with an application cache. */ + const unsigned short UNCACHED = 0; + + /* The application cache is not being updated. */ + const unsigned short IDLE = 1; + + /* The manifest is being fetched and checked for updates */ + const unsigned short CHECKING = 2; + + /* Resources are being downloaded to be added to the cache */ + const unsigned short DOWNLOADING = 3; + + /* There is a new version of the application cache available */ + const unsigned short UPDATEREADY = 4; + + /* The application cache group is now obsolete. */ + const unsigned short OBSOLETE = 5; + + readonly attribute unsigned short status; + + /** + * Begin the application update process on the associated application cache. + */ + void update(); + + /** + * Swap in the newest version of the application cache, or disassociate + * from the cache if the cache group is obsolete. + */ + void swapCache(); + + /* Events */ + [implicit_jscontext] attribute jsval onchecking; + [implicit_jscontext] attribute jsval onerror; + [implicit_jscontext] attribute jsval onnoupdate; + [implicit_jscontext] attribute jsval ondownloading; + [implicit_jscontext] attribute jsval onprogress; + [implicit_jscontext] attribute jsval onupdateready; + [implicit_jscontext] attribute jsval oncached; + [implicit_jscontext] attribute jsval onobsolete; +}; diff --git a/dom/interfaces/permission/moz.build b/dom/interfaces/permission/moz.build new file mode 100644 index 000000000..8e7942391 --- /dev/null +++ b/dom/interfaces/permission/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIPermissionPromptService.idl', +] + +XPIDL_MODULE = 'dom_permissionsettings' + diff --git a/dom/interfaces/permission/nsIPermissionPromptService.idl b/dom/interfaces/permission/nsIPermissionPromptService.idl new file mode 100644 index 000000000..773c25b06 --- /dev/null +++ b/dom/interfaces/permission/nsIPermissionPromptService.idl @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIContentPermissionRequest; + +/** + * Generic permission service for access to WebAPIs, hardware, capabilities. + */ +[scriptable, uuid(e5f953b3-a6ca-444e-a88d-cdc81383741c)] +interface nsIPermissionPromptService : nsISupports +{ + /** + * Checks if the capability requires a permission, fires the corresponding cancel() + * or allow() method in aRequest after consulting PermissionSettings, etc. + */ + void getPermission(in nsIContentPermissionRequest aRequest); +}; diff --git a/dom/interfaces/push/moz.build b/dom/interfaces/push/moz.build new file mode 100644 index 000000000..5c59f3941 --- /dev/null +++ b/dom/interfaces/push/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIPushErrorReporter.idl', + 'nsIPushNotifier.idl', + 'nsIPushService.idl', +] + +XPIDL_MODULE = 'dom_push' diff --git a/dom/interfaces/push/nsIPushErrorReporter.idl b/dom/interfaces/push/nsIPushErrorReporter.idl new file mode 100644 index 000000000..d9cef82ea --- /dev/null +++ b/dom/interfaces/push/nsIPushErrorReporter.idl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(b58249f9-1a04-48cc-bc20-2c992d64c73e)] +interface nsIPushErrorReporter : nsISupports +{ + /** + * Ack types, reported when the Push service acknowledges an incoming message. + * + * Acks are sent before the message is dispatched to the service worker, + * since the server delays new messages until all outstanding ones have been + * acked. |reportDeliveryError| will be called if an error occurs in the + * worker's `push` event handler after acking the message. + */ + const uint16_t ACK_DELIVERED = 0; + const uint16_t ACK_DECRYPTION_ERROR = 1; + const uint16_t ACK_NOT_DELIVERED = 2; + + /** + * Unsubscribe reasons, reported when the service drops a subscription. + */ + const uint16_t UNSUBSCRIBE_MANUAL = 3; + const uint16_t UNSUBSCRIBE_QUOTA_EXCEEDED = 4; + const uint16_t UNSUBSCRIBE_PERMISSION_REVOKED = 5; + + /** + * Delivery error reasons, reported when a service worker fails to handle + * an incoming push message in its `push` event handler. + */ + const uint16_t DELIVERY_UNCAUGHT_EXCEPTION = 6; + const uint16_t DELIVERY_UNHANDLED_REJECTION = 7; + const uint16_t DELIVERY_INTERNAL_ERROR = 8; + + /** + * Reports a `push` event handler error to the Push service. |messageId| is + * an opaque string passed to `nsIPushNotifier.notifyPush{WithData}`. + * |reason| is a delivery error reason. + */ + void reportDeliveryError(in DOMString messageId, + [optional] in uint16_t reason); +}; diff --git a/dom/interfaces/push/nsIPushNotifier.idl b/dom/interfaces/push/nsIPushNotifier.idl new file mode 100644 index 000000000..b29e73056 --- /dev/null +++ b/dom/interfaces/push/nsIPushNotifier.idl @@ -0,0 +1,94 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +%{C++ +#define PUSHNOTIFIER_CONTRACTID \ + "@mozilla.org/push/Notifier;1" + +// These constants are duplicated in `PushComponents.js`. +#define OBSERVER_TOPIC_PUSH "push-message" +#define OBSERVER_TOPIC_SUBSCRIPTION_CHANGE "push-subscription-change" +#define OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED "push-subscription-modified" +%} + +interface nsIPrincipal; + +/** + * Fires XPCOM observer notifications and service worker events for + * messages sent to push subscriptions. + */ +[scriptable, builtinclass, uuid(b00dfdeb-14e5-425b-adc7-b531442e3216)] +interface nsIPushNotifier : nsISupports +{ + /** + * Fires a `push-message` observer notification, and sends a `push` event to + * the service worker registered for the |scope|. |messageId| is an opaque ID + * used to report errors if the worker fails to handle the message. + */ + void notifyPush(in ACString scope, in nsIPrincipal principal, + in DOMString messageId); + + /** + * Same as `notifyPush`, except the subject of the observer notification + * receives an `nsIPushMessage` instance containing the |data|. Service + * workers can access the |data| via the `PushMessageData` WebIDL interface. + */ + void notifyPushWithData(in ACString scope, in nsIPrincipal principal, + in DOMString messageId, + [optional] in uint32_t dataLen, + [array, size_is(dataLen)] in uint8_t data); + + /** + * Fires a `push-subscription-change` observer notification, and sends a + * `pushsubscriptionchange` event to the service worker registered for the + * |scope|. + */ + void notifySubscriptionChange(in ACString scope, in nsIPrincipal principal); + + /** + * Fires a `push-subscription-modified` observer notification. Chrome code + * can listen for this notification to see when a subscription is added, + * updated, removed, or expired for any |scope|. + * + * This is useful for Dev Tools and debugging add-ons that passively observe + * when subscriptions are created or dropped. Other callers should listen for + * `push-subscription-change` and resubscribe instead. + */ + void notifySubscriptionModified(in ACString scope, in nsIPrincipal principal); + + void notifyError(in ACString scope, in nsIPrincipal principal, + in DOMString message, in uint32_t flags); +}; + +/** + * Provides methods for retrieving push message data in different formats. + * This interface resembles the `PushMessageData` WebIDL interface. + */ +[scriptable, builtinclass, uuid(dfc4f151-cead-40df-8eb7-7a7a67c54b16)] +interface nsIPushData : nsISupports +{ + /** Extracts the data as a UTF-8 text string. */ + DOMString text(); + + /** Extracts the data as a JSON value. */ + [implicit_jscontext] jsval json(); + + /** Extracts the raw binary data. */ + void binary([optional] out uint32_t dataLen, + [array, retval, size_is(dataLen)] out uint8_t data); +}; + +/** + * The subject of a `push-message` observer notification. |data| may be |null| + * for messages without data. + */ +[scriptable, builtinclass, uuid(b9d063ca-0e3f-4fee-be4b-ea9103263433)] +interface nsIPushMessage : nsISupports +{ + readonly attribute nsIPrincipal principal; + readonly attribute nsIPushData data; +}; diff --git a/dom/interfaces/push/nsIPushService.idl b/dom/interfaces/push/nsIPushService.idl new file mode 100644 index 000000000..920169d35 --- /dev/null +++ b/dom/interfaces/push/nsIPushService.idl @@ -0,0 +1,150 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIPrincipal; + +/** + * A push subscription, passed as an argument to a subscription callback. + * Similar to the `PushSubscription` WebIDL interface. + */ +[scriptable, uuid(1de32d5c-ea88-4c9e-9626-b032bd87f415)] +interface nsIPushSubscription : nsISupports +{ + readonly attribute DOMString endpoint; + readonly attribute long long pushCount; + readonly attribute long long lastPush; + readonly attribute long quota; + readonly attribute bool isSystemSubscription; + readonly attribute jsval p256dhPrivateKey; + + bool quotaApplies(); + bool isExpired(); + + void getKey(in DOMString name, + [optional] out uint32_t keyLen, + [array, size_is(keyLen), retval] out uint8_t key); +}; + +/** + * Called by methods that return a push subscription. A non-success + * |status| indicates that there was a problem returning the + * subscription, and the |subscription| argument should be ignored. Otherwise, + * |subscription| will point to a valid push subscription, or |null| if the + * subscription does not exist. + */ + [scriptable, uuid(1799c074-9d52-46b0-ab3c-c09790732f6f), function] + interface nsIPushSubscriptionCallback : nsISupports + { + void onPushSubscription(in nsresult status, + in nsIPushSubscription subscription); + }; + +/** + * Called by |unsubscribe|. A non-success |status| indicates that there was + * a problem unsubscribing, and the |success| argument should be ignored. + * Otherwise, |success| is true if unsubscribing was successful, and false if + * the subscription does not exist. + */ +[scriptable, uuid(d574118f-61a9-4270-b1f6-4461aa85c4f5), function] +interface nsIUnsubscribeResultCallback : nsISupports +{ + void onUnsubscribe(in nsresult status, in bool success); +}; + +/** + * Called by |clearForDomain|. A non-success |status| indicates that there was + * a problem clearing subscriptions for the given domain. + */ +[scriptable, uuid(bd47b38e-8bfa-4f92-834e-832a4431e05e), function] +interface nsIPushClearResultCallback : nsISupports +{ + void onClear(in nsresult status); +}; + +/** + * A service for components to subscribe and receive push messages from web + * services. This functionality is exposed to content via the Push DOM API, + * which uses service workers. This interface exists to support the DOM API, + * and allows privileged code to receive messages without migrating to service + * workers. + */ +[scriptable, uuid(678ef584-bf25-47aa-ac84-03efc0865b68)] +interface nsIPushService : nsISupports +{ + /** Observer topic names, exported for convenience. */ + readonly attribute DOMString pushTopic; + readonly attribute DOMString subscriptionChangeTopic; + readonly attribute DOMString subscriptionModifiedTopic; + + /** + * Creates a push subscription for the given |scope| URL and |principal|. + * If a subscription already exists for this |(scope, principal)| pair, + * the callback will receive the existing record as the second argument. + * + * The |endpoint| property of the subscription record is a URL string + * that can be used to send push messages to subscribers. + * + * Each incoming message fires a `push-message` observer notification, with + * an `nsIPushMessage` as the subject and the |scope| as the data. + * + * If the server drops a subscription, a `push-subscription-change` observer + * will be fired, with the subject set to |principal| and the data set to + * |scope|. Servers may drop subscriptions at any time, so callers should + * recreate subscriptions if desired. + */ + void subscribe(in DOMString scope, in nsIPrincipal principal, + in nsIPushSubscriptionCallback callback); + + /** + * Creates a restricted push subscription with the given public |key|. The + * application server must use the corresponding private key to authenticate + * message delivery requests, as described in draft-thomson-webpush-vapid. + */ + void subscribeWithKey(in DOMString scope, in nsIPrincipal principal, + in uint32_t keyLength, + [const, array, size_is(keyLength)] in uint8_t key, + in nsIPushSubscriptionCallback callback); + + /** + * Removes a push subscription for the given |scope|. + */ + void unsubscribe(in DOMString scope, in nsIPrincipal principal, + in nsIUnsubscribeResultCallback callback); + + /** + * Retrieves the subscription record associated with the given + * |(scope, principal)| pair. If the subscription does not exist, the + * callback will receive |null| as the second argument. + */ + void getSubscription(in DOMString scope, in nsIPrincipal principal, + in nsIPushSubscriptionCallback callback); + + /** + * Drops every subscription for the given |domain|, or all domains if + * |domain| is "*". + */ + void clearForDomain(in DOMString domain, + in nsIPushClearResultCallback callback); +}; + +[scriptable, uuid(a2555e70-46f8-4b52-bf02-d978b979d143)] +interface nsIPushQuotaManager : nsISupports +{ + /** + * Informs the quota manager that a notification + * for the given origin has been shown. Used to + * determine if push quota should be relaxed. + */ + void notificationForOriginShown(in string origin); + + /** + * Informs the quota manager that a notification + * for the given origin has been closed. Used to + * determine if push quota should be relaxed. + */ + void notificationForOriginClosed(in string origin); +}; diff --git a/dom/interfaces/range/moz.build b/dom/interfaces/range/moz.build new file mode 100644 index 000000000..5dc045a0d --- /dev/null +++ b/dom/interfaces/range/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMRange.idl', +] + +XPIDL_MODULE = 'dom_range' + diff --git a/dom/interfaces/range/nsIDOMRange.idl b/dom/interfaces/range/nsIDOMRange.idl new file mode 100644 index 000000000..2dc40ac98 --- /dev/null +++ b/dom/interfaces/range/nsIDOMRange.idl @@ -0,0 +1,77 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMRange interface is an interface to a DOM range object. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ + */ + +[builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)] +interface nsIDOMRange : nsISupports +{ + readonly attribute nsIDOMNode startContainer; + readonly attribute long startOffset; + readonly attribute nsIDOMNode endContainer; + readonly attribute long endOffset; + readonly attribute boolean collapsed; + readonly attribute nsIDOMNode commonAncestorContainer; + + void setStart(in nsIDOMNode refNode, in long offset); + void setEnd(in nsIDOMNode refNode, in long offset); + void setStartBefore(in nsIDOMNode refNode); + void setStartAfter(in nsIDOMNode refNode); + void setEndBefore(in nsIDOMNode refNode); + void setEndAfter(in nsIDOMNode refNode); + void collapse(in boolean toStart); + void selectNode(in nsIDOMNode refNode); + void selectNodeContents(in nsIDOMNode refNode); + + // CompareHow + const unsigned short START_TO_START = 0; + const unsigned short START_TO_END = 1; + const unsigned short END_TO_END = 2; + const unsigned short END_TO_START = 3; + + short compareBoundaryPoints(in unsigned short how, + in nsIDOMRange sourceRange); + void deleteContents(); + nsIDOMDocumentFragment extractContents(); + nsIDOMDocumentFragment cloneContents(); + void insertNode(in nsIDOMNode newNode); + void surroundContents(in nsIDOMNode newParent); + nsIDOMRange cloneRange(); + DOMString toString(); + void detach(); + + // This method comes from + // http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface + nsIDOMDocumentFragment createContextualFragment(in DOMString fragment); + + // This returns true if parent+offset equals either + // of the boundary points or is between them. + boolean isPointInRange(in nsIDOMNode parent, + in long offset); + + // comparePoint returns + // -1 if point is before the start boundary point, + // 0 if point is either of the boundary points or between them, + // 1 if point is after the end boundary point. + // Sort of a strcmp for ranges. + short comparePoint(in nsIDOMNode parent, in long offset); + + /** + * Returns whether the range intersects node. + */ + boolean intersectsNode(in nsIDOMNode node); + + // These methods come from + // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface + nsIDOMClientRectList getClientRects(); + nsIDOMClientRect getBoundingClientRect(); +}; diff --git a/dom/interfaces/security/moz.build b/dom/interfaces/security/moz.build new file mode 100644 index 000000000..6796305f7 --- /dev/null +++ b/dom/interfaces/security/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIContentSecurityManager.idl', + 'nsIContentSecurityPolicy.idl' +] + +XPIDL_MODULE = 'dom_security' + diff --git a/dom/interfaces/security/nsIContentSecurityManager.idl b/dom/interfaces/security/nsIContentSecurityManager.idl new file mode 100644 index 000000000..1a1c91021 --- /dev/null +++ b/dom/interfaces/security/nsIContentSecurityManager.idl @@ -0,0 +1,56 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIChannel; +interface nsIPrincipal; +interface nsIStreamListener; +interface nsIURI; + +/** + * nsIContentSecurityManager + * Describes an XPCOM component used to perform security checks. + */ + +[scriptable, uuid(3a9a1818-2ae8-4ec5-a340-8b29d31fca3b)] +interface nsIContentSecurityManager : nsISupports +{ + /** + * Checks whether a channel is allowed to access the given URI and + * whether the channel should be openend or should be blocked consulting + * internal security checks like Same Origin Policy, Content Security + * Policy, Mixed Content Blocker, etc. + * + * If security checks within performSecurityCheck fail, the function + * throws an exception. + * + * @param aChannel + * The channel about to be openend + * @param aStreamListener + * The Streamlistener of the channel potentially wrapped + * into CORSListenerProxy. + * @return + * The StreamListener of the channel wrapped into CORSListenerProxy. + * + * @throws NS_ERROR_DOM_BAD_URI + * If accessing the URI is not allowed (e.g. prohibted by SOP) + * @throws NS_ERROR_CONTENT_BLOCKED + * If any of the security policies (CSP, Mixed content) is violated + */ + nsIStreamListener performSecurityCheck(in nsIChannel aChannel, + in nsIStreamListener aStreamListener); + + /** + * Implementation of + * https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy + * + * The value returned by this method feeds into the the Secure Context + * algorithm that determins the value of Window.isSecureContext and + * WorkerGlobalScope.isSecureContext. + * + * This method returns false instead of throwing upon errors. + */ + boolean isOriginPotentiallyTrustworthy(in nsIPrincipal aPrincipal); +}; diff --git a/dom/interfaces/security/nsIContentSecurityPolicy.idl b/dom/interfaces/security/nsIContentSecurityPolicy.idl new file mode 100644 index 000000000..ade5b1243 --- /dev/null +++ b/dom/interfaces/security/nsIContentSecurityPolicy.idl @@ -0,0 +1,294 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISerializable.idl" +#include "nsIContentPolicy.idl" + +interface nsIURI; +interface nsIChannel; +interface nsIDocShell; +interface nsIDOMDocument; +interface nsIPrincipal; +interface nsIURI; + +/** + * nsIContentSecurityPolicy + * Describes an XPCOM component used to model and enforce CSPs. Instances of + * this class may have multiple policies within them, but there should only be + * one of these per document/principal. + */ + +typedef unsigned short CSPDirective; + +%{C++ +class nsCSPPolicy; +%} + +[ptr] native CSPPolicyPtr(const nsCSPPolicy); + +[scriptable, builtinclass, uuid(b3c4c0ae-bd5e-4cad-87e0-8d210dbb3f9f)] +interface nsIContentSecurityPolicy : nsISerializable +{ + /** + * Directives supported by Content Security Policy. These are enums for + * the CSPDirective type. + * The NO_DIRECTIVE entry is used for checking default permissions and + * returning failure when asking CSP which directive to check. + * + * NOTE: When implementing a new directive, you will need to add it here but also + * add it to the CSPStrDirectives array in nsCSPUtils.h. + */ + const unsigned short NO_DIRECTIVE = 0; + const unsigned short DEFAULT_SRC_DIRECTIVE = 1; + const unsigned short SCRIPT_SRC_DIRECTIVE = 2; + const unsigned short OBJECT_SRC_DIRECTIVE = 3; + const unsigned short STYLE_SRC_DIRECTIVE = 4; + const unsigned short IMG_SRC_DIRECTIVE = 5; + const unsigned short MEDIA_SRC_DIRECTIVE = 6; + const unsigned short FRAME_SRC_DIRECTIVE = 7; + const unsigned short FONT_SRC_DIRECTIVE = 8; + const unsigned short CONNECT_SRC_DIRECTIVE = 9; + const unsigned short REPORT_URI_DIRECTIVE = 10; + const unsigned short FRAME_ANCESTORS_DIRECTIVE = 11; + const unsigned short REFLECTED_XSS_DIRECTIVE = 12; + const unsigned short BASE_URI_DIRECTIVE = 13; + const unsigned short FORM_ACTION_DIRECTIVE = 14; + const unsigned short REFERRER_DIRECTIVE = 15; + const unsigned short WEB_MANIFEST_SRC_DIRECTIVE = 16; + const unsigned short UPGRADE_IF_INSECURE_DIRECTIVE = 17; + const unsigned short CHILD_SRC_DIRECTIVE = 18; + const unsigned short BLOCK_ALL_MIXED_CONTENT = 19; + const unsigned short REQUIRE_SRI_FOR = 20; + const unsigned short SANDBOX_DIRECTIVE = 21; + + /** + * Accessor method for a read-only string version of the policy at a given + * index. + */ + [binaryname(GetPolicyString)] AString getPolicy(in unsigned long index); + + /** + * Accessor method for a read-only pointer the policy object at a given + * index. Returns a null pointer if the index is larger than the current + * policy count. + */ + [noscript,notxpcom,nostdcall] CSPPolicyPtr GetPolicy(in unsigned long index); + + /** + * Returns the number of policies attached to this CSP instance. Useful with + * getPolicy(). + */ + readonly attribute unsigned long policyCount; + + /** + * Returns whether this policy uses the directive upgrade-insecure-requests. + * Please note that upgrade-insecure-reqeusts also applies if the parent or + * including document (context) makes use of the directive. + */ + readonly attribute bool upgradeInsecureRequests; + + /** + * Returns whether this policy uses the directive block-all-mixed-content. + * Please note that block-all-mixed-content takes presedence in case the + * directive upgrade-insecure-requests is defined in the same policy and + * will therefore block all mixed content without even trying to perform + * an upgrade. + */ + readonly attribute bool blockAllMixedContent; + + /** + * Obtains the referrer policy (as integer) for this browsing context as + * specified in CSP. If there are multiple policies and... + * - only one sets a referrer policy: that policy is returned + * - more than one sets different referrer policies: no-referrer is returned + * - more than one set equivalent policies: that policy is returned + * For the enumeration of policies see ReferrerPolicy.h and nsIHttpChannel. + * + * @param aPolicy + * The referrer policy to use for the protected resource. + * @return + * true if a referrer policy is specified, false if it's unspecified. + */ + bool getReferrerPolicy(out unsigned long policy); + + /** + * Parse and install a CSP policy. + * @param aPolicy + * String representation of the policy + * (e.g., header value, meta content) + * @param reportOnly + * Should this policy affect content, script and style processing or + * just send reports if it is violated? + * @param deliveredViaMetaTag + * Indicates whether the policy was delivered via the meta tag. + */ + void appendPolicy(in AString policyString, + in boolean reportOnly, + in boolean deliveredViaMetaTag); + + /* + * Whether this policy allows inline script or style. + * @param aContentPolicyType Either TYPE_SCRIPT or TYPE_STYLESHEET + * @param aNonce The nonce string to check against the policy + * @param aParserCreated If the script element was created by the HTML Parser + * @param aContent The content of the inline resource to hash + * (and compare to the hashes listed in the policy) + * @param aLineNumber The line number of the inline resource + * (used for reporting) + * @return + * Whether or not the effects of the inline style should be allowed + * (block the rules if false). + */ + boolean getAllowsInline(in nsContentPolicyType aContentPolicyType, + in AString aNonce, + in boolean aParserCreated, + in AString aContent, + in unsigned long aLineNumber); + + /** + * whether this policy allows eval and eval-like functions + * such as setTimeout("code string", time). + * @param shouldReportViolations + * Whether or not the use of eval should be reported. + * This function returns "true" when violating report-only policies, but + * when any policy (report-only or otherwise) is violated, + * shouldReportViolations is true as well. + * @return + * Whether or not the effects of the eval call should be allowed + * (block the call if false). + */ + boolean getAllowsEval(out boolean shouldReportViolations); + + /** + * Delegate method called by the service when the protected document is loaded. + * Returns the union of all the sandbox flags contained in CSP policies. This is the most + * restrictive interpretation of flags set in multiple policies. + * See nsSandboxFlags.h for the possible flags. + * + * @return + * sandbox flags or SANDBOXED_NONE if no sandbox directive exists + */ + uint32_t getCSPSandboxFlags(); + + /** + * For each violated policy (of type violationType), log policy violation on + * the Error Console and send a report to report-uris present in the violated + * policies. + * + * @param violationType + * one of the VIOLATION_TYPE_* constants, e.g. inline-script or eval + * @param sourceFile + * name of the source file containing the violation (if available) + * @param contentSample + * sample of the violating content (to aid debugging) + * @param lineNum + * source line number of the violation (if available) + * @param aNonce + * (optional) If this is a nonce violation, include the nonce so we can + * recheck to determine which policies were violated and send the + * appropriate reports. + * @param aContent + * (optional) If this is a hash violation, include contents of the inline + * resource in the question so we can recheck the hash in order to + * determine which policies were violated and send the appropriate + * reports. + */ + void logViolationDetails(in unsigned short violationType, + in AString sourceFile, + in AString scriptSample, + in int32_t lineNum, + [optional] in AString nonce, + [optional] in AString content); + + const unsigned short VIOLATION_TYPE_INLINE_SCRIPT = 1; + const unsigned short VIOLATION_TYPE_EVAL = 2; + const unsigned short VIOLATION_TYPE_INLINE_STYLE = 3; + const unsigned short VIOLATION_TYPE_NONCE_SCRIPT = 4; + const unsigned short VIOLATION_TYPE_NONCE_STYLE = 5; + const unsigned short VIOLATION_TYPE_HASH_SCRIPT = 6; + const unsigned short VIOLATION_TYPE_HASH_STYLE = 7; + const unsigned short VIOLATION_TYPE_REQUIRE_SRI_FOR_STYLE = 8; + const unsigned short VIOLATION_TYPE_REQUIRE_SRI_FOR_SCRIPT = 9; + + /** + * Called after the CSP object is created to fill in appropriate request + * context. Either use + * * aDocument (preferred), or if no document is available, then provide + * * aPrincipal + */ + void setRequestContext(in nsIDOMDocument aDocument, + in nsIPrincipal aPrincipal); + + + /* + * Checks if a CSP requires Subresource Integrity (SRI) + * for a given nsContentPolicyType. + */ + bool requireSRIForType(in nsContentPolicyType aContentType); + + /** + * Verifies ancestry as permitted by the policy. + * + * NOTE: Calls to this may trigger violation reports when queried, so this + * value should not be cached. + * + * @param docShell + * containing the protected resource + * @return + * true if the frame's ancestors are all allowed by policy (except for + * report-only policies, which will send reports and then return true + * here when violated). + */ + boolean permitsAncestry(in nsIDocShell docShell); + + + /** + * Checks if a specific directive permits loading of a URI. + * + * NOTE: Calls to this may trigger violation reports when queried, so the + * return value should not be cached. + * + * @param aURI + * The URI about to be loaded or used. + * @param aDir + * The CSPDirective to query (see above constants *_DIRECTIVE). + * @param aSpecific + * If "true" and the directive is specified to fall back to "default-src" + * when it's not explicitly provided, directivePermits will NOT try + * default-src when the specific directive is not used. Setting this to + * "false" allows CSP to fall back to default-src. This function + * behaves the same for both values of canUseDefault when querying + * directives that don't fall-back. + * @return + * Whether or not the provided URI is allowed by CSP under the given + * directive. (block the pending operation if false). + */ + boolean permits(in nsIURI aURI, in CSPDirective aDir, in boolean aSpecific); + + /** + * Delegate method called by the service when sub-elements of the protected + * document are being loaded. Given a bit of information about the request, + * decides whether or not the policy is satisfied. + * + * Calls to this may trigger violation reports when queried, so + * this value should not be cached. + */ + short shouldLoad(in nsContentPolicyType aContentType, + in nsIURI aContentLocation, + in nsIURI aRequestOrigin, + in nsISupports aContext, + in ACString aMimeTypeGuess, + in nsISupports aExtra); + +%{ C++ +// nsIObserver topic to fire when the policy encounters a violation. +#define CSP_VIOLATION_TOPIC "csp-on-violate-policy" +%} + + /** + * Returns the CSP in JSON notation. + */ + AString toJSON(); + +}; diff --git a/dom/interfaces/settings/moz.build b/dom/interfaces/settings/moz.build new file mode 100644 index 000000000..5360df1c3 --- /dev/null +++ b/dom/interfaces/settings/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsISettingsService.idl', +] + +XPIDL_MODULE = 'dom_settings' + diff --git a/dom/interfaces/settings/nsISettingsService.idl b/dom/interfaces/settings/nsISettingsService.idl new file mode 100644 index 000000000..b74da447f --- /dev/null +++ b/dom/interfaces/settings/nsISettingsService.idl @@ -0,0 +1,37 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(aad47850-2e87-11e2-81c1-0800200c9a66)] +interface nsISettingsServiceCallback : nsISupports +{ + void handle(in DOMString aName, in jsval aResult); + void handleError(in DOMString aErrorMessage); +}; + +[scriptable, uuid(f1b3d820-8e75-11e3-baa8-0800200c9a66)] +interface nsISettingsTransactionCompleteCallback : nsISupports +{ + void handle(); + void handleAbort(in DOMString aErrorMessage); +}; + +[scriptable, uuid(d7a395a0-e292-11e1-834e-1761d57f5f99)] +interface nsISettingsServiceLock : nsISupports +{ + void set(in string aName, + in jsval aValue, + in nsISettingsServiceCallback aCallback, + [optional] in string aMessage); + + void get(in string aName, in nsISettingsServiceCallback aCallback); +}; + +[scriptable, uuid(d1ed155c-9f90-47bb-91c2-7eac54d69f4b)] +interface nsISettingsService : nsISupports +{ + nsISettingsServiceLock createLock([optional] in nsISettingsTransactionCompleteCallback aCallback); + void receiveMessage(in jsval aMessage); +}; diff --git a/dom/interfaces/sidebar/moz.build b/dom/interfaces/sidebar/moz.build new file mode 100644 index 000000000..3df69ac66 --- /dev/null +++ b/dom/interfaces/sidebar/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIWebContentHandlerRegistrar.idl', +] + +XPIDL_MODULE = 'dom_sidebar' + diff --git a/dom/interfaces/sidebar/nsIWebContentHandlerRegistrar.idl b/dom/interfaces/sidebar/nsIWebContentHandlerRegistrar.idl new file mode 100644 index 000000000..4cc571b4e --- /dev/null +++ b/dom/interfaces/sidebar/nsIWebContentHandlerRegistrar.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * nsIWebContentHandlerRegistrar + * + * Applications wishing to use web content handlers need to implement this + * interface. Typically they will prompt the user to confirm adding an entry + * to the local list. + * + * The component must have the contract id defined below so that nsNavigator + * can invoke it. + */ + +[scriptable, uuid(65a3fafd-0e4a-4b06-8b4e-6a611da63d98)] +interface nsIWebContentHandlerRegistrar : nsISupports +{ + /** + * See documentation in Navigator.webidl + * The additional contentWindow param for both methods represents the dom + * content window from which the method has been called. + */ + void registerContentHandler(in DOMString mimeType, + in DOMString uri, + in DOMString title, + in nsISupports windowOrBrowser); + void registerProtocolHandler(in DOMString protocol, + in DOMString uri, + in DOMString title, + in nsISupports windowOrBrowser); +}; + +%{ C++ + +#define NS_WEBCONTENTHANDLERREGISTRAR_CONTRACTID "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1" +%} diff --git a/dom/interfaces/smil/moz.build b/dom/interfaces/smil/moz.build new file mode 100644 index 000000000..45fe588a7 --- /dev/null +++ b/dom/interfaces/smil/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMTimeEvent.idl', +] + +XPIDL_MODULE = 'dom_smil' + diff --git a/dom/interfaces/smil/nsIDOMTimeEvent.idl b/dom/interfaces/smil/nsIDOMTimeEvent.idl new file mode 100644 index 000000000..898886615 --- /dev/null +++ b/dom/interfaces/smil/nsIDOMTimeEvent.idl @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMEvent.idl" + +/** + * The SMIL TimeEvent interface. + * + * For more information please refer to: + * http://www.w3.org/TR/SMIL/smil-timing.html#Events-TimeEvent + * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent + */ + +[builtinclass, uuid(b5e7fbac-f572-426c-9320-0ef7630f03c1)] +interface nsIDOMTimeEvent : nsIDOMEvent +{ + readonly attribute long detail; +}; diff --git a/dom/interfaces/storage/moz.build b/dom/interfaces/storage/moz.build new file mode 100644 index 000000000..433e25e7a --- /dev/null +++ b/dom/interfaces/storage/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMStorage.idl', + 'nsIDOMStorageManager.idl', +] + +XPIDL_MODULE = 'dom_storage' diff --git a/dom/interfaces/storage/nsIDOMStorage.idl b/dom/interfaces/storage/nsIDOMStorage.idl new file mode 100644 index 000000000..c34048f4f --- /dev/null +++ b/dom/interfaces/storage/nsIDOMStorage.idl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * Empty interface for client side storage. DOMStorage is now ported to WebIDL + * but we still need an XPConnect interface for casting. + */ + +[scriptable, uuid(425a33f0-e0e9-45e7-a95f-9908bd6ae988)] +interface nsIDOMStorage : nsISupports +{ +}; diff --git a/dom/interfaces/storage/nsIDOMStorageManager.idl b/dom/interfaces/storage/nsIDOMStorageManager.idl new file mode 100644 index 000000000..1008477c0 --- /dev/null +++ b/dom/interfaces/storage/nsIDOMStorageManager.idl @@ -0,0 +1,105 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMStorage; +interface nsIPrincipal; +interface mozIDOMWindow; + +/** + * General purpose interface that has two implementations, for localStorage + * resp. sessionStorage with "@mozilla.org/dom/localStorage-manager;1" resp. + * "@mozilla.org/dom/sessionStorage-manager;1" contract IDs. + */ +[scriptable, uuid(a20c742e-3ed1-44fb-b897-4080a75b1662)] +interface nsIDOMStorageManager : nsISupports +{ + /** + * This starts async preloading of a storage cache for scope + * defined by the principal. + */ + void precacheStorage(in nsIPrincipal aPrincipal); + + /** + * Returns instance of DOM storage object for given principal. + * A new object is always returned and it is ensured there is + * a storage for the scope created. + * + * @param aWindow + * The parent window. + * @param aPrincipal + * Principal to bound storage to. + * @param aDocumentURI + * URL of the demanding document, used for DOM storage event only. + * @param aPrivate + * Whether the demanding document is running in Private Browsing mode or not. + */ + nsIDOMStorage createStorage(in mozIDOMWindow aWindow, + in nsIPrincipal aPrincipal, + in DOMString aDocumentURI, + [optional] in bool aPrivate); + /** + * Returns instance of DOM storage object for given principal. + * If there is no storage managed for the scope, then null is returned and + * no object is created. Otherwise, an object (new) for the existing storage + * scope is returned. + * + * @param aWindow + * The parent window. + * @param aPrincipal + * Principal to bound storage to. + * @param aPrivate + * Whether the demanding document is running in Private Browsing mode or not. + */ + nsIDOMStorage getStorage(in mozIDOMWindow aWindow, + in nsIPrincipal aPrincipal, + [optional] in bool aPrivate); + + /** + * Clones given storage into this storage manager. + * + * @param aStorageToCloneFrom + * The storage to copy all items from into this manager. Manager will then + * return a new and independent object that contains snapshot of data from + * the moment this method was called. Modification to this new object will + * not affect the original storage content we cloned from and vice versa. + */ + void cloneStorage(in nsIDOMStorage aStorageToCloneFrom); + + /** + * Returns true if the storage belongs to the given principal and is managed + * (i.e. has been created and is cached) by this storage manager. + * + * @param aPrincipal + * Principal to check the storage against. + * @param aStorage + * The storage object to examine. + * + * @result + * true when the storage object is bound with the principal and is managed + * by this storage manager. + * false otherwise + */ + bool checkStorage(in nsIPrincipal aPrincipal, + in nsIDOMStorage aStorage); + + /** + * @deprecated + * + * Returns instance of localStorage object for aURI's origin. + * This method ensures there is always only a single instance + * for a single origin. + * + * Currently just forwards to the createStorage method of this + * interface. + * + * Extension developers are strongly encouraged to use getStorage + * or createStorage method instead. + */ + nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal, + in DOMString aDocumentURI, + [optional] in bool aPrivate); +}; diff --git a/dom/interfaces/stylesheets/moz.build b/dom/interfaces/stylesheets/moz.build new file mode 100644 index 000000000..9037bd24f --- /dev/null +++ b/dom/interfaces/stylesheets/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMMediaList.idl', + 'nsIDOMStyleSheet.idl', + 'nsIDOMStyleSheetList.idl', +] + +XPIDL_MODULE = 'dom_stylesheets' + diff --git a/dom/interfaces/stylesheets/nsIDOMMediaList.idl b/dom/interfaces/stylesheets/nsIDOMMediaList.idl new file mode 100644 index 000000000..2e2290e49 --- /dev/null +++ b/dom/interfaces/stylesheets/nsIDOMMediaList.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMMediaList interface is a datatype for a list of media + * types in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(9b0c2ed7-111c-4824-adf9-ef0da6dad371)] +interface nsIDOMMediaList : nsISupports +{ + attribute DOMString mediaText; + // raises(DOMException) on setting + + readonly attribute unsigned long length; + DOMString item(in unsigned long index); + void deleteMedium(in DOMString oldMedium) + raises(DOMException); + void appendMedium(in DOMString newMedium) + raises(DOMException); +}; diff --git a/dom/interfaces/stylesheets/nsIDOMStyleSheet.idl b/dom/interfaces/stylesheets/nsIDOMStyleSheet.idl new file mode 100644 index 000000000..e2aafa8e7 --- /dev/null +++ b/dom/interfaces/stylesheets/nsIDOMStyleSheet.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMStyleSheet interface is a datatype for a style sheet in + * the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(a6cf9080-15b3-11d2-932e-00805f8add32)] +interface nsIDOMStyleSheet : nsISupports +{ + readonly attribute DOMString type; + attribute boolean disabled; + readonly attribute nsIDOMNode ownerNode; + readonly attribute nsIDOMStyleSheet parentStyleSheet; + readonly attribute DOMString href; + readonly attribute DOMString title; + readonly attribute nsIDOMMediaList media; +}; diff --git a/dom/interfaces/stylesheets/nsIDOMStyleSheetList.idl b/dom/interfaces/stylesheets/nsIDOMStyleSheetList.idl new file mode 100644 index 000000000..1adbb915d --- /dev/null +++ b/dom/interfaces/stylesheets/nsIDOMStyleSheetList.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +/** + * The nsIDOMStyleSheetList interface is a datatype for a style sheet + * list in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Style + */ + +[uuid(0e424250-ac2a-4fe2-bccd-a45824af090e)] +interface nsIDOMStyleSheetList : nsISupports +{ + readonly attribute unsigned long length; + [binaryname(SlowItem)] + nsIDOMStyleSheet item(in unsigned long index); +}; diff --git a/dom/interfaces/svg/moz.build b/dom/interfaces/svg/moz.build new file mode 100644 index 000000000..b682abb53 --- /dev/null +++ b/dom/interfaces/svg/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMSVGElement.idl', + 'nsIDOMSVGLength.idl', +] + +XPIDL_MODULE = 'dom_svg' + diff --git a/dom/interfaces/svg/nsIDOMSVGElement.idl b/dom/interfaces/svg/nsIDOMSVGElement.idl new file mode 100644 index 000000000..59c16d1ff --- /dev/null +++ b/dom/interfaces/svg/nsIDOMSVGElement.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" + +interface nsIDOMCSSStyleDeclaration; +interface nsIDOMCSSValue; + + +[uuid(c63517c5-8bab-4cd1-8694-bccafc32a195)] +interface nsIDOMSVGElement : nsIDOMElement +{ + // raises DOMException on setting + readonly attribute nsIDOMSVGElement ownerSVGElement; + readonly attribute nsIDOMSVGElement viewportElement; + + [binaryname(SVGClassName)] + readonly attribute nsISupports className; + readonly attribute nsIDOMCSSStyleDeclaration style; +}; diff --git a/dom/interfaces/svg/nsIDOMSVGLength.idl b/dom/interfaces/svg/nsIDOMSVGLength.idl new file mode 100644 index 000000000..a22ebb264 --- /dev/null +++ b/dom/interfaces/svg/nsIDOMSVGLength.idl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(2596325c-aed0-487e-96a1-0a6d589b9c6b)] +interface nsIDOMSVGLength : nsISupports +{ + // Length Unit Types + const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0; + const unsigned short SVG_LENGTHTYPE_NUMBER = 1; + const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2; + const unsigned short SVG_LENGTHTYPE_EMS = 3; + const unsigned short SVG_LENGTHTYPE_EXS = 4; + const unsigned short SVG_LENGTHTYPE_PX = 5; + const unsigned short SVG_LENGTHTYPE_CM = 6; + const unsigned short SVG_LENGTHTYPE_MM = 7; + const unsigned short SVG_LENGTHTYPE_IN = 8; + const unsigned short SVG_LENGTHTYPE_PT = 9; + const unsigned short SVG_LENGTHTYPE_PC = 10; + + readonly attribute unsigned short unitType; + attribute float value; + // raises DOMException on setting + attribute float valueInSpecifiedUnits; + // raises DOMException on setting + attribute DOMString valueAsString; + // raises DOMException on setting + + void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits); + void convertToSpecifiedUnits(in unsigned short unitType); +}; + + + + diff --git a/dom/interfaces/traversal/moz.build b/dom/interfaces/traversal/moz.build new file mode 100644 index 000000000..ba7b5c9fe --- /dev/null +++ b/dom/interfaces/traversal/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMNodeFilter.idl', + 'nsIDOMNodeIterator.idl', + 'nsIDOMTreeWalker.idl', +] + +XPIDL_MODULE = 'dom_traversal' + diff --git a/dom/interfaces/traversal/nsIDOMNodeFilter.idl b/dom/interfaces/traversal/nsIDOMNodeFilter.idl new file mode 100644 index 000000000..934d60954 --- /dev/null +++ b/dom/interfaces/traversal/nsIDOMNodeFilter.idl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, function, uuid(e4723748-1dd1-11b2-8ee6-866a532a6237)] +// Introduced in DOM Level 2: +interface nsIDOMNodeFilter : nsISupports +{ + // Constants returned by acceptNode + const short FILTER_ACCEPT = 1; + const short FILTER_REJECT = 2; + const short FILTER_SKIP = 3; + + + // Constants for whatToShow + const unsigned long SHOW_ALL = 0xFFFFFFFF; + const unsigned long SHOW_ELEMENT = 0x00000001; + const unsigned long SHOW_ATTRIBUTE = 0x00000002; + const unsigned long SHOW_TEXT = 0x00000004; + const unsigned long SHOW_CDATA_SECTION = 0x00000008; + const unsigned long SHOW_ENTITY_REFERENCE = 0x00000010; + const unsigned long SHOW_ENTITY = 0x00000020; + const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x00000040; + const unsigned long SHOW_COMMENT = 0x00000080; + const unsigned long SHOW_DOCUMENT = 0x00000100; + const unsigned long SHOW_DOCUMENT_TYPE = 0x00000200; + const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x00000400; + const unsigned long SHOW_NOTATION = 0x00000800; + + short acceptNode(in nsIDOMNode n); +}; diff --git a/dom/interfaces/traversal/nsIDOMNodeIterator.idl b/dom/interfaces/traversal/nsIDOMNodeIterator.idl new file mode 100644 index 000000000..da3984bab --- /dev/null +++ b/dom/interfaces/traversal/nsIDOMNodeIterator.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMNodeFilter; + +[uuid(a86bdac9-ff89-4c94-8160-4fe86733bab8)] +// Introduced in DOM Level 2, updated to DOM Level 4: +interface nsIDOMNodeIterator : nsISupports +{ + readonly attribute nsIDOMNode root; + readonly attribute unsigned long whatToShow; + readonly attribute nsIDOMNodeFilter filter; + nsIDOMNode nextNode() + raises(DOMException); + nsIDOMNode previousNode() + raises(DOMException); + void detach(); + + // WebKit extensions, convenient for debugging. + readonly attribute nsIDOMNode referenceNode; + readonly attribute boolean pointerBeforeReferenceNode; +}; diff --git a/dom/interfaces/traversal/nsIDOMTreeWalker.idl b/dom/interfaces/traversal/nsIDOMTreeWalker.idl new file mode 100644 index 000000000..d96449803 --- /dev/null +++ b/dom/interfaces/traversal/nsIDOMTreeWalker.idl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMNodeFilter; + +[uuid(c4ffa159-237c-4dde-b0ba-20b9f9270cf6)] +// Introduced in DOM Level 2: +interface nsIDOMTreeWalker : nsISupports { + readonly attribute nsIDOMNode root; + readonly attribute unsigned long whatToShow; + readonly attribute nsIDOMNodeFilter filter; + attribute nsIDOMNode currentNode; + // raises(DOMException) on setting + + nsIDOMNode parentNode(); + nsIDOMNode firstChild(); + nsIDOMNode lastChild(); + nsIDOMNode previousSibling(); + nsIDOMNode nextSibling(); + nsIDOMNode previousNode(); + nsIDOMNode nextNode(); +}; diff --git a/dom/interfaces/xbl/moz.build b/dom/interfaces/xbl/moz.build new file mode 100644 index 000000000..a4f3f6ea8 --- /dev/null +++ b/dom/interfaces/xbl/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMDocumentXBL.idl', +] + +XPIDL_MODULE = 'dom_xbl' + diff --git a/dom/interfaces/xbl/nsIDOMDocumentXBL.idl b/dom/interfaces/xbl/nsIDOMDocumentXBL.idl new file mode 100644 index 000000000..0ae7154d2 --- /dev/null +++ b/dom/interfaces/xbl/nsIDOMDocumentXBL.idl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[uuid(af628000-e3fa-40d2-9118-fbaa9f3ec6b9)] +interface nsIDOMDocumentXBL : nsISupports +{ + /** + * See the MDC documentation for what these methods do. + */ + nsIDOMNodeList getAnonymousNodes(in nsIDOMElement elt); + nsIDOMElement getAnonymousElementByAttribute(in nsIDOMElement elt, + in DOMString attrName, + in DOMString attrValue); + + nsIDOMElement getBindingParent(in nsIDOMNode node); + void loadBindingDocument(in DOMString documentURL); +}; diff --git a/dom/interfaces/xpath/moz.build b/dom/interfaces/xpath/moz.build new file mode 100644 index 000000000..06515bd70 --- /dev/null +++ b/dom/interfaces/xpath/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMXPathEvaluator.idl', + 'nsIDOMXPathResult.idl', +] + +XPIDL_MODULE = 'dom_xpath' + diff --git a/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl b/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl new file mode 100644 index 000000000..9a07b40af --- /dev/null +++ b/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "domstubs.idl" + +interface XPathException; + +[uuid(92584002-d0e2-4b88-9af9-fa6ff59ee002)] +interface nsIDOMXPathEvaluator : nsISupports +{ + nsISupports evaluate(in DOMString expression, + in nsIDOMNode contextNode, + in nsIDOMNode resolver, + in unsigned short type, + in nsISupports result) + raises(XPathException, + DOMException); +}; diff --git a/dom/interfaces/xpath/nsIDOMXPathResult.idl b/dom/interfaces/xpath/nsIDOMXPathResult.idl new file mode 100644 index 000000000..8101907ac --- /dev/null +++ b/dom/interfaces/xpath/nsIDOMXPathResult.idl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +#include "nsISupports.idl" + +[uuid(75506f84-b504-11d5-a7f2-ca108ab8b6fc)] +interface nsIDOMXPathResult : nsISupports +{ + // XPathResultType + const unsigned short ANY_TYPE = 0; + const unsigned short NUMBER_TYPE = 1; + const unsigned short STRING_TYPE = 2; + const unsigned short BOOLEAN_TYPE = 3; + const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4; + const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5; + const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6; + const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7; + const unsigned short ANY_UNORDERED_NODE_TYPE = 8; + const unsigned short FIRST_ORDERED_NODE_TYPE = 9; +}; diff --git a/dom/interfaces/xul/moz.build b/dom/interfaces/xul/moz.build new file mode 100644 index 000000000..50bd1d511 --- /dev/null +++ b/dom/interfaces/xul/moz.build @@ -0,0 +1,31 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIDOMXULButtonElement.idl', + 'nsIDOMXULCheckboxElement.idl', + 'nsIDOMXULCommandDispatcher.idl', + 'nsIDOMXULCommandEvent.idl', + 'nsIDOMXULContainerElement.idl', + 'nsIDOMXULControlElement.idl', + 'nsIDOMXULDescriptionElement.idl', + 'nsIDOMXULDocument.idl', + 'nsIDOMXULElement.idl', + 'nsIDOMXULImageElement.idl', + 'nsIDOMXULLabeledControlEl.idl', + 'nsIDOMXULLabelElement.idl', + 'nsIDOMXULMenuListElement.idl', + 'nsIDOMXULMultSelectCntrlEl.idl', + 'nsIDOMXULPopupElement.idl', + 'nsIDOMXULRelatedElement.idl', + 'nsIDOMXULSelectCntrlEl.idl', + 'nsIDOMXULSelectCntrlItemEl.idl', + 'nsIDOMXULTextboxElement.idl', + 'nsIDOMXULTreeElement.idl', +] + +XPIDL_MODULE = 'dom_xul' + diff --git a/dom/interfaces/xul/nsIDOMXULButtonElement.idl b/dom/interfaces/xul/nsIDOMXULButtonElement.idl new file mode 100644 index 000000000..6549f0034 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULButtonElement.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULLabeledControlEl.idl" + +[scriptable, uuid(d56f1f8f-fc4e-4650-9a85-25108bbd1980)] +interface nsIDOMXULButtonElement : nsIDOMXULLabeledControlElement { + const short CHECKSTATE_UNCHECKED = 0; + const short CHECKSTATE_CHECKED = 1; + const short CHECKSTATE_MIXED = 2; + + attribute DOMString type; + attribute DOMString dlgType; + + // For buttons of type="menu" only. + attribute boolean open; + + // For buttons of type="checkbox" only. + attribute boolean checked; + attribute long checkState; + attribute boolean autoCheck; + + // For buttons of type="radio" only. + attribute DOMString group; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl b/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl new file mode 100644 index 000000000..81c0ece92 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIDOMXULLabeledControlEl.idl" + +[scriptable, uuid(745518ad-3163-41f0-b358-c81fb5a587bc)] +interface nsIDOMXULCheckboxElement : nsIDOMXULLabeledControlElement { + const short CHECKSTATE_UNCHECKED = 0; + const short CHECKSTATE_CHECKED = 1; + const short CHECKSTATE_MIXED = 2; + + attribute boolean checked; + attribute long checkState; + attribute boolean autoCheck; +}; diff --git a/dom/interfaces/xul/nsIDOMXULCommandDispatcher.idl b/dom/interfaces/xul/nsIDOMXULCommandDispatcher.idl new file mode 100644 index 000000000..995feaf22 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULCommandDispatcher.idl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMElement; +interface nsIController; +interface nsIControllers; +interface mozIDOMWindowProxy; + + +[scriptable, uuid(a9fa9fd3-8d62-4f94-9ed8-3ea9c3cf0773)] +interface nsIDOMXULCommandDispatcher : nsISupports +{ + attribute nsIDOMElement focusedElement; + attribute mozIDOMWindowProxy focusedWindow; + + void addCommandUpdater(in nsIDOMElement updater, + in DOMString events, + in DOMString targets); + void removeCommandUpdater(in nsIDOMElement updater); + + void updateCommands(in DOMString eventName); + + nsIController getControllerForCommand(in string command); + nsIControllers getControllers(); + + void advanceFocus(); + void rewindFocus(); + void advanceFocusIntoSubtree(in nsIDOMElement elt); + attribute boolean suppressFocusScroll; +}; diff --git a/dom/interfaces/xul/nsIDOMXULCommandEvent.idl b/dom/interfaces/xul/nsIDOMXULCommandEvent.idl new file mode 100644 index 000000000..c32a9e47d --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULCommandEvent.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This interface is supported by command events, which are dispatched to + * XUL elements as a result of mouse or keyboard activation. + */ + +#include "nsIDOMUIEvent.idl" + +[builtinclass, uuid(564496b4-1174-48ec-927d-edeb66b86757)] +interface nsIDOMXULCommandEvent : nsIDOMUIEvent +{ + /** + * Command events support the same set of modifier keys as mouse and key + * events. + */ + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + + /** + * If the command event was redispatched because of a command= attribute + * on the original target, sourceEvent will be set to the original DOM Event. + * Otherwise, sourceEvent is null. + */ + readonly attribute nsIDOMEvent sourceEvent; + + /** + * Creates a new command event with the given attributes. + */ + void initCommandEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in mozIDOMWindow viewArg, + in long detailArg, + in boolean ctrlKeyArg, + in boolean altKeyArg, + in boolean shiftKeyArg, + in boolean metaKeyArg, + in nsIDOMEvent sourceEvent); +}; diff --git a/dom/interfaces/xul/nsIDOMXULContainerElement.idl b/dom/interfaces/xul/nsIDOMXULContainerElement.idl new file mode 100644 index 000000000..a60e6967e --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULContainerElement.idl @@ -0,0 +1,68 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULElement.idl" +interface nsIDOMXULContainerElement; + +[scriptable, uuid(800a68c7-b854-4597-a436-3055ce5c5c96)] +interface nsIDOMXULContainerItemElement : nsISupports +{ + /** + * Returns the parent container if any. + */ + readonly attribute nsIDOMXULContainerElement parentContainer; +}; + +[scriptable, uuid(b2bc96b8-31fc-42f4-937a-bd27291af40b)] +interface nsIDOMXULContainerElement : nsIDOMXULContainerItemElement +{ + /** + * Creates an item for the given label and value and appends it to the + * container. + * + * @param aLabel - the label for the new item + * @param aValue - the value of the new item + */ + nsIDOMXULElement appendItem(in DOMString aLabel, in DOMString aValue); + + /** + * Creates an item for the given label and value and inserts it into the + * container at the specified position. + * + * @param aIndex - the index where the new item will be inserted + * @param aLabel - the label for the new item + * @param aValue - the value of the new item + */ + nsIDOMXULElement insertItemAt(in long aIndex, in DOMString aLabel, + in DOMString aValue); + + /** + * Removes an item from the container. + * + * @param aIndex - index of the item to remove + */ + nsIDOMXULElement removeItemAt(in long aIndex); + + /** + * Returns a count of items in the container. + */ + readonly attribute unsigned long itemCount; + + /** + * Returns the index of an item or -1 if the item is not in the container. + * + * @param aItem - the item to determine the index of + */ + long getIndexOfItem(in nsIDOMXULElement aItem); + + /** + * Returns the item at a given index or null if the item is not is the + * container. + * + * @param aIndex - the index of the item to return + */ + nsIDOMXULElement getItemAtIndex(in long aIndex); +}; + diff --git a/dom/interfaces/xul/nsIDOMXULControlElement.idl b/dom/interfaces/xul/nsIDOMXULControlElement.idl new file mode 100644 index 000000000..2c88ce9a2 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULControlElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIDOMXULElement.idl" + +interface nsIControllers; + +[scriptable, uuid(ea7f92d0-b379-4107-91b4-1e69bdd771e3)] +interface nsIDOMXULControlElement : nsISupports { + attribute boolean disabled; + attribute long tabIndex; + +// XXX defined in XULElement, but should be defined here +// readonly attribute nsIControllers controllers; + +// void focus(); +// void blur(); +}; + + diff --git a/dom/interfaces/xul/nsIDOMXULDescriptionElement.idl b/dom/interfaces/xul/nsIDOMXULDescriptionElement.idl new file mode 100644 index 000000000..5e772568c --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULDescriptionElement.idl @@ -0,0 +1,15 @@ + +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULElement.idl" + +[scriptable, uuid(64c3500e-e258-4d49-b7ca-c93ab0931ce4)] +interface nsIDOMXULDescriptionElement : nsISupports { + attribute boolean disabled; + attribute boolean crop; + attribute DOMString value; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULDocument.idl b/dom/interfaces/xul/nsIDOMXULDocument.idl new file mode 100644 index 000000000..42473226f --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULDocument.idl @@ -0,0 +1,71 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" +#include "nsIDOMDocument.idl" + +interface nsIDOMXULCommandDispatcher; +interface nsIObserver; +interface nsIBoxObject; + +[uuid(7790d4c3-e8f0-4e29-9887-d683ed2b2a44)] +interface nsIDOMXULDocument : nsIDOMDocument +{ + attribute nsIDOMNode popupNode; + + /** + * These attributes correspond to trustedGetPopupNode().rangeOffset and + * rangeParent. They will help you find where in the DOM the popup is + * happening. Can be accessed from chrome only, and only during a popup + * event. Accessing any other time will be an error. + */ + readonly attribute nsIDOMNode popupRangeParent; + readonly attribute long popupRangeOffset; + + attribute nsIDOMNode tooltipNode; + + readonly attribute nsIDOMXULCommandDispatcher commandDispatcher; + + readonly attribute long width; + readonly attribute long height; + + nsIDOMNodeList getElementsByAttribute(in DOMString name, + in DOMString value); + + nsIDOMNodeList getElementsByAttributeNS(in DOMString namespaceURI, + in DOMString name, + in DOMString value); + + void addBroadcastListenerFor(in nsIDOMElement broadcaster, + in nsIDOMElement observer, + in DOMString attr); + + void removeBroadcastListenerFor(in nsIDOMElement broadcaster, + in nsIDOMElement observer, + in DOMString attr); + + void persist(in DOMString id, in DOMString attr); + + nsIBoxObject getBoxObjectFor(in nsIDOMElement elt); + + /** + * Loads a XUL overlay and merges it with the current document, notifying an + * observer when the merge is complete. + * @param url + * The URL of the overlay to load and merge + * @param observer + * An object implementing nsIObserver that will be notified with a + * message of topic "xul-overlay-merged" when the merge is complete. + * The subject parameter of |observe| will QI to a nsIURI - the URI + * of the merged overlay. This parameter is optional and may be null. + * + * NOTICE: In the 2.0 timeframe this API will change such that the + * implementation will fire a DOMXULOverlayMerged event upon merge + * completion rather than notifying an observer. Do not rely on this + * API's behavior _not_ to change because it will! + * - Ben Goodger (8/23/2005) + */ + void loadOverlay(in DOMString url, in nsIObserver aObserver); +}; diff --git a/dom/interfaces/xul/nsIDOMXULElement.idl b/dom/interfaces/xul/nsIDOMXULElement.idl new file mode 100644 index 000000000..c28a3974a --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULElement.idl @@ -0,0 +1,83 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" + +interface nsIRDFCompositeDataSource; +interface nsIXULTemplateBuilder; +interface nsIRDFResource; +interface nsIControllers; +interface nsIBoxObject; + + +[uuid(75435ab3-6863-42a1-ade3-025393d9e80e)] +interface nsIDOMXULElement : nsIDOMElement +{ + // Layout properties + attribute DOMString align; + attribute DOMString dir; + attribute DOMString flex; + attribute DOMString flexGroup; + attribute DOMString ordinal; + attribute DOMString orient; + attribute DOMString pack; + + // Properties for hiding elements. + attribute boolean hidden; + attribute boolean collapsed; + + // Property for hooking up to broadcasters + attribute DOMString observes; + + // Properties for hooking up to popups + attribute DOMString menu; + attribute DOMString contextMenu; + attribute DOMString tooltip; + + // Width/height properties + attribute DOMString width; + attribute DOMString height; + attribute DOMString minWidth; + attribute DOMString minHeight; + attribute DOMString maxWidth; + attribute DOMString maxHeight; + + // Persistence + attribute DOMString persist; + + // Position properties for + // * popups - these are screen coordinates + // * other elements - these are client coordinates relative to parent stack. + attribute DOMString left; + attribute DOMString top; + + // XUL Template Builder + attribute DOMString datasources; + attribute DOMString ref; + + // Tooltip and status info + attribute DOMString tooltipText; + attribute DOMString statusText; + + attribute boolean allowEvents; + + readonly attribute nsIRDFCompositeDataSource database; + readonly attribute nsIXULTemplateBuilder builder; + readonly attribute nsIRDFResource resource; + readonly attribute nsIControllers controllers; + readonly attribute nsIBoxObject boxObject; + + void focus(); + void blur(); + void click(); + void doCommand(); + + nsIDOMNodeList getElementsByAttribute(in DOMString name, + in DOMString value); + + nsIDOMNodeList getElementsByAttributeNS(in DOMString namespaceURI, + in DOMString name, + in DOMString value); +}; diff --git a/dom/interfaces/xul/nsIDOMXULImageElement.idl b/dom/interfaces/xul/nsIDOMXULImageElement.idl new file mode 100644 index 000000000..307d6b8af --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULImageElement.idl @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIDOMXULElement.idl" + +[scriptable, uuid(0a391077-c509-49d2-af73-72e2114edd65)] +interface nsIDOMXULImageElement : nsISupports { + attribute DOMString src; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULLabelElement.idl b/dom/interfaces/xul/nsIDOMXULLabelElement.idl new file mode 100644 index 000000000..8418386a7 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULLabelElement.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULDescriptionElement.idl" + +[scriptable, uuid(8b67286b-bf86-4808-8a68-ecdbc7d9877b)] +interface nsIDOMXULLabelElement : nsIDOMXULDescriptionElement { + attribute DOMString accessKey; + attribute DOMString control; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULLabeledControlEl.idl b/dom/interfaces/xul/nsIDOMXULLabeledControlEl.idl new file mode 100644 index 000000000..619bca88e --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULLabeledControlEl.idl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIDOMXULControlElement.idl" + +[scriptable, uuid(c58a159f-e27d-40c8-865a-d4dcfd928f62)] +interface nsIDOMXULLabeledControlElement : nsIDOMXULControlElement { + attribute DOMString crop; + attribute DOMString image; + attribute DOMString label; + attribute DOMString accessKey; + attribute DOMString command; + +// void doCommand(); +}; + diff --git a/dom/interfaces/xul/nsIDOMXULMenuListElement.idl b/dom/interfaces/xul/nsIDOMXULMenuListElement.idl new file mode 100644 index 000000000..8e87bc6ab --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULMenuListElement.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULSelectCntrlEl.idl" +interface nsIDOMXULTextBoxElement; + +[scriptable, uuid(36c16a17-c0e9-4b35-951b-81a147314ef1)] +interface nsIDOMXULMenuListElement : nsIDOMXULSelectControlElement { + attribute boolean editable; + attribute boolean open; + + // label of selected option or value of textfield for editable menu lists + readonly attribute DOMString label; + + attribute DOMString crop; + attribute DOMString image; + + // For editable menu lists only. + readonly attribute nsIDOMNode inputField; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl b/dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl new file mode 100644 index 000000000..26a45df28 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULSelectCntrlEl.idl" + +[scriptable, uuid(40654a10-8204-4f06-9f21-7baa31c7b1dd)] +interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement +{ + attribute DOMString selType; + + attribute nsIDOMXULSelectControlItemElement currentItem; + attribute long currentIndex; + + readonly attribute nsIDOMNodeList selectedItems; + + void addItemToSelection(in nsIDOMXULSelectControlItemElement item); + void removeItemFromSelection(in nsIDOMXULSelectControlItemElement item); + void toggleItemSelection(in nsIDOMXULSelectControlItemElement item); + + void selectItem(in nsIDOMXULSelectControlItemElement item); + void selectItemRange(in nsIDOMXULSelectControlItemElement startItem, in nsIDOMXULSelectControlItemElement item); + + void selectAll(); + void invertSelection(); + void clearSelection(); + + // XXX - temporary, pending implementation of scriptable, + // mutable nsIDOMNodeList for selectedItems + readonly attribute long selectedCount; + [binaryname(MultiGetSelectedItem)] + nsIDOMXULSelectControlItemElement getSelectedItem(in long index); +}; diff --git a/dom/interfaces/xul/nsIDOMXULPopupElement.idl b/dom/interfaces/xul/nsIDOMXULPopupElement.idl new file mode 100644 index 000000000..59775174f --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULPopupElement.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMElement.idl" +#include "nsIDOMXULElement.idl" + +[scriptable, uuid(cb7eaa79-45d5-4ea3-ae17-b65fdcfe5e30)] +interface nsIDOMXULPopupElement : nsISupports { + const unsigned short BEFORE_START = 1; + const unsigned short BEFORE_END = 2; + const unsigned short AFTER_START = 3; + const unsigned short AFTER_END = 4; + const unsigned short START_BEFORE = 5; + const unsigned short START_AFTER = 6; + const unsigned short END_BEFORE = 7; + const unsigned short END_AFTER = 8; + const unsigned short OVERLAP = 9; + const unsigned short AT_POINTER = 10; + const unsigned short AFTER_POINTER = 11; + + attribute DOMString position; + + void showPopup(in unsigned short alignment, + in nsIDOMElement target, + in nsIDOMElement anchor); + void hidePopup(); +}; + diff --git a/dom/interfaces/xul/nsIDOMXULRelatedElement.idl b/dom/interfaces/xul/nsIDOMXULRelatedElement.idl new file mode 100644 index 000000000..33bc3d3c7 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULRelatedElement.idl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +[scriptable, uuid(9fbac05a-fb27-470d-8e5f-028b2dc54ad0)] +interface nsIDOMXULRelatedElement : nsISupports +{ + /** + * Retrun an element associated with the given element. It's implemented + * by container elements having relation between their items. For example, + * this interface is implemented by XUL tabs and XUL tabpanels elements + * and used to get XUL tab element by linked tab panel and vice versa. + */ + nsIDOMNode getRelatedElement(in nsIDOMNode aElement); +}; diff --git a/dom/interfaces/xul/nsIDOMXULSelectCntrlEl.idl b/dom/interfaces/xul/nsIDOMXULSelectCntrlEl.idl new file mode 100644 index 000000000..412638272 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULSelectCntrlEl.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULControlElement.idl" +interface nsIDOMXULSelectControlItemElement; + +[scriptable, uuid(9bf188a7-d6f9-431b-b5c7-118013998e8b)] +interface nsIDOMXULSelectControlElement : nsIDOMXULControlElement { + attribute nsIDOMXULSelectControlItemElement selectedItem; + attribute long selectedIndex; + + attribute DOMString value; + + nsIDOMXULSelectControlItemElement appendItem(in DOMString label, in DOMString value); + nsIDOMXULSelectControlItemElement insertItemAt(in long index, in DOMString label, in DOMString value); + nsIDOMXULSelectControlItemElement removeItemAt(in long index); + + readonly attribute unsigned long itemCount; + long getIndexOfItem(in nsIDOMXULSelectControlItemElement item); + nsIDOMXULSelectControlItemElement getItemAtIndex(in long index); +}; + diff --git a/dom/interfaces/xul/nsIDOMXULSelectCntrlItemEl.idl b/dom/interfaces/xul/nsIDOMXULSelectCntrlItemEl.idl new file mode 100644 index 000000000..590f8cab8 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULSelectCntrlItemEl.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULElement.idl" +interface nsIDOMXULSelectControlElement; + +[scriptable, uuid(5c6be58f-17df-4750-88a5-4a59ac28adc9)] +interface nsIDOMXULSelectControlItemElement : nsISupports { + attribute boolean disabled; + attribute DOMString crop; + attribute DOMString image; + attribute DOMString label; + attribute DOMString accessKey; + attribute DOMString command; + + attribute DOMString value; + + readonly attribute boolean selected; + + readonly attribute nsIDOMXULSelectControlElement control; + + // XXX defined in XULElement, but should be defined here + // void doCommand(); +}; + + diff --git a/dom/interfaces/xul/nsIDOMXULTextboxElement.idl b/dom/interfaces/xul/nsIDOMXULTextboxElement.idl new file mode 100644 index 000000000..8a2aab1e8 --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULTextboxElement.idl @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULLabeledControlEl.idl" +interface nsIDOMHTMLInputElement; + +[scriptable, uuid(7edd8215-5155-4845-a02f-dc2c08645cb9)] +interface nsIDOMXULTextBoxElement : nsIDOMXULControlElement +{ + // inputField may be any type of editable field, such as an + // HTML <input type="text"> or <textarea> + readonly attribute nsIDOMNode inputField; + + readonly attribute long textLength; + attribute long maxLength; + attribute long size; + attribute long selectionStart; + attribute long selectionEnd; + + attribute DOMString value; + attribute DOMString type; + + void select(); + void setSelectionRange(in long selectionStart, + in long selectionEnd); +}; + diff --git a/dom/interfaces/xul/nsIDOMXULTreeElement.idl b/dom/interfaces/xul/nsIDOMXULTreeElement.idl new file mode 100644 index 000000000..a45bafdcf --- /dev/null +++ b/dom/interfaces/xul/nsIDOMXULTreeElement.idl @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMXULElement.idl" +#include "nsIDOMElement.idl" + +interface nsITreeColumns; +interface nsITreeView; +interface nsIDOMXULTextBoxElement; + +/** + * @status UNDER_DEVELOPMENT + */ + +[scriptable, uuid(013b62af-1e2f-4b07-9091-d7c0fc4687e2)] +interface nsIDOMXULTreeElement : nsISupports +{ + + readonly attribute nsITreeColumns columns; + + attribute nsITreeView view; + + readonly attribute nsIDOMElement body; + + attribute boolean editable; + + // For editable trees only. + readonly attribute nsIDOMXULTextBoxElement inputField; + +}; |