Bug 1224504 - Use the same variable name in CssComputedView than in CssRuleView for inspected element. r=jdescottes

MozReview-Commit-ID: 7U4YYqdR7nZ

--HG--
extra : transplant_source : %07p%F4%85%F6%C3%E8%C6%7D%0D%98%E0%DA%9BK%98%9CqG%D9
This commit is contained in:
Nicolas Chevobbe 2016-06-20 18:22:20 +02:00
Родитель 213fc9c79b
Коммит 5bd03405ba
2 изменённых файлов: 17 добавлений и 17 удалений

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

@ -205,7 +205,7 @@ function CssComputedView(inspector, document, pageStyle) {
this._prefObserver.on(PREF_ORIG_SOURCES, this._onSourcePrefChanged);
// The element that we're inspecting, and the document that it comes from.
this.viewedElement = null;
this._viewedElement = null;
this.createStyleViews();
@ -276,7 +276,7 @@ CssComputedView.prototype = {
*/
selectElement: function (element) {
if (!element) {
this.viewedElement = null;
this._viewedElement = null;
this.noResults.hidden = false;
if (this._refreshProcess) {
@ -289,11 +289,11 @@ CssComputedView.prototype = {
return promise.resolve(undefined);
}
if (element === this.viewedElement) {
if (element === this._viewedElement) {
return promise.resolve(undefined);
}
this.viewedElement = element;
this._viewedElement = element;
this.refreshSourceFilter();
return this.refreshPanel();
@ -435,23 +435,23 @@ CssComputedView.prototype = {
* Refresh the panel content.
*/
refreshPanel: function () {
if (!this.viewedElement) {
if (!this._viewedElement) {
return promise.resolve();
}
// Capture the current viewed element to return from the promise handler
// early if it changed
let viewedElement = this.viewedElement;
let viewedElement = this._viewedElement;
return promise.all([
this._createPropertyViews(),
this.pageStyle.getComputed(this.viewedElement, {
this.pageStyle.getComputed(this._viewedElement, {
filter: this._sourceFilter,
onlyMatched: !this.includeBrowserStyles,
markMatched: true
})
]).then(([, computed]) => {
if (viewedElement !== this.viewedElement) {
if (viewedElement !== this._viewedElement) {
return promise.resolve();
}
@ -738,7 +738,7 @@ CssComputedView.prototype = {
* Destructor for CssComputedView.
*/
destroy: function () {
this.viewedElement = null;
this._viewedElement = null;
this._outputParser = null;
gDevTools.off("pref-changed", this._handlePrefChange);
@ -857,7 +857,7 @@ PropertyView.prototype = {
_matchedSelectorViews: null,
// The previously selected element used for the selector view caches
prevViewedElement: null,
_prevViewedElement: null,
/**
* Get the computed style for the current property.
@ -887,7 +887,7 @@ PropertyView.prototype = {
* Should this property be visible?
*/
get visible() {
if (!this.tree.viewedElement) {
if (!this.tree._viewedElement) {
return false;
}
@ -1017,12 +1017,12 @@ PropertyView.prototype = {
this.element.className = this.propertyHeaderClassName;
this.element.nextElementSibling.className = this.propertyContentClassName;
if (this.prevViewedElement !== this.tree.viewedElement) {
if (this._prevViewedElement !== this.tree._viewedElement) {
this._matchedSelectorViews = null;
this.prevViewedElement = this.tree.viewedElement;
this._prevViewedElement = this.tree._viewedElement;
}
if (!this.tree.viewedElement || !this.visible) {
if (!this.tree._viewedElement || !this.visible) {
this.valueNode.textContent = this.valueNode.title = "";
this.matchedSelectorsContainer.parentNode.hidden = true;
this.matchedSelectorsContainer.textContent = "";
@ -1062,7 +1062,7 @@ PropertyView.prototype = {
if (this.matchedExpanded && hasMatchedSelectors) {
return this.tree.pageStyle
.getMatchedSelectors(this.tree.viewedElement, this.name)
.getMatchedSelectors(this.tree._viewedElement, this.name)
.then(matched => {
if (!this.matchedExpanded) {
return promise.resolve(undefined);
@ -1474,7 +1474,7 @@ ComputedViewTool.prototype = {
},
onPanelSelected: function () {
if (this.inspector.selection.nodeFront === this.view.viewedElement) {
if (this.inspector.selection.nodeFront === this.view._viewedElement) {
this.refresh();
} else {
this.onSelected();

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

@ -22,7 +22,7 @@ function* testMatchedSelectors(view, inspector) {
info("checking selector counts, matched rules and titles");
let nodeFront = yield getNodeFront("#test", inspector);
is(nodeFront, view.viewedElement,
is(nodeFront, view._viewedElement,
"style inspector node matches the selected node");
let propertyView = new PropertyView(view, "color");