Backed out changeset 63ace982aa7e (bug 1192421) for DT2 bustage

This commit is contained in:
Nigel Babu 2015-09-08 12:21:55 +05:30
Родитель e4d87b70f7
Коммит e83114aefe
1 изменённых файлов: 19 добавлений и 25 удалений

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

@ -1556,7 +1556,9 @@ CssRuleView.prototype = {
// Reselect the currently selected element
let refreshOnPrefs = [PREF_UA_STYLES, PREF_DEFAULT_COLOR_UNIT];
if (refreshOnPrefs.indexOf(pref) > -1) {
this.selectElement(this._viewedElement, true);
let element = this._viewedElement;
this._viewedElement = null;
this.selectElement(element);
}
},
@ -1769,12 +1771,9 @@ CssRuleView.prototype = {
*
* @param {NodeActor} element
* The node whose style rules we'll inspect.
* @param {Boolean} allowRefresh
* Update the view even if the element is the same as last time.
*/
selectElement: function(element, allowRefresh = false) {
let refresh = (this._viewedElement === element);
if (refresh && !allowRefresh) {
selectElement: function(element) {
if (this._viewedElement === element) {
return promise.resolve(undefined);
}
@ -1782,14 +1781,13 @@ CssRuleView.prototype = {
this.popup.hidePopup();
}
this.clear(false);
this._viewedElement = element;
this.clear();
this.clearPseudoClassPanel();
this._viewedElement = element;
this.refreshAddRuleButtonState();
if (!this._viewedElement) {
this._clearRules();
this._showEmpty();
this.refreshPseudoClassPanel();
return promise.resolve(undefined);
@ -1804,17 +1802,11 @@ CssRuleView.prototype = {
}
}).then(() => {
if (this._viewedElement === element) {
if (!refresh) {
this.element.scrollTop = 0;
}
this._elementStyle.onChanged = () => {
this._changed();
};
}
}).then(null, e => {
this._clearRules();
console.error(e);
});
}).then(null, console.error);
},
/**
@ -1835,7 +1827,7 @@ CssRuleView.prototype = {
}
return promise.all(promises).then(() => {
return this._populate();
return this._populate(true);
});
},
@ -1878,14 +1870,16 @@ CssRuleView.prototype = {
}
},
_populate: function() {
_populate: function(clearRules = false) {
let elementStyle = this._elementStyle;
return this._elementStyle.populate().then(() => {
if (this._elementStyle !== elementStyle || this.isDestroyed) {
return;
}
this._clearRules();
if (clearRules) {
this._clearRules();
}
this._createEditors();
this.refreshPseudoClassPanel();
@ -1913,18 +1907,18 @@ CssRuleView.prototype = {
* Clear the rules.
*/
_clearRules: function() {
this.element.innerHTML = "";
while (this.element.hasChildNodes()) {
this.element.removeChild(this.element.lastChild);
}
},
/**
* Clear the rule view.
*/
clear: function(clearDom = true) {
clear: function() {
this.lastSelectorIcon = null;
if (clearDom) {
this._clearRules();
}
this._clearRules();
this._viewedElement = null;
if (this._elementStyle) {