diff --git a/browser/metro/base/content/helperui/ChromeSelectionHandler.js b/browser/metro/base/content/helperui/ChromeSelectionHandler.js index 9a24afb1a1bf..35aaffae1128 100644 --- a/browser/metro/base/content/helperui/ChromeSelectionHandler.js +++ b/browser/metro/base/content/helperui/ChromeSelectionHandler.js @@ -272,6 +272,14 @@ var ChromeSelectionHandler = { this.sendAsync("Content:HandlerShutdown", {}); }, + get hasSelection() { + if (!this._targetElement) { + return false; + } + let selection = this._getSelection(); + return (selection && !selection.isCollapsed); + }, + /************************************************* * Events */ diff --git a/browser/metro/base/content/helperui/SelectionHelperUI.js b/browser/metro/base/content/helperui/SelectionHelperUI.js index e9dd6085135c..8bdbc2af0354 100644 --- a/browser/metro/base/content/helperui/SelectionHelperUI.js +++ b/browser/metro/base/content/helperui/SelectionHelperUI.js @@ -525,6 +525,7 @@ var SelectionHelperUI = { Elements.browsers.addEventListener("ZoomChanged", this, true); Elements.navbar.addEventListener("transitionend", this, true); + Elements.navbar.addEventListener("MozAppbarDismissing", this, true); this.overlay.enabled = true; }, @@ -551,6 +552,7 @@ var SelectionHelperUI = { Elements.browsers.removeEventListener("ZoomChanged", this, true); Elements.navbar.removeEventListener("transitionend", this, true); + Elements.navbar.removeEventListener("MozAppbarDismissing", this, true); this._shutdownAllMarkers(); @@ -897,9 +899,23 @@ var SelectionHelperUI = { if (this.layerMode == kContentLayer) { return; } + if (aEvent.propertyName == "bottom" && Elements.navbar.isShowing) { this._sendAsyncMessage("Browser:SelectionUpdate", {}); + return; } + + if (aEvent.propertyName == "transform" && Elements.navbar.isShowing) { + this._sendAsyncMessage("Browser:SelectionUpdate", {}); + this._showMonocles(ChromeSelectionHandler.hasSelection); + } + }, + + _onNavBarDismissEvent: function _onNavBarDismissEvent() { + if (!this.isActive || this.layerMode == kContentLayer) { + return; + } + this._hideMonocles(); }, /* @@ -1051,6 +1067,10 @@ var SelectionHelperUI = { case "transitionend": this._onNavBarTransitionEvent(aEvent); break; + + case "MozAppbarDismissing": + this._onNavBarDismissEvent(); + break; } },