Bug 925457: Clicking the urlbar should reset tap coordinates to null so we never decide to shift the browser. r=jmathies
authorMarina Samuel <msamuel@mozilla.com>
Tue, 29 Oct 2013 00:17:45 -0400
changeset 152627 cf0615c9546b13efc2bbff29448c228e0c904c31
parent 152626 622032a3228473d3716e3308afd70a20acd38005
child 152628 bc3916e4f4c5b022bbb13e47e75eb94756383994
child 152664 200fa2ac65e4c1d1c947a5cac90e22a9013f07a2
push id25553
push usercbook@mozilla.com
push dateTue, 29 Oct 2013 12:22:52 +0000
treeherdermozilla-central@bc3916e4f4c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs925457
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 925457: Clicking the urlbar should reset tap coordinates to null so we never decide to shift the browser. r=jmathies
browser/metro/base/content/browser.xul
browser/metro/base/content/contenthandlers/SelectionHandler.js
browser/metro/base/content/helperui/SelectionHelperUI.js
--- a/browser/metro/base/content/browser.xul
+++ b/browser/metro/base/content/browser.xul
@@ -233,17 +233,18 @@
             <box id="identity-box" align="center" role="button">
               <image id="identity-icon"/>
             </box>
 
             <textbox id="urlbar-edit" type="url" flex="1"
                      autocompletesearch="history"
                      autocompletepopup="urlbar-autocomplete"
                      completeselectedindex="true"
-                     placeholder="&urlbar.emptytext;"/>
+                     placeholder="&urlbar.emptytext;"
+                     onclick="SelectionHelperUI.urlbarClick();"/>
 
             <toolbarbutton id="go-button" class="urlbar-button"
                            command="cmd_go"/>
             <toolbarbutton id="reload-button" class="urlbar-button"
                            oncommand="CommandUpdater.doCommand(
                                         event.shiftKey ? 'cmd_forceReload'
                                                        : 'cmd_reload');"/>
             <toolbarbutton id="stop-button" class="urlbar-button"
--- a/browser/metro/base/content/contenthandlers/SelectionHandler.js
+++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js
@@ -20,16 +20,17 @@ var SelectionHandler = {
     addMessageListener("Browser:SelectionCopy", this);
     addMessageListener("Browser:SelectionDebug", this);
     addMessageListener("Browser:CaretAttach", this);
     addMessageListener("Browser:CaretMove", this);
     addMessageListener("Browser:CaretUpdate", this);
     addMessageListener("Browser:SelectionSwitchMode", this);
     addMessageListener("Browser:RepositionInfoRequest", this);
     addMessageListener("Browser:SelectionHandlerPing", this);
+    addMessageListener("Browser:ResetLastPos", this);
   },
 
   shutdown: function shutdown() {
     removeMessageListener("Browser:SelectionStart", this);
     removeMessageListener("Browser:SelectionAttach", this);
     removeMessageListener("Browser:SelectionEnd", this);
     removeMessageListener("Browser:SelectionMoveStart", this);
     removeMessageListener("Browser:SelectionMove", this);
@@ -39,16 +40,17 @@ var SelectionHandler = {
     removeMessageListener("Browser:SelectionCopy", this);
     removeMessageListener("Browser:SelectionDebug", this);
     removeMessageListener("Browser:CaretAttach", this);
     removeMessageListener("Browser:CaretMove", this);
     removeMessageListener("Browser:CaretUpdate", this);
     removeMessageListener("Browser:SelectionSwitchMode", this);
     removeMessageListener("Browser:RepositionInfoRequest", this);
     removeMessageListener("Browser:SelectionHandlerPing", this);
+    removeMessageListener("Browser:ResetLastPos", this);
   },
 
   sendAsync: function sendAsync(aMsg, aJson) {
     sendAsyncMessage(aMsg, aJson);
   },
 
   /*************************************************
    * Browser event handlers
@@ -538,16 +540,20 @@ var SelectionHandler = {
         content.setTimeout (function () {
           SelectionHandler._repositionInfoRequest(json);
         }, 50);
         break;
 
       case "Browser:SelectionHandlerPing":
         this._onPing(json.id);
         break;
+
+      case "Browser:ResetLastPos":
+        this._onClickCoords(json.xPos, json.yPos);
+        break;
     }
   },
 
   /*************************************************
    * Utilities
    */
 
   /*
--- a/browser/metro/base/content/helperui/SelectionHelperUI.js
+++ b/browser/metro/base/content/helperui/SelectionHelperUI.js
@@ -787,16 +787,26 @@ var SelectionHelperUI = {
       this.startMark.show();
     }
   },
 
   /*
    * Event handlers for document events
    */
 
+   urlbarClick: function() {
+    // Workaround for bug 925457: taping browser chrome resets last tap
+    // co-ordinates to 'undefined' so that we know not to shift the browser
+    // when the keyboard is up (in SelectionHandler._calcNewContentPosition())
+    Browser.selectedTab.browser.messageManager.sendAsyncMessage("Browser:ResetLastPos", {
+      xPos: null,
+      yPos: null
+    });
+   },
+
   /*
    * Handles taps that move the current caret around in text edits,
    * clear active selection and focus when neccessary, or change
    * modes.
    */
   _onClick: function(aEvent) {
     if (this.layerMode == kChromeLayer && this._targetIsEditable) {
       this.attachToCaret(this._msgTarget, aEvent.clientX, aEvent.clientY);