Bug 524495: Chrome buttons do not always recognize tapping [r=mark.finkle r=webapps]
authorVivien Nicolas <21@vingtetun.org>
Tue, 10 Nov 2009 10:48:37 -0500
changeset 65771 b50303329f22a4362bc1536f05d720584a3ec8c8
parent 65770 df3f47cfa5fb2be43fff526f828ff3bfd812d2b3
child 65772 9b6208fa27bb4cad4e940189a7eb125b62f6fd32
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark, webapps
bugs524495
Bug 524495: Chrome buttons do not always recognize tapping [r=mark.finkle r=webapps]
mobile/chrome/content/InputHandler.js
mobile/chrome/content/browser.js
mobile/chrome/content/browser.xul
mobile/chrome/content/tabs.xml
mobile/themes/hildon/browser.css
mobile/themes/wince/browser.css
--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -503,17 +503,17 @@ MouseModule.prototype = {
                                             : null;
     this._clicker = (targetClicker) ? targetClicker.customClicker : null;
 
     this._owner.grab(this);
 
     if (this._clicker)
       this._clicker.mouseDown(evInfo.event.clientX, evInfo.event.clientY);
 
-    if (targetScrollInterface) {
+    if (targetScrollInterface && this._dragger.isDraggable(targetScrollbox, targetScrollInterface)) {
       this._doDragStart(evInfo.event);
     }
 
     if (this._targetIsContent(evInfo.event)) {
       this._recordEvent(evInfo);
     }
     else if (targetScrollInterface) {
       // do not allow axis locking if panning is only possible in one direction
@@ -736,16 +736,23 @@ MouseModule.prototype = {
   },
 
   /**
    * The default dragger object used by MouseModule when dragging a scrollable
    * element that provides no customDragger.  Simply performs the expected
    * regular scrollBy calls on the scroller.
    */
   _defaultDragger: {
+    isDraggable: function isDraggable(target, scroller) {
+      let sX = {}, sY = {};
+      scroller.getScrolledSize(sX, sY);
+      let rect = target.getBoundingClientRect();
+      return sX.value > rect.width || sY.value > rect.height;
+    },
+
     dragStart: function dragStart(cx, cy, target, scroller) {},
 
     dragStop : function dragStop(dx, dy, scroller) {
       return this.dragMove(dx, dy, scroller);
     },
 
     dragMove : function dragMove(dx, dy, scroller) {
       if (scroller.getPosition) {
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -353,16 +353,17 @@ var Browser = {
     let contentScrollbox = this.contentScrollbox = document.getElementById("content-scrollbox");
     this.contentScrollboxScroller = contentScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
     contentScrollbox.customDragger = new Browser.MainDragger(bv);
 
     /* horizontally scrolling box that holds the sidebars as well as the contentScrollbox */
     let controlsScrollbox = this.controlsScrollbox = document.getElementById("controls-scrollbox");
     this.controlsScrollboxScroller = controlsScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
     controlsScrollbox.customDragger = {
+      isDraggable: function isDraggable(target, content) { return false; },
       dragStart: function dragStart(cx, cy, target, scroller) {},
       dragStop: function dragStop(dx, dy, scroller) { return false; },
       dragMove: function dragMove(dx, dy, scroller) { return false; }
     };
 
     /* vertically scrolling box that contains the url bar, notifications, and content */
     let pageScrollbox = this.pageScrollbox = document.getElementById("page-scrollbox");
     this.pageScrollboxScroller = pageScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
@@ -1204,16 +1205,18 @@ var Browser = {
 
 Browser.MainDragger = function MainDragger(browserView) {
   this.bv = browserView;
   this.draggedFrame = null;
 };
 
 Browser.MainDragger.prototype = {
 
+  isDraggable: function isDraggable(target, scroller) { return true; },
+
   dragStart: function dragStart(clientX, clientY, target, scroller) {
     let [x, y] = Browser.transformClientToBrowser(clientX, clientY);
     let element = Browser.elementFromPoint(x, y);
 
     this.draggedFrame = null;
     if (element)
       this.draggedFrame = element.ownerDocument.defaultView;
 
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -197,17 +197,17 @@
               <toolbar id="toolbar-main" class="panel-dark window-width">
 #ifdef MOZ_PLATFORM_HILDON
                 <toolbarbutton id="tool-app-switch" class="button-image" oncommand="BrowserUI.switchTask();"/>
 #endif
                 <hbox id="urlbar-container" flex="1">
                   <box id="identity-box"
                        onclick="getIdentityHandler().handleIdentityButtonEvent(event);"
                        onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
-                    <box id="urlbar-image-box">
+                    <box id="urlbar-image-box" mousethrough="always">
                       <image id="urlbar-throbber"/>
                       <image id="urlbar-favicon" hidden="true"/>
                     </box>
                   </box>
                   <hbox id="urlbar-editarea" flex="1">
                     <textbox id="urlbar-edit"
                              type="autocomplete"
                              autocompletesearch="history"
--- a/mobile/chrome/content/tabs.xml
+++ b/mobile/chrome/content/tabs.xml
@@ -8,17 +8,17 @@
     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <binding id="documenttab">
     <content>
       <xul:stack anonid="page" class="documenttab-container" flex="1">
         <html:canvas anonid="canvas" class="documenttab-canvas" left="8" width="106" height="64" moz-opaque="true"
           onclick="document.getBindingParent(this)._onClick()"/>
         <xul:hbox left="0" top="10" height="64" align="center" onclick="document.getBindingParent(this)._close()">
-          <xul:image anonid="close" class="documenttab-close"/>
+          <xul:image anonid="close" class="documenttab-close" mousethrough="always"/>
         </xul:hbox>
       </xul:stack>
     </content>
     
    <implementation>
       <method name="_onClick">
         <body>
           <![CDATA[
--- a/mobile/themes/hildon/browser.css
+++ b/mobile/themes/hildon/browser.css
@@ -86,16 +86,17 @@ toolbarbutton.urlbar-button {
 }
 
 /* URL bar cap buttons */
 toolbarbutton.urlbar-cap-button {
   margin: 0;
   padding: 0;
   min-width: 0 !important;
   min-height: 0 !important;
+  -moz-box-flex: 1;
 }
 
 #tool-go {
   list-style-image: url("chrome://browser/skin/images/go-30.png");
 }
 
 #tool-reload {
   list-style-image: url("chrome://browser/skin/images/reload-30.png");
--- a/mobile/themes/wince/browser.css
+++ b/mobile/themes/wince/browser.css
@@ -69,16 +69,17 @@ toolbarbutton.urlbar-button {
 }
 
 /* URL bar cap buttons */
 toolbarbutton.urlbar-cap-button {
   margin: 0;
   padding: 0;
   min-width: 0 !important;
   min-height: 0 !important;
+  -moz-box-flex: 1;
 }
 
 #urlbar-icons[mode="loading"] > #tool-go,
 #urlbar-icons[mode="loading"] > #tool-reload {
   visibility: collapse;
 }
 
 #urlbar-icons[mode="view"] > #tool-go,