Bug 660887 - Double tap on an empty space on the tab bar should open a new tab [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 06 Oct 2011 21:16:38 -0700
changeset 78704 81d3eb93437d93b4cea9039bf3cebf65c3ad81a1
parent 78703 9cda258f822f73c8942f8b712a6dbf25f15efff5
child 78705 f5f4ab23e499b509bbe17fd68315035470724ac0
push id21326
push userbmo@edmorley.co.uk
push dateFri, 14 Oct 2011 10:00:06 +0000
treeherdermozilla-central@ca73f057dab7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs660887
milestone10.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 660887 - Double tap on an empty space on the tab bar should open a new tab [r=mfinkle]
mobile/chrome/content/browser.xul
mobile/chrome/content/tabs.xml
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -201,16 +201,17 @@
 
   <stack flex="1" id="stack">
     <scrollbox id="controls-scrollbox" style="overflow: hidden; -moz-box-orient: horizontal; position: relative;" flex="1" observes="bcast_urlbarState">
       <vbox id="tabs-sidebar" class="sidebar" observes="bcast_uidiscovery">
         <spacer class="toolbar-height" id="tabs-spacer" observes="bcast_urlbarState"/>
         <!-- Left toolbar -->
         <vbox id="tabs-container" class="panel-dark" flex="1" observes="bcast_urlbarState">
           <vbox id="tabs" flex="1" observes="bcast_urlbarState"
+                ondoubletap="BrowserUI.newTab();"
                 onselect="BrowserUI.selectTab(this);"
                 onreloadtab="BrowserUI.undoCloseTab()"
                 onclosetab="BrowserUI.closeTab(this)"
                 onclosereloadtab="this._container.removeTab(this)"/>
           <hbox id="tabs-controls">
             <toolbarbutton id="newtab-button" class="button-control" command="cmd_newTab" label="&newtab.label;" observes="bcast_urlbarState" crop="end"/>
           </hbox>
         </vbox>
--- a/mobile/chrome/content/tabs.xml
+++ b/mobile/chrome/content/tabs.xml
@@ -6,26 +6,30 @@
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <binding id="documenttab">
     <content observes="bcast_urlbarState">
       <xul:vbox anonid="container" class="documenttab-container" left="0" top="0" observes="bcast_urlbarState">
         <xul:stack anonid="page" flex="1">
           <html:canvas anonid="thumbnail" class="documenttab-thumbnail" left="0" moz-opaque="true" empty="true"
-            onclick="document.getBindingParent(this)._onClick()" observes="bcast_urlbarState"/>
+            observes="bcast_urlbarState"/>
           <xul:hbox anonid="reload" class="documenttab-reload" left="0" top="0" onclick="document.getBindingParent(this)._onUndo();" observes="bcast_urlbarState"/>
           <xul:hbox anonid="close-container" class="documenttab-close-container" top="0" align="center" onclick="document.getBindingParent(this)._onClose()" observes="bcast_urlbarState">
             <xul:image anonid="close" class="documenttab-close" mousethrough="always" observes="bcast_urlbarState"/>
           </xul:hbox>
         </xul:stack>
         <xul:label anonid="title" crop="end" class="documenttab-title" observes="bcast_urlbarState"/>
       </xul:vbox>
     </content>
 
+    <handlers>
+      <handler event="click" clickcount="1" action="this._onClick()"/>
+    </handlers>
+
     <implementation>
       <field name="ignoreUndo">false</field>
       <field name="thumbnail" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "thumbnail");</field>
       <field name="_reload" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "reload");</field>
       <field name="_closeContainer" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "close-container");</field>
       <field name="_title" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "title");</field>
       <field name="_container" readonly="true">this.parentNode.parentNode;</field>
 
@@ -170,16 +174,21 @@
 
   <binding id="tablist">
     <content>
       <xul:scrollbox anonid="tabs-scrollbox" class="tabs-scrollbox" flex="1">
         <xul:vbox class="tabs-list" anonid="tabs-children" />
       </xul:scrollbox>
       <xul:box class="tabs-list" anonid="tabs-undo"/>
     </content>
+
+    <handlers>
+      <handler event="TapDouble" action="this._onDoubleTap();"/>
+    </handlers>
+
     <implementation>
       <field name="children">document.getAnonymousElementByAttribute(this, "anonid", "tabs-children");</field>
       <field name="_scrollbox">document.getAnonymousElementByAttribute(this, "anonid", "tabs-scrollbox");</field>
       <field name="_tabsUndo">document.getAnonymousElementByAttribute(this, "anonid", "tabs-undo");</field>
       <field name="_selectedTab">null</field>
 
       <constructor>
         <![CDATA[
@@ -343,16 +352,24 @@
                 width = window.innerWidth - firstBox.width;
               this._scrollbox.style.width = width + "px";
               this._columnsCount = columnsCount;
             }
           ]]>
         </body>
       </method>
 
+      <method name="_onDoubleTap">
+        <body>
+          <![CDATA[
+            new Function("event", this.getAttribute("ondoubletap")).call();
+          ]]>
+        </body>
+      </method>
+
     </implementation>
   </binding>
 
   <binding id="documenttab-popup" extends="chrome://browser/content/bindings.xml#richlistitem">
     <content>
       <xul:box class="tab-popup-item-box">
         <xul:image class="documenttab-popup-checkmark"/>
         <xul:image class="documenttab-popup-favicon" xbl:inherits="src=img"/>