summaryrefslogtreecommitdiffstats
path: root/devtools/shared/fronts
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-02 20:51:18 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-02 20:51:18 +0100
commitf3aeeab64f6a5ae0639805b2c71e13323258e2c1 (patch)
tree587f41772c47f6661815ae7f8dec6a3e49389bde /devtools/shared/fronts
parent9627f18cebab38cdfe45592d83371ee7bbc62cfa (diff)
downloadUXP-f3aeeab64f6a5ae0639805b2c71e13323258e2c1.tar
UXP-f3aeeab64f6a5ae0639805b2c71e13323258e2c1.tar.gz
UXP-f3aeeab64f6a5ae0639805b2c71e13323258e2c1.tar.lz
UXP-f3aeeab64f6a5ae0639805b2c71e13323258e2c1.tar.xz
UXP-f3aeeab64f6a5ae0639805b2c71e13323258e2c1.zip
Support for css-color-4 (finish)
Issue #4
Diffstat (limited to 'devtools/shared/fronts')
-rw-r--r--devtools/shared/fronts/css-properties.js34
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;
}