mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
parent
c3a7fd56e7
commit
a7474395ec
9 changed files with 90 additions and 32 deletions
|
|
@ -46,6 +46,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.
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue