diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-04 14:35:31 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-04 14:35:31 -0500 |
commit | 7edd685eee95759d66a457cf428f42e0dda94671 (patch) | |
tree | c4514958ea133084552be32d331c115afc509daa /devtools/shared/fronts/css-properties.js | |
parent | 0083d404eff36f873cde465d50cd34b112bd124f (diff) | |
parent | fc7d9fade54dfbe275c4808dabe30a19415082e0 (diff) | |
download | UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.gz UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.lz UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.xz UXP-7edd685eee95759d66a457cf428f42e0dda94671.zip |
Merge branch 'master' into configurebuild-work
Diffstat (limited to 'devtools/shared/fronts/css-properties.js')
-rw-r--r-- | devtools/shared/fronts/css-properties.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/devtools/shared/fronts/css-properties.js b/devtools/shared/fronts/css-properties.js index 9b3172a22..d61bb4b07 100644 --- a/devtools/shared/fronts/css-properties.js +++ b/devtools/shared/fronts/css-properties.js @@ -47,6 +47,20 @@ const CssPropertiesFront = FrontClassWithSpec(cssPropertiesSpec, { }); /** + * Query the feature supporting status in the featureSet. + * + * @param {Hashmap} featureSet the feature set hashmap + * @param {String} feature the feature name string + * @return {Boolean} has the feature or not + */ +function hasFeature(featureSet, feature) { + if (feature in featureSet) { + return featureSet[feature]; + } + return false; +} + +/** * Ask questions to a CSS database. This class does not care how the database * gets loaded in, only the questions that you can ask to it. * Prototype functions are bound to 'this' so they can be passed around as helper @@ -62,10 +76,16 @@ function CssProperties(db) { this.properties = db.properties; this.pseudoElements = db.pseudoElements; + // supported feature + this.cssColor4ColorFunction = hasFeature(db.supportedFeature, + "css-color-4-color-function"); + this.isKnown = this.isKnown.bind(this); this.isInherited = this.isInherited.bind(this); this.supportsType = this.supportsType.bind(this); this.isValidOnClient = this.isValidOnClient.bind(this); + this.supportsCssColor4ColorFunction = + this.supportsCssColor4ColorFunction.bind(this); // A weakly held dummy HTMLDivElement to test CSS properties on the client. this._dummyElements = new WeakMap(); @@ -181,6 +201,15 @@ CssProperties.prototype = { } return []; }, + + /** + * Checking for the css-color-4 color function support. + * + * @return {Boolean} Return true if the server supports css-color-4 color function. + */ + supportsCssColor4ColorFunction() { + return this.cssColor4ColorFunction; + }, }; /** @@ -292,6 +321,11 @@ function normalizeCssData(db) { reattachCssColorValues(db); + // If there is no supportedFeature in db, create an empty one. + if (!db.supportedFeature) { + db.supportedFeature = {}; + } + return db; } |