Bug 1450896 - ensure update picker button is re-rendered when a11y service is enabled/disabled. r=jdescottes

MozReview-Commit-ID: DyVhukiYCfR
This commit is contained in:
Yura Zenevich 2018-04-13 15:04:08 -04:00
parent 10a811163d
commit aa6e7f10e1
2 changed files with 13 additions and 8 deletions

View File

@ -40,6 +40,7 @@ function AccessibilityPanel(iframeWindow, toolbox) {
this.onAccessibilityInspectorUpdated.bind(this);
this.updateA11YServiceDurationTimer = this.updateA11YServiceDurationTimer.bind(this);
this.updatePickerButton = this.updatePickerButton.bind(this);
this.updateToolboxButtons = this.updateToolboxButtons.bind(this);
EventEmitter.decorate(this);
}
@ -130,11 +131,11 @@ AccessibilityPanel.prototype = {
this.cancelPicker();
if (this.isVisible) {
this._front.on("init", this.updatePickerButton);
this._front.on("shutdown", this.updatePickerButton);
this._front.on("init", this.updateToolboxButtons);
this._front.on("shutdown", this.updateToolboxButtons);
} else {
this._front.off("init", this.updatePickerButton);
this._front.off("shutdown", this.updatePickerButton);
this._front.off("init", this.updateToolboxButtons);
this._front.off("shutdown", this.updateToolboxButtons);
// Do not refresh if the panel isn't visible.
return;
}
@ -183,6 +184,10 @@ AccessibilityPanel.prototype = {
this.panelWin.dispatchEvent(event);
},
updateToolboxButtons() {
this._toolbox.updatePickerButton();
},
updatePickerButton() {
this.picker && this.picker.updateButton();
},

View File

@ -155,7 +155,7 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId) {
this._onPickerStopped = this._onPickerStopped.bind(this);
this._onInspectObject = this._onInspectObject.bind(this);
this._onNewSelectedNodeFront = this._onNewSelectedNodeFront.bind(this);
this._updatePickerButton = this._updatePickerButton.bind(this);
this.updatePickerButton = this.updatePickerButton.bind(this);
this.selectTool = this.selectTool.bind(this);
this.toggleSplitConsole = this.toggleSplitConsole.bind(this);
@ -180,7 +180,7 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId) {
this.on("host-changed", this._refreshHostTitle);
this.on("select", this._refreshHostTitle);
this.on("select", this._updatePickerButton);
this.on("select", this.updatePickerButton);
this.on("ready", this._showDevEditionPromo);
@ -1365,7 +1365,7 @@ Toolbox.prototype = {
* update the visual state of the picker button such as disabled state,
* additional CSS classes (className), and tooltip (description).
*/
_updatePickerButton() {
updatePickerButton() {
const button = this.pickerButton;
let currentPanel = this.getCurrentPanel();
@ -2670,7 +2670,7 @@ Toolbox.prototype = {
this._target.off("navigate", this._refreshHostTitle);
this._target.off("frame-update", this._updateFrames);
this.off("select", this._refreshHostTitle);
this.off("select", this._updatePickerButton);
this.off("select", this.updatePickerButton);
this.off("host-changed", this._refreshHostTitle);
this.off("ready", this._showDevEditionPromo);