diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-02-04 19:51:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 19:51:18 +0100 |
commit | fc7d9fade54dfbe275c4808dabe30a19415082e0 (patch) | |
tree | ff92eea0fc9df0be321cd4be0e17f653684f4084 /devtools/shared/fronts/css-properties.js | |
parent | 34cdbd1366224f040136c3a747709ae5e92f5956 (diff) | |
parent | f3aeeab64f6a5ae0639805b2c71e13323258e2c1 (diff) | |
download | UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.gz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.lz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.xz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.zip |
Merge pull request #7 from janekptacijarabaci/devtools_inspector_cssColor4_1
Support for css-color-4 (finish)
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; } |