mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1533201 - Make cssPropertySupportsType take an enum. r=heycam,rcaliman
Differential Revision: https://phabricator.services.mozilla.com/D22427 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b6f5c669e6
commit
09763b1ac3
@ -10,8 +10,6 @@ const {getCSSLexer} = require("devtools/shared/css/lexer");
|
|||||||
const EventEmitter = require("devtools/shared/event-emitter");
|
const EventEmitter = require("devtools/shared/event-emitter");
|
||||||
const {appendText} = require("devtools/client/inspector/shared/utils");
|
const {appendText} = require("devtools/client/inspector/shared/utils");
|
||||||
|
|
||||||
loader.lazyRequireGetter(this, "CSS_TYPES", "devtools/shared/css/constants", true);
|
|
||||||
|
|
||||||
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
||||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||||
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
||||||
@ -51,9 +49,8 @@ const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|||||||
*
|
*
|
||||||
* @param {Document} document Used to create DOM nodes.
|
* @param {Document} document Used to create DOM nodes.
|
||||||
* @param {Function} supportsTypes - A function that returns a boolean when asked if a css
|
* @param {Function} supportsTypes - A function that returns a boolean when asked if a css
|
||||||
* property name supports a given css type.
|
* property name supports a given css type. The function is
|
||||||
* The function is executed like supportsType("color", CSS_TYPES.COLOR)
|
* executed like supportsType("color", "timing-function")
|
||||||
* where CSS_TYPES is defined in devtools/shared/css/properties-db.js
|
|
||||||
* @param {Function} isValidOnClient - A function that checks if a css property
|
* @param {Function} isValidOnClient - A function that checks if a css property
|
||||||
* name/value combo is valid.
|
* name/value combo is valid.
|
||||||
* @param {Function} supportsCssColor4ColorFunction - A function for checking
|
* @param {Function} supportsCssColor4ColorFunction - A function for checking
|
||||||
@ -90,13 +87,13 @@ OutputParser.prototype = {
|
|||||||
parseCssProperty: function(name, value, options = {}) {
|
parseCssProperty: function(name, value, options = {}) {
|
||||||
options = this._mergeOptions(options);
|
options = this._mergeOptions(options);
|
||||||
|
|
||||||
options.expectCubicBezier = this.supportsType(name, CSS_TYPES.TIMING_FUNCTION);
|
options.expectCubicBezier = this.supportsType(name, "timing-function");
|
||||||
options.expectDisplay = name === "display";
|
options.expectDisplay = name === "display";
|
||||||
options.expectFilter = name === "filter";
|
options.expectFilter = name === "filter";
|
||||||
options.expectShape = name === "clip-path" || name === "shape-outside";
|
options.expectShape = name === "clip-path" || name === "shape-outside";
|
||||||
options.expectFont = name === "font-family";
|
options.expectFont = name === "font-family";
|
||||||
options.supportsColor = this.supportsType(name, CSS_TYPES.COLOR) ||
|
options.supportsColor = this.supportsType(name, "color") ||
|
||||||
this.supportsType(name, CSS_TYPES.GRADIENT);
|
this.supportsType(name, "gradient");
|
||||||
|
|
||||||
// The filter property is special in that we want to show the
|
// The filter property is special in that we want to show the
|
||||||
// swatch even if the value is invalid, because this way the user
|
// swatch even if the value is invalid, because this way the user
|
||||||
|
@ -50,8 +50,8 @@ function generateCssProperties() {
|
|||||||
// Get the list of CSS types this property supports.
|
// Get the list of CSS types this property supports.
|
||||||
const supports = [];
|
const supports = [];
|
||||||
for (const type in CSS_TYPES) {
|
for (const type in CSS_TYPES) {
|
||||||
if (safeCssPropertySupportsType(name, InspectorUtils["TYPE_" + type])) {
|
if (safeCssPropertySupportsType(name, type)) {
|
||||||
supports.push(CSS_TYPES[type]);
|
supports.push(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,13 +15,11 @@ exports.CSS_ANGLEUNIT = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All CSS types that properties can support. This list can be manually edited.
|
* Mapping of InspectorPropertyType to old type ID.
|
||||||
*
|
* Kept for backwards compatibility. Remove after Firefox 70.
|
||||||
* The existing numbers are for backward compatibility so that newer versions
|
|
||||||
* are still able to debug an old version correctly.
|
|
||||||
*/
|
*/
|
||||||
exports.CSS_TYPES = {
|
exports.CSS_TYPES = {
|
||||||
"COLOR": 2,
|
"color": 2,
|
||||||
"GRADIENT": 4,
|
"gradient": 4,
|
||||||
"TIMING_FUNCTION": 10,
|
"timing-function": 10,
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-play-state"
|
"animation-play-state"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"alternate",
|
"alternate",
|
||||||
@ -166,7 +166,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-timing-function"
|
"animation-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
@ -350,7 +350,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-width"
|
"border-inline-end-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -385,7 +385,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-color"
|
"border-inline-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -450,7 +450,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-image-width"
|
"border-image-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -490,7 +490,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-start-width"
|
"border-inline-start-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -525,7 +525,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-start-color"
|
"border-inline-start-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -739,7 +739,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"column-rule-color"
|
"column-rule-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -774,7 +774,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"column-rule-color"
|
"column-rule-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -1269,7 +1269,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-delay"
|
"transition-delay"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"all",
|
"all",
|
||||||
@ -1336,7 +1336,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-timing-function"
|
"transition-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
@ -1536,7 +1536,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-play-state"
|
"animation-play-state"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"alternate",
|
"alternate",
|
||||||
@ -1674,7 +1674,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-timing-function"
|
"animation-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
@ -1935,7 +1935,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-image-width"
|
"border-image-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -2108,7 +2108,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"box-shadow"
|
"box-shadow"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -2331,7 +2331,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"mask-image"
|
"mask-image"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -2428,7 +2428,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"mask-image"
|
"mask-image"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -2610,7 +2610,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"-webkit-text-fill-color"
|
"-webkit-text-fill-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -2648,7 +2648,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"-webkit-text-stroke-color"
|
"-webkit-text-stroke-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -2673,7 +2673,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"-webkit-text-stroke-color"
|
"-webkit-text-stroke-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -2784,7 +2784,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-delay"
|
"transition-delay"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"all",
|
"all",
|
||||||
@ -2851,7 +2851,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-timing-function"
|
"transition-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
@ -3329,7 +3329,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-play-state"
|
"animation-play-state"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"alternate",
|
"alternate",
|
||||||
@ -3467,7 +3467,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"animation-timing-function"
|
"animation-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
@ -3514,8 +3514,8 @@ exports.CSS_PROPERTIES = {
|
|||||||
"background-clip"
|
"background-clip"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2,
|
"color",
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3637,7 +3637,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"background-color"
|
"background-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3659,7 +3659,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"background-image"
|
"background-image"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -3829,7 +3829,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-image-width"
|
"border-image-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3869,7 +3869,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-end-color"
|
"border-block-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3905,7 +3905,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-end-color"
|
"border-block-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3929,7 +3929,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-end-width"
|
"border-block-end-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -3964,7 +3964,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-end-color"
|
"border-block-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4027,7 +4027,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-start-width"
|
"border-block-start-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4062,7 +4062,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-block-start-color"
|
"border-block-start-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4166,7 +4166,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-bottom-width"
|
"border-bottom-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4201,7 +4201,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-bottom-color"
|
"border-bottom-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4306,7 +4306,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-left-color"
|
"border-left-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4358,7 +4358,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-image-width"
|
"border-image-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -4440,7 +4440,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-image-source"
|
"border-image-source"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -4491,7 +4491,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-color"
|
"border-inline-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4527,7 +4527,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-color"
|
"border-inline-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4551,7 +4551,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-width"
|
"border-inline-end-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4586,7 +4586,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-end-color"
|
"border-inline-end-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4649,7 +4649,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-start-width"
|
"border-inline-start-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4684,7 +4684,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-inline-start-color"
|
"border-inline-start-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4788,7 +4788,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-left-width"
|
"border-left-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4823,7 +4823,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-left-color"
|
"border-left-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4902,7 +4902,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-right-width"
|
"border-right-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -4937,7 +4937,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-right-color"
|
"border-right-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5065,7 +5065,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-top-width"
|
"border-top-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5100,7 +5100,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"border-top-color"
|
"border-top-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5235,7 +5235,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"box-shadow"
|
"box-shadow"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5346,7 +5346,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"caret-color"
|
"caret-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5445,7 +5445,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"color"
|
"color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5559,7 +5559,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"column-rule-color"
|
"column-rule-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5594,7 +5594,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"column-rule-color"
|
"column-rule-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -5899,7 +5899,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"fill"
|
"fill"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -6122,7 +6122,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"flood-color"
|
"flood-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -7259,7 +7259,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"lighting-color"
|
"lighting-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -7700,7 +7700,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"mask-image"
|
"mask-image"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -7797,7 +7797,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"mask-image"
|
"mask-image"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -8233,7 +8233,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"outline-width"
|
"outline-width"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -8269,7 +8269,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"outline-color"
|
"outline-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9083,7 +9083,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"scrollbar-color"
|
"scrollbar-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9148,7 +9148,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"shape-outside"
|
"shape-outside"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
4
|
"gradient"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"-moz-element",
|
"-moz-element",
|
||||||
@ -9206,7 +9206,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"stop-color"
|
"stop-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9241,7 +9241,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"stroke"
|
"stroke"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9461,7 +9461,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"text-decoration-color"
|
"text-decoration-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9494,7 +9494,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"text-decoration-color"
|
"text-decoration-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9554,7 +9554,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"text-emphasis-color"
|
"text-emphasis-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9584,7 +9584,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"text-emphasis-color"
|
"text-emphasis-color"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9724,7 +9724,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"text-shadow"
|
"text-shadow"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
2
|
"color"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"COLOR",
|
"COLOR",
|
||||||
@ -9887,7 +9887,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-delay"
|
"transition-delay"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"all",
|
"all",
|
||||||
@ -9954,7 +9954,7 @@ exports.CSS_PROPERTIES = {
|
|||||||
"transition-timing-function"
|
"transition-timing-function"
|
||||||
],
|
],
|
||||||
"supports": [
|
"supports": [
|
||||||
10
|
"timing-function"
|
||||||
],
|
],
|
||||||
"values": [
|
"values": [
|
||||||
"cubic-bezier",
|
"cubic-bezier",
|
||||||
|
@ -24,6 +24,9 @@ var FIRST_CHAR = ["[_a-z]", NON_ASCII, ESCAPE].join("|");
|
|||||||
var TRAILING_CHAR = ["[_a-z0-9-]", NON_ASCII, ESCAPE].join("|");
|
var TRAILING_CHAR = ["[_a-z0-9-]", NON_ASCII, ESCAPE].join("|");
|
||||||
var IS_VARIABLE_TOKEN = new RegExp(`^--(${FIRST_CHAR})(${TRAILING_CHAR})*$`,
|
var IS_VARIABLE_TOKEN = new RegExp(`^--(${FIRST_CHAR})(${TRAILING_CHAR})*$`,
|
||||||
"i");
|
"i");
|
||||||
|
|
||||||
|
loader.lazyRequireGetter(this, "CSS_TYPES", "devtools/shared/css/constants", true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that this is a CSS variable.
|
* Check that this is a CSS variable.
|
||||||
*
|
*
|
||||||
@ -162,14 +165,16 @@ CssProperties.prototype = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the property supports the given CSS type.
|
* Checks if the property supports the given CSS type.
|
||||||
* CSS types should come from devtools/shared/css/constants.js' CSS_TYPES.
|
|
||||||
*
|
*
|
||||||
* @param {String} property The property to be checked.
|
* @param {String} property The property to be checked.
|
||||||
* @param {Number} type One of the type values from CSS_TYPES.
|
* @param {String} type One of the values from InspectorPropertyType.
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
supportsType(property, type) {
|
supportsType(property, type) {
|
||||||
return this.properties[property] && this.properties[property].supports.includes(type);
|
const id = CSS_TYPES[type];
|
||||||
|
return this.properties[property] &&
|
||||||
|
(this.properties[property].supports.includes(type) ||
|
||||||
|
this.properties[property].supports.includes(id));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,11 +40,7 @@ namespace InspectorUtils {
|
|||||||
[Throws] sequence<DOMString> getSubpropertiesForCSSProperty(DOMString property);
|
[Throws] sequence<DOMString> getSubpropertiesForCSSProperty(DOMString property);
|
||||||
[Throws] boolean cssPropertyIsShorthand(DOMString property);
|
[Throws] boolean cssPropertyIsShorthand(DOMString property);
|
||||||
|
|
||||||
// TODO: Change this to use an enum.
|
[Throws] boolean cssPropertySupportsType(DOMString property, InspectorPropertyType type);
|
||||||
const unsigned long TYPE_COLOR = 1;
|
|
||||||
const unsigned long TYPE_GRADIENT = 2;
|
|
||||||
const unsigned long TYPE_TIMING_FUNCTION = 3;
|
|
||||||
[Throws] boolean cssPropertySupportsType(DOMString property, unsigned long type);
|
|
||||||
|
|
||||||
boolean isIgnorableWhitespace(CharacterData dataNode);
|
boolean isIgnorableWhitespace(CharacterData dataNode);
|
||||||
Node? getParentForNode(Node node, boolean showingAnonymousContent);
|
Node? getParentForNode(Node node, boolean showingAnonymousContent);
|
||||||
@ -104,6 +100,14 @@ dictionary InspectorRGBATuple {
|
|||||||
double a = 1;
|
double a = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Any update to this enum should probably also update
|
||||||
|
// devtools/shared/css/constants.js
|
||||||
|
enum InspectorPropertyType {
|
||||||
|
"color",
|
||||||
|
"gradient",
|
||||||
|
"timing-function",
|
||||||
|
};
|
||||||
|
|
||||||
dictionary InspectorVariationAxis {
|
dictionary InspectorVariationAxis {
|
||||||
required DOMString tag;
|
required DOMString tag;
|
||||||
required DOMString name;
|
required DOMString name;
|
||||||
|
@ -440,16 +440,32 @@ bool InspectorUtils::CssPropertyIsShorthand(GlobalObject& aGlobalObject,
|
|||||||
return isShorthand;
|
return isShorthand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should match the constants in specified_value_info.rs
|
||||||
|
//
|
||||||
|
// Once we can use bitflags in consts, we can also cbindgen that and use them
|
||||||
|
// here instead.
|
||||||
|
static uint8_t ToServoCssType(InspectorPropertyType aType) {
|
||||||
|
switch (aType) {
|
||||||
|
case InspectorPropertyType::Color:
|
||||||
|
return 1;
|
||||||
|
case InspectorPropertyType::Gradient:
|
||||||
|
return 1 << 1;
|
||||||
|
case InspectorPropertyType::Timing_function:
|
||||||
|
return 1 << 2;
|
||||||
|
default:
|
||||||
|
MOZ_ASSERT_UNREACHABLE("Unknown property type?");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool InspectorUtils::CssPropertySupportsType(GlobalObject& aGlobalObject,
|
bool InspectorUtils::CssPropertySupportsType(GlobalObject& aGlobalObject,
|
||||||
const nsAString& aProperty,
|
const nsAString& aProperty,
|
||||||
uint32_t aType, ErrorResult& aRv) {
|
InspectorPropertyType aType,
|
||||||
|
ErrorResult& aRv) {
|
||||||
NS_ConvertUTF16toUTF8 property(aProperty);
|
NS_ConvertUTF16toUTF8 property(aProperty);
|
||||||
if (!aType || aType > InspectorUtils_Binding::TYPE_TIMING_FUNCTION) {
|
|
||||||
aRv.Throw(NS_ERROR_INVALID_ARG);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool found;
|
bool found;
|
||||||
bool result = Servo_Property_SupportsType(&property, aType, &found);
|
bool result =
|
||||||
|
Servo_Property_SupportsType(&property, ToServoCssType(aType), &found);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "mozilla/dom/InspectorUtilsBinding.h"
|
#include "mozilla/dom/InspectorUtilsBinding.h"
|
||||||
|
|
||||||
class nsAtom;
|
class nsAtom;
|
||||||
|
class nsINode;
|
||||||
class ComputedStyle;
|
class ComputedStyle;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -153,7 +154,7 @@ class InspectorUtils {
|
|||||||
// unknown types.
|
// unknown types.
|
||||||
static bool CssPropertySupportsType(GlobalObject& aGlobal,
|
static bool CssPropertySupportsType(GlobalObject& aGlobal,
|
||||||
const nsAString& aProperty,
|
const nsAString& aProperty,
|
||||||
uint32_t aType, ErrorResult& aRv);
|
InspectorPropertyType, ErrorResult& aRv);
|
||||||
|
|
||||||
static bool IsIgnorableWhitespace(GlobalObject& aGlobalObject,
|
static bool IsIgnorableWhitespace(GlobalObject& aGlobalObject,
|
||||||
CharacterData& aDataNode) {
|
CharacterData& aDataNode) {
|
||||||
|
@ -46,30 +46,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1006595
|
|||||||
ok(InspectorUtils.cssPropertyIsShorthand("padding"), "'padding' is a shorthand")
|
ok(InspectorUtils.cssPropertyIsShorthand("padding"), "'padding' is a shorthand")
|
||||||
ok(!InspectorUtils.cssPropertyIsShorthand("color"), "'color' is not a shorthand")
|
ok(!InspectorUtils.cssPropertyIsShorthand("color"), "'color' is not a shorthand")
|
||||||
|
|
||||||
ok(!InspectorUtils.cssPropertySupportsType("padding", InspectorUtils.TYPE_COLOR),
|
ok(!InspectorUtils.cssPropertySupportsType("padding", "color"),
|
||||||
"'padding' can't be a color");
|
"'padding' can't be a color");
|
||||||
|
|
||||||
ok(InspectorUtils.cssPropertySupportsType("color", InspectorUtils.TYPE_COLOR),
|
ok(InspectorUtils.cssPropertySupportsType("color", "color"),
|
||||||
"'color' can be a color");
|
"'color' can be a color");
|
||||||
ok(InspectorUtils.cssPropertySupportsType("background", InspectorUtils.TYPE_COLOR),
|
ok(InspectorUtils.cssPropertySupportsType("background", "color"),
|
||||||
"'background' can be a color");
|
"'background' can be a color");
|
||||||
ok(!InspectorUtils.cssPropertySupportsType("background-image", InspectorUtils.TYPE_COLOR),
|
ok(!InspectorUtils.cssPropertySupportsType("background-image", "color"),
|
||||||
"'background-image' can't be a color");
|
"'background-image' can't be a color");
|
||||||
|
|
||||||
ok(InspectorUtils.cssPropertySupportsType("background-image", InspectorUtils.TYPE_GRADIENT),
|
ok(InspectorUtils.cssPropertySupportsType("background-image", "gradient"),
|
||||||
"'background-image' can be a gradient");
|
"'background-image' can be a gradient");
|
||||||
ok(InspectorUtils.cssPropertySupportsType("background", InspectorUtils.TYPE_GRADIENT),
|
ok(InspectorUtils.cssPropertySupportsType("background", "gradient"),
|
||||||
"'background' can be a gradient");
|
"'background' can be a gradient");
|
||||||
ok(!InspectorUtils.cssPropertySupportsType("background-color", InspectorUtils.TYPE_GRADIENT),
|
ok(!InspectorUtils.cssPropertySupportsType("background-color", "gradient"),
|
||||||
"'background-color' can't be a gradient");
|
"'background-color' can't be a gradient");
|
||||||
|
|
||||||
ok(InspectorUtils.cssPropertySupportsType("transition", InspectorUtils.TYPE_TIMING_FUNCTION),
|
ok(InspectorUtils.cssPropertySupportsType("transition", "timing-function"),
|
||||||
"'transition' can be a timing function");
|
"'transition' can be a timing function");
|
||||||
ok(InspectorUtils.cssPropertySupportsType("transition-timing-function",
|
ok(InspectorUtils.cssPropertySupportsType("transition-timing-function", "timing-function"),
|
||||||
InspectorUtils.TYPE_TIMING_FUNCTION),
|
|
||||||
"'transition-duration' can be a timing function");
|
"'transition-duration' can be a timing function");
|
||||||
ok(!InspectorUtils.cssPropertySupportsType("background-color",
|
ok(!InspectorUtils.cssPropertySupportsType("background-color", "timing-function"),
|
||||||
InspectorUtils.TYPE_TIMING_FUNCTION),
|
|
||||||
"'background-color' can't be a timing function");
|
"'background-color' can't be a timing function");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -965,7 +965,7 @@ const uint8_t* Servo_Property_GetName(nsCSSPropertyID, uint32_t* out_length);
|
|||||||
bool Servo_Property_IsShorthand(const nsACString* name, bool* found);
|
bool Servo_Property_IsShorthand(const nsACString* name, bool* found);
|
||||||
bool Servo_Property_IsInherited(const nsACString* name);
|
bool Servo_Property_IsInherited(const nsACString* name);
|
||||||
|
|
||||||
bool Servo_Property_SupportsType(const nsACString* name, uint32_t ty,
|
bool Servo_Property_SupportsType(const nsACString* name, uint8_t ty,
|
||||||
bool* found);
|
bool* found);
|
||||||
|
|
||||||
void Servo_Property_GetCSSValuesForProperty(const nsACString* name, bool* found,
|
void Servo_Property_GetCSSValuesForProperty(const nsACString* name, bool* found,
|
||||||
|
@ -16,9 +16,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
|
|||||||
|
|
||||||
// This holds a canonical test value for each TYPE_ constant.
|
// This holds a canonical test value for each TYPE_ constant.
|
||||||
let testValues = {
|
let testValues = {
|
||||||
TYPE_COLOR: "rgb(3,3,3)",
|
"color": "rgb(3,3,3)",
|
||||||
TYPE_GRADIENT: "linear-gradient( 45deg, blue, red )",
|
"gradient": "linear-gradient( 45deg, blue, red )",
|
||||||
TYPE_TIMING_FUNCTION: "cubic-bezier(0.1, 0.7, 1.0, 0.1)",
|
"timing-function": "cubic-bezier(0.1, 0.7, 1.0, 0.1)",
|
||||||
};
|
};
|
||||||
|
|
||||||
// The canonical test values don't work for all properties, in
|
// The canonical test values don't work for all properties, in
|
||||||
@ -26,16 +26,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
|
|||||||
// override values.
|
// override values.
|
||||||
let overrideValues = {
|
let overrideValues = {
|
||||||
"box-shadow": {
|
"box-shadow": {
|
||||||
TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
|
"color": testValues.color + " 2px 2px"
|
||||||
},
|
},
|
||||||
"-webkit-box-shadow": {
|
"-webkit-box-shadow": {
|
||||||
TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
|
"color": testValues.color + " 2px 2px"
|
||||||
},
|
},
|
||||||
"scrollbar-color": {
|
"scrollbar-color": {
|
||||||
TYPE_COLOR: testValues.TYPE_COLOR + " " + testValues.TYPE_COLOR,
|
"color": testValues.color + " " + testValues.color,
|
||||||
},
|
},
|
||||||
"text-shadow": {
|
"text-shadow": {
|
||||||
TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
|
"color": testValues.color + " 2px 2px"
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
|
|||||||
}
|
}
|
||||||
|
|
||||||
let supported =
|
let supported =
|
||||||
InspectorUtils.cssPropertySupportsType(propertyName, InspectorUtils[iter]);
|
InspectorUtils.cssPropertySupportsType(propertyName, iter);
|
||||||
let parsed = CSS.supports(propertyName, testValue);
|
let parsed = CSS.supports(propertyName, testValue);
|
||||||
is(supported, parsed, propertyName + " supports " + iter);
|
is(supported, parsed, propertyName + " supports " + iter);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
|
|||||||
// Regression test for an assertion failure in an earlier version of
|
// Regression test for an assertion failure in an earlier version of
|
||||||
// the code. Note that cssPropertySupportsType returns false for
|
// the code. Note that cssPropertySupportsType returns false for
|
||||||
// all types for a variable.
|
// all types for a variable.
|
||||||
ok(!InspectorUtils.cssPropertySupportsType("--variable", InspectorUtils.TYPE_COLOR),
|
ok(!InspectorUtils.cssPropertySupportsType("--variable", "color"),
|
||||||
"cssPropertySupportsType returns false for variable");
|
"cssPropertySupportsType returns false for variable");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -10,7 +10,7 @@ use std::sync::Arc as StdArc;
|
|||||||
|
|
||||||
/// Type of value that a property supports. This is used by Gecko's
|
/// Type of value that a property supports. This is used by Gecko's
|
||||||
/// devtools to make sense about value it parses, and types listed
|
/// devtools to make sense about value it parses, and types listed
|
||||||
/// here should match TYPE_* constants in InspectorUtils.webidl.
|
/// here should match InspectorPropertyType in InspectorUtils.webidl.
|
||||||
///
|
///
|
||||||
/// XXX This should really be a bitflags rather than a namespace mod,
|
/// XXX This should really be a bitflags rather than a namespace mod,
|
||||||
/// but currently we cannot use bitflags in const.
|
/// but currently we cannot use bitflags in const.
|
||||||
|
@ -204,7 +204,7 @@ use style::values::specified;
|
|||||||
use style::values::specified::gecko::IntersectionObserverRootMargin;
|
use style::values::specified::gecko::IntersectionObserverRootMargin;
|
||||||
use style::values::specified::source_size_list::SourceSizeList;
|
use style::values::specified::source_size_list::SourceSizeList;
|
||||||
use style::values::{CustomIdent, KeyframesName};
|
use style::values::{CustomIdent, KeyframesName};
|
||||||
use style_traits::{CssType, CssWriter, ParsingMode, StyleParseErrorKind, ToCss};
|
use style_traits::{CssWriter, ParsingMode, StyleParseErrorKind, ToCss};
|
||||||
|
|
||||||
trait ClosureHelper {
|
trait ClosureHelper {
|
||||||
fn invoke(&self);
|
fn invoke(&self);
|
||||||
@ -1149,20 +1149,10 @@ pub unsafe extern "C" fn Servo_Property_IsInherited(prop_name: *const nsACString
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn Servo_Property_SupportsType(
|
pub unsafe extern "C" fn Servo_Property_SupportsType(
|
||||||
prop_name: *const nsACString,
|
prop_name: *const nsACString,
|
||||||
ty: u32,
|
ty: u8,
|
||||||
found: *mut bool,
|
found: *mut bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let prop_id = parse_enabled_property_name!(prop_name, found, false);
|
let prop_id = parse_enabled_property_name!(prop_name, found, false);
|
||||||
// This should match the constants in InspectorUtils.
|
|
||||||
// (Let's don't bother importing InspectorUtilsBinding into bindings
|
|
||||||
// because it is not used anywhere else, and issue here would be
|
|
||||||
// caught by the property-db test anyway.)
|
|
||||||
let ty = match ty {
|
|
||||||
1 => CssType::COLOR,
|
|
||||||
2 => CssType::GRADIENT,
|
|
||||||
3 => CssType::TIMING_FUNCTION,
|
|
||||||
_ => unreachable!("unknown CSS type {}", ty),
|
|
||||||
};
|
|
||||||
prop_id.supports_type(ty)
|
prop_id.supports_type(ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user