layout/inspector/inIDOMUtils.idl

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:c3dc075a6367
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #include "nsISupports.idl"
6
7 interface nsIArray;
8 interface nsISupportsArray;
9 interface nsIDOMCharacterData;
10 interface nsIDOMElement;
11 interface nsIDOMDocument;
12 interface nsIDOMCSSStyleRule;
13 interface nsIDOMNode;
14 interface nsIDOMNodeList;
15 interface nsIDOMFontFaceList;
16 interface nsIDOMRange;
17 interface nsIDOMCSSStyleSheet;
18
19 [scriptable, uuid(ceae6c68-f5d4-4597-a3d9-ca5646c25f1a)]
20 interface inIDOMUtils : nsISupports
21 {
22 // CSS utilities
23 void getAllStyleSheets (in nsIDOMDocument aDoc,
24 [optional] out unsigned long aLength,
25 [array, size_is (aLength), retval] out nsISupports aSheets);
26 nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo);
27 unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule);
28 unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule);
29
30 // Utilities for working with selectors. We don't have a JS OM representation
31 // of a single selector or a selector list yet, but given a rule we can index
32 // into the selector list.
33 //
34 // This is a somewhat backwards API; once we move StyleRule to WebIDL we
35 // should consider using [ChromeOnly] APIs on that.
36 unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule);
37 // For all three functions below, aSelectorIndex is 0-based
38 AString getSelectorText(in nsIDOMCSSStyleRule aRule,
39 in unsigned long aSelectorIndex);
40 unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule,
41 in unsigned long aSelectorIndex);
42 // Note: This does not handle scoped selectors correctly, because it has no
43 // idea what the right scope is.
44 bool selectorMatchesElement(in nsIDOMElement aElement,
45 in nsIDOMCSSStyleRule aRule,
46 in unsigned long aSelectorIndex);
47
48 // Utilities for working with CSS properties
49 //
50 // Returns true if the string names a property that is inherited by default.
51 bool isInheritedProperty(in AString aPropertyName);
52
53 // Get a list of all our supported property names. Optionally
54 // shorthands can be excluded or property aliases included.
55 const unsigned long EXCLUDE_SHORTHANDS = (1<<0);
56 const unsigned long INCLUDE_ALIASES = (1<<1);
57 void getCSSPropertyNames([optional] in unsigned long aFlags,
58 [optional] out unsigned long aCount,
59 [retval, array, size_is(aCount)] out wstring aProps);
60
61 // Get a list of all valid keywords and colors for aProperty.
62 void getCSSValuesForProperty(in AString aProperty,
63 [optional] out unsigned long aLength,
64 [array, size_is(aLength), retval] out wstring aValues);
65
66 // Utilities for working with CSS colors
67 [implicit_jscontext]
68 jsval colorNameToRGB(in DOMString aColorName);
69 AString rgbToColorName(in octet aR, in octet aG, in octet aB);
70
71 // DOM Node utilities
72 boolean isIgnorableWhitespace(in nsIDOMCharacterData aDataNode);
73 // Returns the "parent" of a node. The parent of a document node is the
74 // frame/iframe containing that document. aShowingAnonymousContent says
75 // whether we are showing anonymous content.
76 nsIDOMNode getParentForNode(in nsIDOMNode aNode,
77 in boolean aShowingAnonymousContent);
78 nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode,
79 in boolean aShowingAnonymousContent);
80
81 // XBL utilities
82 nsIArray getBindingURLs(in nsIDOMElement aElement);
83
84 // content state utilities
85 unsigned long long getContentState(in nsIDOMElement aElement);
86 void setContentState(in nsIDOMElement aElement, in unsigned long long aState);
87
88 nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
89
90 // pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class
91 // selector string, e.g. ":hover". ":-moz-any-link" and non-event-state
92 // pseudo-classes are ignored.
93 void addPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
94 void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
95 bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
96 void clearPseudoClassLocks(in nsIDOMElement aElement);
97
98 /**
99 * Parse CSS and update the style sheet in place.
100 *
101 * @param DOMCSSStyleSheet aSheet
102 * @param DOMString aInput
103 * The new source string for the style sheet.
104 */
105 void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput);
106 };
107
108 %{ C++
109 #define IN_DOMUTILS_CONTRACTID "@mozilla.org/inspector/dom-utils;1"
110 %}

mercurial