Bug 1040697 - Prevent rule view marking all new properties as overridden r=bgrins

This commit is contained in:
Michael Ratcliffe 2014-07-20 22:50:41 +01:00
Родитель f90ed6e02a
Коммит 381da47fb7
2 изменённых файлов: 20 добавлений и 9 удалений

Просмотреть файл

@ -996,15 +996,25 @@ TextProperty.prototype = {
dummyStyle.setProperty(this.name, this.value, this.priority);
this.computed = [];
for (let i = 0, n = dummyStyle.length; i < n; i++) {
let prop = dummyStyle.item(i);
this.computed.push({
textProp: this,
name: prop,
value: dummyStyle.getPropertyValue(prop),
priority: dummyStyle.getPropertyPriority(prop),
});
}
try {
// Manually get all the properties that are set when setting a value on
// this.name and check the computed style on dummyElement for each one.
// If we just read dummyStyle, it would skip properties when value == "".
let subProps = domUtils.getSubpropertiesForCSSProperty(this.name);
for (let prop of subProps) {
this.computed.push({
textProp: this,
name: prop,
value: dummyStyle.getPropertyValue(prop),
priority: dummyStyle.getPropertyPriority(prop),
});
}
} catch(e) {
// This is a partial property name, probably from cutting and pasting
// text. At this point don't check for computed properties.
}
},
/**

Просмотреть файл

@ -74,5 +74,6 @@ function* testCreateNew(view) {
yield onModifications;
is(textProp.value, "#XYZ", "Text prop should have been changed.");
is(textProp.overridden, false, "Property should not be overridden");
is(textProp.editor.isValid(), false, "#XYZ should not be a valid entry");
}