michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIArray; michael@0: interface nsISupportsArray; michael@0: interface nsIDOMCharacterData; michael@0: interface nsIDOMElement; michael@0: interface nsIDOMDocument; michael@0: interface nsIDOMCSSStyleRule; michael@0: interface nsIDOMNode; michael@0: interface nsIDOMNodeList; michael@0: interface nsIDOMFontFaceList; michael@0: interface nsIDOMRange; michael@0: interface nsIDOMCSSStyleSheet; michael@0: michael@0: [scriptable, uuid(ceae6c68-f5d4-4597-a3d9-ca5646c25f1a)] michael@0: interface inIDOMUtils : nsISupports michael@0: { michael@0: // CSS utilities michael@0: void getAllStyleSheets (in nsIDOMDocument aDoc, michael@0: [optional] out unsigned long aLength, michael@0: [array, size_is (aLength), retval] out nsISupports aSheets); michael@0: nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo); michael@0: unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule); michael@0: unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule); michael@0: michael@0: // Utilities for working with selectors. We don't have a JS OM representation michael@0: // of a single selector or a selector list yet, but given a rule we can index michael@0: // into the selector list. michael@0: // michael@0: // This is a somewhat backwards API; once we move StyleRule to WebIDL we michael@0: // should consider using [ChromeOnly] APIs on that. michael@0: unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule); michael@0: // For all three functions below, aSelectorIndex is 0-based michael@0: AString getSelectorText(in nsIDOMCSSStyleRule aRule, michael@0: in unsigned long aSelectorIndex); michael@0: unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule, michael@0: in unsigned long aSelectorIndex); michael@0: // Note: This does not handle scoped selectors correctly, because it has no michael@0: // idea what the right scope is. michael@0: bool selectorMatchesElement(in nsIDOMElement aElement, michael@0: in nsIDOMCSSStyleRule aRule, michael@0: in unsigned long aSelectorIndex); michael@0: michael@0: // Utilities for working with CSS properties michael@0: // michael@0: // Returns true if the string names a property that is inherited by default. michael@0: bool isInheritedProperty(in AString aPropertyName); michael@0: michael@0: // Get a list of all our supported property names. Optionally michael@0: // shorthands can be excluded or property aliases included. michael@0: const unsigned long EXCLUDE_SHORTHANDS = (1<<0); michael@0: const unsigned long INCLUDE_ALIASES = (1<<1); michael@0: void getCSSPropertyNames([optional] in unsigned long aFlags, michael@0: [optional] out unsigned long aCount, michael@0: [retval, array, size_is(aCount)] out wstring aProps); michael@0: michael@0: // Get a list of all valid keywords and colors for aProperty. michael@0: void getCSSValuesForProperty(in AString aProperty, michael@0: [optional] out unsigned long aLength, michael@0: [array, size_is(aLength), retval] out wstring aValues); michael@0: michael@0: // Utilities for working with CSS colors michael@0: [implicit_jscontext] michael@0: jsval colorNameToRGB(in DOMString aColorName); michael@0: AString rgbToColorName(in octet aR, in octet aG, in octet aB); michael@0: michael@0: // DOM Node utilities michael@0: boolean isIgnorableWhitespace(in nsIDOMCharacterData aDataNode); michael@0: // Returns the "parent" of a node. The parent of a document node is the michael@0: // frame/iframe containing that document. aShowingAnonymousContent says michael@0: // whether we are showing anonymous content. michael@0: nsIDOMNode getParentForNode(in nsIDOMNode aNode, michael@0: in boolean aShowingAnonymousContent); michael@0: nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode, michael@0: in boolean aShowingAnonymousContent); michael@0: michael@0: // XBL utilities michael@0: nsIArray getBindingURLs(in nsIDOMElement aElement); michael@0: michael@0: // content state utilities michael@0: unsigned long long getContentState(in nsIDOMElement aElement); michael@0: void setContentState(in nsIDOMElement aElement, in unsigned long long aState); michael@0: michael@0: nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange); michael@0: michael@0: // pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class michael@0: // selector string, e.g. ":hover". ":-moz-any-link" and non-event-state michael@0: // pseudo-classes are ignored. michael@0: void addPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); michael@0: void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); michael@0: bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); michael@0: void clearPseudoClassLocks(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * Parse CSS and update the style sheet in place. michael@0: * michael@0: * @param DOMCSSStyleSheet aSheet michael@0: * @param DOMString aInput michael@0: * The new source string for the style sheet. michael@0: */ michael@0: void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput); michael@0: }; michael@0: michael@0: %{ C++ michael@0: #define IN_DOMUTILS_CONTRACTID "@mozilla.org/inspector/dom-utils;1" michael@0: %}