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 152569 cf0615c9546b13efc2bbff29448c228e0c904c31
parent 152568 622032a3228473d3716e3308afd70a20acd38005
child 152570 200fa2ac65e4c1d1c947a5cac90e22a9013f07a2
child 152631 bc3916e4f4c5b022bbb13e47e75eb94756383994
push id3257
push usermsamuel@mozilla.com
push dateTue, 29 Oct 2013 04:17:56 +0000
treeherderfx-team@cf0615c9546b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs925457
milestone28.0a1
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);