Bug 1382581 - Adapt inspector code to the EventEmitter change in devtools/client/framework; r=pbro.

MozReview-Commit-ID: 7BssAmdv2S0

--HG--
extra : rebase_source : 561b2e161ce42ed2785aa496203691aeb8a3e697
This commit is contained in:
Nicolas Chevobbe 2018-03-14 18:15:42 +01:00
Родитель bd3c73db88
Коммит 22c45c6645
6 изменённых файлов: 22 добавлений и 14 удалений

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

@ -288,10 +288,10 @@ class AnimationInspector {
onSidebarSelect() {
this.update();
this.onSidebarResized(null, this.inspector.getSidebarSize());
this.onSidebarResized(this.inspector.getSidebarSize());
}
onSidebarResized(type, size) {
onSidebarResized(size) {
if (!this.isPanelVisible()) {
return;
}

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

@ -1417,7 +1417,7 @@ function ComputedViewTool(inspector, window) {
this.onMutations = this.onMutations.bind(this);
this.onResized = this.onResized.bind(this);
this.inspector.selection.on("detached-front", this.onSelected);
this.inspector.selection.on("detached-front", this.onDetachedFront);
this.inspector.selection.on("new-node-front", this.onSelected);
this.inspector.selection.on("pseudoclass", this.refresh);
this.inspector.sidebar.on("computedview-selected", this.onPanelSelected);
@ -1438,7 +1438,11 @@ ComputedViewTool.prototype = {
return this.inspector.sidebar.getCurrentTabID() == "computedview";
},
onSelected: function(event) {
onDetachedFront: function() {
this.onSelected(false);
},
onSelected: function(selectElement = true) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
// let the update go through as this is needed to empty the view on
@ -1461,7 +1465,7 @@ ComputedViewTool.prototype = {
return;
}
if (!event || event == "new-node-front") {
if (selectElement) {
let done = this.inspector.updating("computed-view");
this.computedView.selectElement(this.inspector.selection.nodeFront).then(() => {
done();
@ -1511,7 +1515,7 @@ ComputedViewTool.prototype = {
this.inspector.sidebar.off("computedview-selected", this.refresh);
this.inspector.selection.off("pseudoclass", this.refresh);
this.inspector.selection.off("new-node-front", this.onSelected);
this.inspector.selection.off("detached-front", this.onSelected);
this.inspector.selection.off("detached-front", this.onDetachedFront);
this.inspector.sidebar.off("computedview-selected", this.onPanelSelected);
if (this.inspector.pageStyle) {
this.inspector.pageStyle.off("stylesheet-updated", this.refresh);

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

@ -153,7 +153,7 @@ class FontInspector {
/**
* Handler for the "theme-switched" event.
*/
onThemeChanged(event, frame) {
onThemeChanged(frame) {
if (frame === this.document.defaultView) {
this.update();
}

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

@ -1158,7 +1158,7 @@ Inspector.prototype = {
/**
* When a new node is selected.
*/
onNewSelection: function(event, value, reason) {
onNewSelection: function(value, reason) {
if (reason === "selection-destroy") {
return;
}
@ -1253,7 +1253,7 @@ Inspector.prototype = {
* parent is found (may happen when deleting an iframe inside which the
* node was selected).
*/
onDetached: function(event, parentNode) {
onDetached: function(parentNode) {
this.breadcrumbs.cutAfter(this.breadcrumbs.indexOf(parentNode));
this.selection.setNodeFront(parentNode ? parentNode : this._defaultNode, "detached");
},

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

@ -181,7 +181,7 @@ MarkupView.prototype = {
this.imagePreviewTooltip.stopTogglingOnHover();
},
_onToolboxPickerHover: function(event, nodeFront) {
_onToolboxPickerHover: function(nodeFront) {
this.showNode(nodeFront).then(() => {
this._showContainerAsHovered(nodeFront);
}, console.error);

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

@ -1635,7 +1635,7 @@ function RuleViewTool(inspector, window) {
this.onViewRefreshed = this.onViewRefreshed.bind(this);
this.view.on("ruleview-refreshed", this.onViewRefreshed);
this.inspector.selection.on("detached-front", this.onSelected);
this.inspector.selection.on("detached-front", this.onDetachedFront);
this.inspector.selection.on("new-node-front", this.onSelected);
this.inspector.selection.on("pseudoclass", this.refresh);
this.inspector.target.on("navigate", this.clearUserProperties);
@ -1658,7 +1658,11 @@ RuleViewTool.prototype = {
true : this.inspector.sidebar.getCurrentTabID() == "ruleview";
},
onSelected: function(event) {
onDetachedFront: function() {
this.onSelected(false);
},
onSelected: function(selectElement = true) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
// let the update go through as this is needed to empty the view on
@ -1681,7 +1685,7 @@ RuleViewTool.prototype = {
return;
}
if (!event || event == "new-node-front") {
if (selectElement) {
let done = this.inspector.updating("rule-view");
this.view.selectElement(this.inspector.selection.nodeFront)
.then(done, done);
@ -1737,7 +1741,7 @@ RuleViewTool.prototype = {
destroy: function() {
this.inspector.walker.off("mutations", this.onMutations);
this.inspector.walker.off("resize", this.onResized);
this.inspector.selection.off("detached-front", this.onSelected);
this.inspector.selection.off("detached-front", this.onDetachedFront);
this.inspector.selection.off("pseudoclass", this.refresh);
this.inspector.selection.off("new-node-front", this.onSelected);
this.inspector.target.off("navigate", this.clearUserProperties);