Bug 1137211 - Move the click handler to the document so we can click on the margins. ui-r=phlsa, r=margaret, r=jaws, a=sledru
authorBlake Winton <bwinton@latte.ca>
Wed, 01 Apr 2015 16:40:08 -0400
changeset 266865 3998197ab5ece1b7be4bd1c67464ec53c66289d6
parent 266864 3e1d92b65592f314efd08a5532fd01176f45b7b0
child 266866 651367982d90cf595d343d33f987b355b2c67503
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphlsa, margaret, jaws, sledru
bugs1137211
milestone39.0a2
Bug 1137211 - Move the click handler to the document so we can click on the margins. ui-r=phlsa, r=margaret, r=jaws, a=sledru
toolkit/components/reader/AboutReader.jsm
toolkit/components/reader/content/aboutReader.html
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -49,17 +49,17 @@ let AboutReader = function(mm, win, arti
   this._titleElementRef = Cu.getWeakReference(doc.getElementById("reader-title"));
   this._creditsElementRef = Cu.getWeakReference(doc.getElementById("reader-credits"));
   this._contentElementRef = Cu.getWeakReference(doc.getElementById("reader-content"));
   this._toolbarElementRef = Cu.getWeakReference(doc.getElementById("reader-toolbar"));
   this._messageElementRef = Cu.getWeakReference(doc.getElementById("reader-message"));
 
   this._scrollOffset = win.pageYOffset;
 
-  doc.getElementById("container").addEventListener("click", this, false);
+  doc.addEventListener("click", this, false);
 
   win.addEventListener("unload", this, false);
   win.addEventListener("scroll", this, false);
   win.addEventListener("resize", this, false);
 
   doc.addEventListener("visibilitychange", this, false);
 
   this._setupStyleDropdown();
@@ -206,17 +206,21 @@ AboutReader.prototype = {
   },
 
   handleEvent: function Reader_handleEvent(aEvent) {
     if (!aEvent.isTrusted)
       return;
 
     switch (aEvent.type) {
       case "click":
-        this._toggleToolbarVisibility();
+        let target = aEvent.target;
+        while (target && target.id != "reader-popup")
+          target = target.parentNode;
+        if (!target)
+          this._toggleToolbarVisibility();
         break;
       case "scroll":
         let isScrollingUp = this._scrollOffset > aEvent.pageY;
         this._setToolbarVisibility(isScrollingUp);
         this._scrollOffset = aEvent.pageY;
         break;
       case "resize":
         this._updateImageMargins();
--- a/toolkit/components/reader/content/aboutReader.html
+++ b/toolkit/components/reader/content/aboutReader.html
@@ -30,17 +30,17 @@
     </div>
   </div>
 
   <ul id="reader-toolbar" class="toolbar">
     <li><button id="close-button" class="button close-button"/></li>
     <li><button id="share-button" class="button share-button"/></li>
     <ul id="style-dropdown" class="dropdown">
       <li><button class="dropdown-toggle button style-button"/></li>
-      <li class="dropdown-popup">
+      <li id="reader-popup" class="dropdown-popup">
         <div id="font-type-buttons"></div>
         <hr></hr>
         <div id="font-size-buttons">
           <button id="font-size-minus" class="minus-button"/>
           <button id="font-size-sample"/>
           <button id="font-size-plus" class="plus-button"/>
         </div>
         <hr></hr>