Bug 1486074 - Move logic for copying aliased properties' fields to the bottom of property_database.js. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D4247

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2018-08-24 19:05:18 +00:00
parent c9437b2c8e
commit 987c1af77f

View file

@ -7949,34 +7949,6 @@ if (IsCSSPropertyPrefEnabled("layout.css.text-align-unsafe-value.enabled")) {
gCSSProperties["display"].other_values.push("flow-root"); gCSSProperties["display"].other_values.push("flow-root");
// Copy aliased properties' fields from their alias targets.
for (var prop in gCSSProperties) {
var entry = gCSSProperties[prop];
if (entry.alias_for) {
var aliasTargetEntry = gCSSProperties[entry.alias_for];
if (!aliasTargetEntry) {
ok(false,
"Alias '" + prop + "' alias_for field, '" + entry.alias_for + "', " +
"must be set to a recognized CSS property in gCSSProperties");
} else {
// Copy 'values' fields & 'prerequisites' field from aliasTargetEntry:
var fieldsToCopy =
["initial_values", "other_values", "invalid_values",
"quirks_values", "unbalanced_values",
"prerequisites"];
fieldsToCopy.forEach(function(fieldName) {
// (Don't copy the field if the alias already has something there,
// or if the aliased property doesn't have anything to copy.)
if (!(fieldName in entry) &&
fieldName in aliasTargetEntry) {
entry[fieldName] = aliasTargetEntry[fieldName]
}
});
}
}
}
if (IsCSSPropertyPrefEnabled("layout.css.column-span.enabled")) { if (IsCSSPropertyPrefEnabled("layout.css.column-span.enabled")) {
gCSSProperties["column-span"] = { gCSSProperties["column-span"] = {
domProp: "columnSpan", domProp: "columnSpan",
@ -8205,3 +8177,34 @@ if (IsCSSPropertyPrefEnabled("layout.css.overflow.moz-scrollbars.enabled")) {
} else { } else {
gCSSProperties["overflow"].invalid_values.push(...OVERFLOW_MOZKWS); gCSSProperties["overflow"].invalid_values.push(...OVERFLOW_MOZKWS);
} }
// Copy aliased properties' fields from their alias targets. Keep this logic
// at the bottom of this file to ensure all the aliased properties are
// processed.
for (var prop in gCSSProperties) {
var entry = gCSSProperties[prop];
if (entry.alias_for) {
var aliasTargetEntry = gCSSProperties[entry.alias_for];
if (!aliasTargetEntry) {
ok(false,
"Alias '" + prop + "' alias_for field, '" + entry.alias_for + "', " +
"must be set to a recognized CSS property in gCSSProperties");
} else {
// Copy 'values' fields & 'prerequisites' field from aliasTargetEntry:
var fieldsToCopy =
["initial_values", "other_values", "invalid_values",
"quirks_values", "unbalanced_values",
"prerequisites"];
fieldsToCopy.forEach(function(fieldName) {
// (Don't copy the field if the alias already has something there,
// or if the aliased property doesn't have anything to copy.)
if (!(fieldName in entry) &&
fieldName in aliasTargetEntry) {
entry[fieldName] = aliasTargetEntry[fieldName]
}
});
}
}
}