2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2006-05-17 02:22:14 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2006-05-17 02:38:48 +00:00
|
|
|
interface nsIArray;
|
2006-05-17 02:22:14 +00:00
|
|
|
interface nsISupportsArray;
|
2006-05-17 02:37:41 +00:00
|
|
|
interface nsIDOMCharacterData;
|
2006-05-17 02:22:14 +00:00
|
|
|
interface nsIDOMElement;
|
|
|
|
interface nsIDOMDocument;
|
|
|
|
interface nsIDOMCSSStyleRule;
|
2006-05-17 02:38:00 +00:00
|
|
|
interface nsIDOMNode;
|
2011-05-30 21:51:09 +00:00
|
|
|
interface nsIDOMNodeList;
|
2011-06-16 06:31:36 +00:00
|
|
|
interface nsIDOMFontFaceList;
|
|
|
|
interface nsIDOMRange;
|
2012-06-03 16:54:38 +00:00
|
|
|
interface nsIDOMCSSStyleSheet;
|
2006-05-17 02:22:14 +00:00
|
|
|
|
2013-07-25 13:31:14 +00:00
|
|
|
[scriptable, uuid(ceae6c68-f5d4-4597-a3d9-ca5646c25f1a)]
|
2006-05-17 02:22:14 +00:00
|
|
|
interface inIDOMUtils : nsISupports
|
|
|
|
{
|
|
|
|
// CSS utilities
|
2013-07-25 13:31:14 +00:00
|
|
|
void getAllStyleSheets (in nsIDOMDocument aDoc,
|
|
|
|
[optional] out unsigned long aLength,
|
|
|
|
[array, size_is (aLength), retval] out nsISupports aSheets);
|
2011-05-05 21:12:04 +00:00
|
|
|
nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo);
|
2006-05-17 02:22:14 +00:00
|
|
|
unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule);
|
2013-04-06 17:38:56 +00:00
|
|
|
unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule);
|
2006-05-17 02:37:41 +00:00
|
|
|
|
2013-02-13 15:11:53 +00:00
|
|
|
// Utilities for working with selectors. We don't have a JS OM representation
|
|
|
|
// of a single selector or a selector list yet, but given a rule we can index
|
|
|
|
// into the selector list.
|
|
|
|
//
|
|
|
|
// This is a somewhat backwards API; once we move StyleRule to WebIDL we
|
|
|
|
// should consider using [ChromeOnly] APIs on that.
|
|
|
|
unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule);
|
|
|
|
// For all three functions below, aSelectorIndex is 0-based
|
|
|
|
AString getSelectorText(in nsIDOMCSSStyleRule aRule,
|
|
|
|
in unsigned long aSelectorIndex);
|
|
|
|
unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule,
|
|
|
|
in unsigned long aSelectorIndex);
|
|
|
|
// Note: This does not handle scoped selectors correctly, because it has no
|
|
|
|
// idea what the right scope is.
|
|
|
|
bool selectorMatchesElement(in nsIDOMElement aElement,
|
|
|
|
in nsIDOMCSSStyleRule aRule,
|
|
|
|
in unsigned long aSelectorIndex);
|
|
|
|
|
2013-03-14 19:42:59 +00:00
|
|
|
// Utilities for working with CSS properties
|
|
|
|
//
|
2011-11-05 15:41:10 +00:00
|
|
|
// Returns true if the string names a property that is inherited by default.
|
|
|
|
bool isInheritedProperty(in AString aPropertyName);
|
|
|
|
|
2013-03-14 19:42:59 +00:00
|
|
|
// Get a list of all our supported property names. Optionally
|
|
|
|
// shorthands can be excluded or property aliases included.
|
|
|
|
const unsigned long EXCLUDE_SHORTHANDS = (1<<0);
|
|
|
|
const unsigned long INCLUDE_ALIASES = (1<<1);
|
|
|
|
void getCSSPropertyNames([optional] in unsigned long aFlags,
|
|
|
|
[optional] out unsigned long aCount,
|
|
|
|
[retval, array, size_is(aCount)] out wstring aProps);
|
|
|
|
|
2013-07-15 21:28:49 +00:00
|
|
|
// Get a list of all valid keywords and colors for aProperty.
|
|
|
|
void getCSSValuesForProperty(in AString aProperty,
|
|
|
|
[optional] out unsigned long aLength,
|
|
|
|
[array, size_is(aLength), retval] out wstring aValues);
|
|
|
|
|
2013-03-14 19:43:00 +00:00
|
|
|
// Utilities for working with CSS colors
|
|
|
|
[implicit_jscontext]
|
|
|
|
jsval colorNameToRGB(in DOMString aColorName);
|
2013-03-14 19:43:00 +00:00
|
|
|
AString rgbToColorName(in octet aR, in octet aG, in octet aB);
|
2013-03-14 19:43:00 +00:00
|
|
|
|
2006-05-17 02:37:41 +00:00
|
|
|
// DOM Node utilities
|
|
|
|
boolean isIgnorableWhitespace(in nsIDOMCharacterData aDataNode);
|
2006-05-17 02:38:00 +00:00
|
|
|
// Returns the "parent" of a node. The parent of a document node is the
|
|
|
|
// frame/iframe containing that document. aShowingAnonymousContent says
|
|
|
|
// whether we are showing anonymous content.
|
|
|
|
nsIDOMNode getParentForNode(in nsIDOMNode aNode,
|
|
|
|
in boolean aShowingAnonymousContent);
|
2011-05-30 21:51:09 +00:00
|
|
|
nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode,
|
|
|
|
in boolean aShowingAnonymousContent);
|
2006-05-17 02:22:14 +00:00
|
|
|
|
|
|
|
// XBL utilities
|
2006-05-17 02:38:48 +00:00
|
|
|
nsIArray getBindingURLs(in nsIDOMElement aElement);
|
2006-05-17 02:22:14 +00:00
|
|
|
|
|
|
|
// content state utilities
|
2010-10-20 07:41:35 +00:00
|
|
|
unsigned long long getContentState(in nsIDOMElement aElement);
|
|
|
|
void setContentState(in nsIDOMElement aElement, in unsigned long long aState);
|
2011-06-16 06:31:36 +00:00
|
|
|
|
|
|
|
nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
|
2012-02-08 18:42:38 +00:00
|
|
|
|
|
|
|
// pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class
|
|
|
|
// selector string, e.g. ":hover". ":-moz-any-link" and non-event-state
|
|
|
|
// pseudo-classes are ignored.
|
|
|
|
void addPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
|
|
|
void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
|
|
|
bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
|
|
|
void clearPseudoClassLocks(in nsIDOMElement aElement);
|
2012-06-03 16:54:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse CSS and update the style sheet in place.
|
|
|
|
*
|
|
|
|
* @param DOMCSSStyleSheet aSheet
|
|
|
|
* @param DOMString aInput
|
|
|
|
* The new source string for the style sheet.
|
|
|
|
*/
|
|
|
|
void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput);
|
2006-05-17 02:22:14 +00:00
|
|
|
};
|
2014-04-11 21:39:58 +00:00
|
|
|
|
|
|
|
%{ C++
|
|
|
|
#define IN_DOMUTILS_CONTRACTID "@mozilla.org/inspector/dom-utils;1"
|
|
|
|
%}
|