зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494162 - Part 28: Lazy initialize TooltipToggle in HTMLTooltip. r=jdescottes
This commit is contained in:
Родитель
c430c4700b
Коммит
2afda0eeae
|
@ -8,9 +8,9 @@
|
|||
|
||||
const Services = require("Services");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {TooltipToggle} = require("devtools/client/shared/widgets/tooltip/TooltipToggle");
|
||||
|
||||
loader.lazyRequireGetter(this, "focusableSelector", "devtools/client/shared/focus", true);
|
||||
loader.lazyRequireGetter(this, "TooltipToggle", "devtools/client/shared/widgets/tooltip/TooltipToggle", true);
|
||||
loader.lazyRequireGetter(this, "getCurrentZoom", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "listenOnce", "devtools/shared/async-utils", true);
|
||||
|
||||
|
@ -329,10 +329,6 @@ function HTMLTooltip(toolboxDoc, {
|
|||
this._onMouseup = this._onMouseup.bind(this);
|
||||
this._onXulPanelHidden = this._onXulPanelHidden.bind(this);
|
||||
|
||||
this._toggle = new TooltipToggle(this);
|
||||
this.startTogglingOnHover = this._toggle.start.bind(this._toggle);
|
||||
this.stopTogglingOnHover = this._toggle.stop.bind(this._toggle);
|
||||
|
||||
this.container = this._createContainer();
|
||||
|
||||
if (this.useXulWrapper) {
|
||||
|
@ -380,6 +376,14 @@ HTMLTooltip.prototype = {
|
|||
return this.isVisible() ? this._position : null;
|
||||
},
|
||||
|
||||
get toggle() {
|
||||
if (!this._toggle) {
|
||||
this._toggle = new TooltipToggle(this);
|
||||
}
|
||||
|
||||
return this._toggle;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the preferred width/height of the panel content.
|
||||
* The panel content is set by appending content to `this.panel`.
|
||||
|
@ -449,6 +453,14 @@ HTMLTooltip.prototype = {
|
|||
}, 0);
|
||||
},
|
||||
|
||||
startTogglingOnHover(baseNode, targetNodeCb, options) {
|
||||
this.toggle.start(baseNode, targetNodeCb, options);
|
||||
},
|
||||
|
||||
stopTogglingOnHover() {
|
||||
this.toggle.stop();
|
||||
},
|
||||
|
||||
/**
|
||||
* Recalculate the dimensions and position of the tooltip in response to
|
||||
* changes to its content.
|
||||
|
@ -736,7 +748,10 @@ HTMLTooltip.prototype = {
|
|||
if (this.xulPanelWrapper) {
|
||||
this.xulPanelWrapper.remove();
|
||||
}
|
||||
this._toggle.destroy();
|
||||
if (this._toggle) {
|
||||
this._toggle.destroy();
|
||||
this._toggle = null;
|
||||
}
|
||||
},
|
||||
|
||||
_createContainer: function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче