Bug 1835529 [wpt PR 40276] - Update wpt metadata, a=testonly
[gecko.git] / dom / chrome-webidl / InspectorUtils.webidl
blobf6e000bd15c9a2050b766780c29b635af607b95a
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  */
7 /**
8  * A collection of utility methods for use by devtools.
9  *
10  * See InspectorUtils.h for documentation on these methods.
11  */
12 [Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled",
13  Exposed=Window]
14 namespace InspectorUtils {
15   // documentOnly tells whether user and UA sheets should get included.
16   sequence<StyleSheet> getAllStyleSheets(Document document, optional boolean documentOnly = false);
17   sequence<CSSStyleRule> getCSSStyleRules(
18     Element element,
19     optional [LegacyNullToEmptyString] DOMString pseudo = "",
20     optional boolean relevantLinkVisited = false);
21   unsigned long getRuleLine(CSSRule rule);
22   unsigned long getRuleColumn(CSSRule rule);
23   unsigned long getRelativeRuleLine(CSSRule rule);
24   boolean hasRulesModifiedByCSSOM(CSSStyleSheet sheet);
25   boolean isInheritedProperty(UTF8String property);
26   sequence<DOMString> getCSSPropertyNames(optional PropertyNamesOptions options = {});
27   sequence<PropertyPref> getCSSPropertyPrefs();
28   [Throws] sequence<DOMString> getCSSValuesForProperty(UTF8String property);
29   DOMString rgbToColorName(octet r, octet g, octet b);
30   InspectorRGBATuple? colorToRGBA(UTF8String colorString, optional Document? doc = null);
31   boolean isValidCSSColor(UTF8String colorString);
32   [Throws] sequence<DOMString> getSubpropertiesForCSSProperty(UTF8String property);
33   [Throws] boolean cssPropertyIsShorthand(UTF8String property);
35   [Throws] boolean cssPropertySupportsType(UTF8String property, InspectorPropertyType type);
37   // A version of CSS.supports that allows you to set UA or chrome context.
38   boolean supports(UTF8String conditionText, optional SupportsOptions options = {});
40   boolean isIgnorableWhitespace(CharacterData dataNode);
41   Node? getParentForNode(Node node, boolean showingAnonymousContent);
42   sequence<Node> getChildrenForNode(Node node,
43                                     boolean showingAnonymousContent,
44                                     boolean includeAssignedNodes);
45   [Throws] boolean setContentState(Element element, unsigned long long state);
46   [Throws] boolean removeContentState(
47       Element element,
48       unsigned long long state,
49       optional boolean clearActiveDocument = false);
50   unsigned long long getContentState(Element element);
52   // Get the font face(s) actually used to render the text in /range/,
53   // as a collection of InspectorFontFace objects (below).
54   // If /maxRanges/ is greater than zero, each InspectorFontFace will record
55   // up to /maxRanges/ fragments of content that used the face, for the caller
56   // to access via its .ranges attribute.
57   [NewObject, Throws] sequence<InspectorFontFace> getUsedFontFaces(
58       Range range,
59       optional unsigned long maxRanges = 0,
60       optional boolean skipCollapsedWhitespace = true);
62   sequence<DOMString> getCSSPseudoElementNames();
63   undefined addPseudoClassLock(Element element,
64                                DOMString pseudoClass,
65                                optional boolean enabled = true);
66   undefined removePseudoClassLock(Element element, DOMString pseudoClass);
67   boolean hasPseudoClassLock(Element element, DOMString pseudoClass);
68   undefined clearPseudoClassLocks(Element element);
69   [Throws] undefined parseStyleSheet(CSSStyleSheet sheet, UTF8String input);
70   boolean isCustomElementName([LegacyNullToEmptyString] DOMString name,
71                               DOMString? namespaceURI);
73   boolean isElementThemed(Element element);
75   Element? containingBlockOf(Element element);
77   [NewObject] NodeList getOverflowingChildrenOfElement(Element element);
80 dictionary SupportsOptions {
81   boolean userAgent = false;
82   boolean chrome = false;
83   boolean quirks = false;
86 dictionary PropertyNamesOptions {
87   boolean includeAliases = false;
88   boolean includeShorthands = true;
89   boolean includeExperimentals = false;
92 dictionary PropertyPref {
93   required DOMString name;
94   required DOMString pref;
97 dictionary InspectorRGBATuple {
98   /*
99    * NOTE: This tuple is in the normal 0-255-sized RGB space but can be
100    * fractional and may extend outside the 0-255 range.
101    *
102    * a is in the range 0 - 1.
103    */
104   double r = 0;
105   double g = 0;
106   double b = 0;
107   double a = 1;
110 // Any update to this enum should probably also update
111 // devtools/shared/css/constants.js
112 enum InspectorPropertyType {
113   "color",
114   "gradient",
115   "timing-function",
118 dictionary InspectorVariationAxis {
119   required DOMString tag;
120   required DOMString name;
121   required float minValue;
122   required float maxValue;
123   required float defaultValue;
126 dictionary InspectorVariationValue {
127   required DOMString axis;
128   required float value;
131 dictionary InspectorVariationInstance {
132   required DOMString name;
133   required sequence<InspectorVariationValue> values;
136 dictionary InspectorFontFeature {
137   required DOMString tag;
138   required DOMString script;
139   required DOMString languageSystem;
142 [Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled",
143  Exposed=Window]
144 interface InspectorFontFace {
145   // An indication of how we found this font during font-matching.
146   // Note that the same physical font may have been found in multiple ways within a range.
147   readonly attribute boolean fromFontGroup;
148   readonly attribute boolean fromLanguagePrefs;
149   readonly attribute boolean fromSystemFallback;
151   // available for all fonts
152   readonly attribute DOMString name; // full font name as obtained from the font resource
153   readonly attribute DOMString CSSFamilyName; // a family name that could be used in CSS font-family
154                                               // (not necessarily the actual name that was used,
155                                               // due to aliases, generics, localized names, etc)
156   readonly attribute DOMString CSSGeneric; // CSS generic (serif, sans-serif, etc) that was mapped
157                                            // to this font, if any (frequently empty!)
159   [NewObject,Throws] sequence<InspectorVariationAxis> getVariationAxes();
160   [NewObject,Throws] sequence<InspectorVariationInstance> getVariationInstances();
161   [NewObject,Throws] sequence<InspectorFontFeature> getFeatures();
163   // A list of Ranges of text rendered with this face.
164   // This will list the first /maxRanges/ ranges found when InspectorUtils.getUsedFontFaces
165   // was called (so it will be empty unless a non-zero maxRanges argument was passed).
166   // Note that this indicates how the document was rendered at the time of calling
167   // getUsedFontFaces; it does not reflect any subsequent modifications, so if styles
168   // have been modified since calling getUsedFontFaces, it may no longer be accurate.
169   [Constant,Cached]  readonly attribute sequence<Range> ranges;
171   // meaningful only when the font is a user font defined using @font-face
172   readonly attribute CSSFontFaceRule? rule; // null if no associated @font-face rule
173   readonly attribute long srcIndex; // index in the rule's src list, -1 if no @font-face rule
174   readonly attribute DOMString URI; // empty string if not a downloaded font, i.e. local
175   readonly attribute DOMString localName; // empty string  if not a src:local(...) rule
176   readonly attribute DOMString format; // as per http://www.w3.org/TR/css3-webfonts/#referencing
177   readonly attribute DOMString metadata; // XML metadata from WOFF file (if any)