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 258283 d69e01ecebe0
parent 258282 33496825c683
child 258284 6238a894c78f
push id4634
push userryanvm@gmail.com
push date2015-04-06 16:06 +0000
treeherdermozilla-beta@6238a894c78f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphlsa, margaret, jaws, sledru
bugs1137211
milestone38.0
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>