2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-03-14 23:43:00 +04: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/.
|
|
|
|
*/
|
2018-01-11 07:37:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A collection of utility methods for use by devtools.
|
2018-01-11 07:37:59 +03:00
|
|
|
*
|
|
|
|
* See InspectorUtils.h for documentation on these methods.
|
2018-01-11 07:37:59 +03:00
|
|
|
*/
|
2019-09-27 18:26:14 +03:00
|
|
|
[Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled",
|
|
|
|
Exposed=Window]
|
2018-01-11 07:37:59 +03:00
|
|
|
namespace InspectorUtils {
|
2018-04-16 20:10:57 +03:00
|
|
|
// documentOnly tells whether user and UA sheets should get included.
|
|
|
|
sequence<StyleSheet> getAllStyleSheets(Document document, optional boolean documentOnly = false);
|
2019-02-20 14:05:30 +03:00
|
|
|
sequence<CSSStyleRule> getCSSStyleRules(
|
2018-01-11 07:37:59 +03:00
|
|
|
Element element,
|
2021-04-11 06:13:32 +03:00
|
|
|
optional [LegacyNullToEmptyString] DOMString pseudo = "",
|
2019-09-14 01:12:12 +03:00
|
|
|
optional boolean relevantLinkVisited = false);
|
2018-01-11 07:37:59 +03:00
|
|
|
unsigned long getRuleLine(CSSRule rule);
|
|
|
|
unsigned long getRuleColumn(CSSRule rule);
|
|
|
|
unsigned long getRelativeRuleLine(CSSRule rule);
|
2018-01-06 00:38:56 +03:00
|
|
|
boolean hasRulesModifiedByCSSOM(CSSStyleSheet sheet);
|
2018-01-11 07:37:59 +03:00
|
|
|
unsigned long getSelectorCount(CSSStyleRule rule);
|
2020-12-17 17:04:35 +03:00
|
|
|
[Throws] UTF8String getSelectorText(CSSStyleRule rule,
|
|
|
|
unsigned long selectorIndex);
|
2018-01-11 07:37:59 +03:00
|
|
|
[Throws] unsigned long long getSpecificity(CSSStyleRule rule,
|
|
|
|
unsigned long selectorIndex);
|
|
|
|
[Throws] boolean selectorMatchesElement(
|
|
|
|
Element element,
|
|
|
|
CSSStyleRule rule,
|
|
|
|
unsigned long selectorIndex,
|
2021-04-11 06:13:32 +03:00
|
|
|
optional [LegacyNullToEmptyString] DOMString pseudo = "",
|
2019-09-14 01:12:12 +03:00
|
|
|
optional boolean includeVisitedStyle = false);
|
2020-01-08 04:21:30 +03:00
|
|
|
boolean isInheritedProperty(UTF8String property);
|
2019-07-03 10:52:35 +03:00
|
|
|
sequence<DOMString> getCSSPropertyNames(optional PropertyNamesOptions options = {});
|
2018-05-31 07:11:01 +03:00
|
|
|
sequence<PropertyPref> getCSSPropertyPrefs();
|
2020-01-08 04:21:30 +03:00
|
|
|
[Throws] sequence<DOMString> getCSSValuesForProperty(UTF8String property);
|
2018-01-11 07:38:00 +03:00
|
|
|
[Throws] DOMString rgbToColorName(octet r, octet g, octet b);
|
Bug 1661123 - Make LightWeightThemeConsumer.jsm sanitize colors faster. r=Gijs,jwatt
Instead of creating an element, flushing styles and getting the computed
value back just to receive, use the existing InspectorUtils.colorToRGBA.
With some refactoring, we can completely get rid of parsing rgba strings
in LightWeightThemeConsumer too, as a benefit. This should be much
faster.
This patch tweaks the InspectorUtils API to allow taking a document, so
that system colors keep working. We could probably get away without
supporting system colors, but it'd technically be a regression, and
since we want this patch to be uplifted, and it's easy, let's avoid
breaking changes.
Differential Revision: https://phabricator.services.mozilla.com/D88200
2020-08-27 15:33:11 +03:00
|
|
|
InspectorRGBATuple? colorToRGBA(UTF8String colorString, optional Document? doc = null);
|
2020-01-08 04:21:30 +03:00
|
|
|
boolean isValidCSSColor(UTF8String colorString);
|
|
|
|
[Throws] sequence<DOMString> getSubpropertiesForCSSProperty(UTF8String property);
|
|
|
|
[Throws] boolean cssPropertyIsShorthand(UTF8String property);
|
2018-01-11 07:38:00 +03:00
|
|
|
|
2020-01-08 04:21:30 +03:00
|
|
|
[Throws] boolean cssPropertySupportsType(UTF8String property, InspectorPropertyType type);
|
2018-01-11 07:38:00 +03:00
|
|
|
|
2020-10-09 06:20:34 +03:00
|
|
|
// A version of CSS.supports that allows you to set UA or chrome context.
|
|
|
|
boolean supports(UTF8String conditionText, optional SupportsOptions options = {});
|
|
|
|
|
2018-01-11 07:38:00 +03:00
|
|
|
boolean isIgnorableWhitespace(CharacterData dataNode);
|
2018-01-11 07:38:00 +03:00
|
|
|
Node? getParentForNode(Node node, boolean showingAnonymousContent);
|
2018-01-11 07:38:00 +03:00
|
|
|
[NewObject] NodeList getChildrenForNode(Node node,
|
|
|
|
boolean showingAnonymousContent);
|
2018-02-06 00:00:05 +03:00
|
|
|
[Throws] boolean setContentState(Element element, unsigned long long state);
|
|
|
|
[Throws] boolean removeContentState(
|
2018-01-11 07:38:01 +03:00
|
|
|
Element element,
|
|
|
|
unsigned long long state,
|
|
|
|
optional boolean clearActiveDocument = false);
|
|
|
|
unsigned long long getContentState(Element element);
|
2018-02-15 21:48:22 +03:00
|
|
|
|
|
|
|
// Get the font face(s) actually used to render the text in /range/,
|
|
|
|
// as a collection of InspectorFontFace objects (below).
|
|
|
|
// If /maxRanges/ is greater than zero, each InspectorFontFace will record
|
|
|
|
// up to /maxRanges/ fragments of content that used the face, for the caller
|
|
|
|
// to access via its .ranges attribute.
|
|
|
|
[NewObject, Throws] sequence<InspectorFontFace> getUsedFontFaces(
|
|
|
|
Range range,
|
2018-05-24 16:44:09 +03:00
|
|
|
optional unsigned long maxRanges = 0,
|
|
|
|
optional boolean skipCollapsedWhitespace = true);
|
2018-02-15 21:48:22 +03:00
|
|
|
|
2018-01-11 07:38:01 +03:00
|
|
|
sequence<DOMString> getCSSPseudoElementNames();
|
2018-01-11 07:38:01 +03:00
|
|
|
void addPseudoClassLock(Element element,
|
|
|
|
DOMString pseudoClass,
|
|
|
|
optional boolean enabled = true);
|
|
|
|
void removePseudoClassLock(Element element, DOMString pseudoClass);
|
|
|
|
boolean hasPseudoClassLock(Element element, DOMString pseudoClass);
|
|
|
|
void clearPseudoClassLocks(Element element);
|
2020-01-08 04:21:30 +03:00
|
|
|
[Throws] void parseStyleSheet(CSSStyleSheet sheet, UTF8String input);
|
2021-04-11 06:13:32 +03:00
|
|
|
boolean isCustomElementName([LegacyNullToEmptyString] DOMString name,
|
2018-07-19 14:59:05 +03:00
|
|
|
DOMString? namespaceURI);
|
2019-08-28 20:49:22 +03:00
|
|
|
|
|
|
|
boolean isElementThemed(Element element);
|
2019-12-10 01:07:00 +03:00
|
|
|
|
|
|
|
Element? containingBlockOf(Element element);
|
2020-06-23 21:51:32 +03:00
|
|
|
|
|
|
|
[NewObject] NodeList getOverflowingChildrenOfElement(Element element);
|
2018-01-11 07:37:59 +03:00
|
|
|
};
|
|
|
|
|
2020-10-09 06:20:34 +03:00
|
|
|
dictionary SupportsOptions {
|
|
|
|
boolean userAgent = false;
|
|
|
|
boolean chrome = false;
|
|
|
|
boolean quirks = false;
|
|
|
|
};
|
|
|
|
|
2018-01-11 07:37:59 +03:00
|
|
|
dictionary PropertyNamesOptions {
|
|
|
|
boolean includeAliases = false;
|
2018-04-20 06:42:14 +03:00
|
|
|
boolean includeShorthands = true;
|
|
|
|
boolean includeExperimentals = false;
|
2018-01-11 07:37:59 +03:00
|
|
|
};
|
|
|
|
|
2018-05-31 07:11:01 +03:00
|
|
|
dictionary PropertyPref {
|
|
|
|
required DOMString name;
|
|
|
|
required DOMString pref;
|
|
|
|
};
|
|
|
|
|
2014-07-17 18:08:07 +04:00
|
|
|
dictionary InspectorRGBATuple {
|
|
|
|
/*
|
|
|
|
* NOTE: This tuple is in the normal 0-255-sized RGB space but can be
|
|
|
|
* fractional and may extend outside the 0-255 range.
|
|
|
|
*
|
|
|
|
* a is in the range 0 - 1.
|
|
|
|
*/
|
|
|
|
double r = 0;
|
|
|
|
double g = 0;
|
|
|
|
double b = 0;
|
|
|
|
double a = 1;
|
|
|
|
};
|
2018-01-11 07:38:01 +03:00
|
|
|
|
2019-03-18 19:38:48 +03:00
|
|
|
// Any update to this enum should probably also update
|
|
|
|
// devtools/shared/css/constants.js
|
|
|
|
enum InspectorPropertyType {
|
|
|
|
"color",
|
|
|
|
"gradient",
|
|
|
|
"timing-function",
|
|
|
|
};
|
|
|
|
|
2018-01-26 18:47:20 +03:00
|
|
|
dictionary InspectorVariationAxis {
|
|
|
|
required DOMString tag;
|
|
|
|
required DOMString name;
|
|
|
|
required float minValue;
|
|
|
|
required float maxValue;
|
|
|
|
required float defaultValue;
|
|
|
|
};
|
|
|
|
|
2018-01-29 16:24:11 +03:00
|
|
|
dictionary InspectorVariationValue {
|
|
|
|
required DOMString axis;
|
|
|
|
required float value;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary InspectorVariationInstance {
|
|
|
|
required DOMString name;
|
|
|
|
required sequence<InspectorVariationValue> values;
|
|
|
|
};
|
|
|
|
|
2018-01-30 12:57:39 +03:00
|
|
|
dictionary InspectorFontFeature {
|
|
|
|
required DOMString tag;
|
|
|
|
required DOMString script;
|
|
|
|
required DOMString languageSystem;
|
|
|
|
};
|
|
|
|
|
2019-09-27 18:26:14 +03:00
|
|
|
[Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled",
|
|
|
|
Exposed=Window]
|
2018-01-11 07:38:01 +03:00
|
|
|
interface InspectorFontFace {
|
|
|
|
// An indication of how we found this font during font-matching.
|
|
|
|
// Note that the same physical font may have been found in multiple ways within a range.
|
|
|
|
readonly attribute boolean fromFontGroup;
|
|
|
|
readonly attribute boolean fromLanguagePrefs;
|
|
|
|
readonly attribute boolean fromSystemFallback;
|
|
|
|
|
|
|
|
// available for all fonts
|
|
|
|
readonly attribute DOMString name; // full font name as obtained from the font resource
|
|
|
|
readonly attribute DOMString CSSFamilyName; // a family name that could be used in CSS font-family
|
|
|
|
// (not necessarily the actual name that was used,
|
|
|
|
// due to aliases, generics, localized names, etc)
|
2018-05-25 16:07:57 +03:00
|
|
|
readonly attribute DOMString CSSGeneric; // CSS generic (serif, sans-serif, etc) that was mapped
|
|
|
|
// to this font, if any (frequently empty!)
|
2018-01-11 07:38:01 +03:00
|
|
|
|
2018-01-29 16:24:11 +03:00
|
|
|
[NewObject,Throws] sequence<InspectorVariationAxis> getVariationAxes();
|
|
|
|
[NewObject,Throws] sequence<InspectorVariationInstance> getVariationInstances();
|
2018-01-30 12:57:39 +03:00
|
|
|
[NewObject,Throws] sequence<InspectorFontFeature> getFeatures();
|
2018-01-26 18:47:20 +03:00
|
|
|
|
2018-02-15 21:48:22 +03:00
|
|
|
// A list of Ranges of text rendered with this face.
|
|
|
|
// This will list the first /maxRanges/ ranges found when InspectorUtils.getUsedFontFaces
|
|
|
|
// was called (so it will be empty unless a non-zero maxRanges argument was passed).
|
|
|
|
// Note that this indicates how the document was rendered at the time of calling
|
|
|
|
// getUsedFontFaces; it does not reflect any subsequent modifications, so if styles
|
|
|
|
// have been modified since calling getUsedFontFaces, it may no longer be accurate.
|
|
|
|
[Constant,Cached] readonly attribute sequence<Range> ranges;
|
|
|
|
|
2018-01-11 07:38:01 +03:00
|
|
|
// meaningful only when the font is a user font defined using @font-face
|
|
|
|
readonly attribute CSSFontFaceRule? rule; // null if no associated @font-face rule
|
|
|
|
readonly attribute long srcIndex; // index in the rule's src list, -1 if no @font-face rule
|
|
|
|
readonly attribute DOMString URI; // empty string if not a downloaded font, i.e. local
|
|
|
|
readonly attribute DOMString localName; // empty string if not a src:local(...) rule
|
|
|
|
readonly attribute DOMString format; // as per http://www.w3.org/TR/css3-webfonts/#referencing
|
|
|
|
readonly attribute DOMString metadata; // XML metadata from WOFF file (if any)
|
|
|
|
};
|