Bug 1226238 - (Part 3) Remove reading list button from reader view. r=Gijs draft
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 22 Feb 2016 10:29:48 -0500
changeset 333085 f12c095c9c7372a736dbdcda9db4932e09cafcd6
parent 333084 4e110d8b76506b46268e53dc0692c976b1605c42
child 333086 0e3a8573e9e1fcf20d2e3b913de1b137745435cb
push id11259
push usermleibovic@mozilla.com
push dateMon, 22 Feb 2016 17:08:37 +0000
reviewersGijs
bugs1226238
milestone47.0a1
Bug 1226238 - (Part 3) Remove reading list button from reader view. r=Gijs MozReview-Commit-ID: 4QmGlGH8ELA
mobile/android/themes/core/aboutReaderControls.css
toolkit/components/reader/AboutReader.jsm
toolkit/components/reader/content/aboutReader.html
toolkit/locales/en-US/chrome/global/aboutReader.properties
toolkit/themes/shared/aboutReaderControls.css
toolkit/themes/shared/jar.inc.mn
toolkit/themes/shared/reader/RM-Reading-List-24x24.svg
--- a/mobile/android/themes/core/aboutReaderControls.css
+++ b/mobile/android/themes/core/aboutReaderControls.css
@@ -235,18 +235,17 @@
 .light-button {
   color: #333333;
   background-color: #ffffff;
 }
 
 /*======= Toolbar icons =======*/
 
 /* desktop-only controls */
-.close-button,
-.list-button {
+.close-button {
   display: none;
 }
 
 .toggle-button.on {
   background-image: url('chrome://browser/skin/images/reader-toggle-on-icon-mdpi.png');
 }
 
 .toggle-button {
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -11,18 +11,16 @@ this.EXPORTED_SYMBOLS = [ "AboutReader" 
 Cu.import("resource://gre/modules/ReaderMode.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Rect", "resource://gre/modules/Geometry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
 
-const READINGLIST_COMMAND_ID = "readingListSidebar";
-
 var gStrings = Services.strings.createBundle("chrome://global/locale/aboutReader.properties");
 
 var AboutReader = function(mm, win, articlePromise) {
   let url = this._getOriginalUrl(win);
   if (!(url.startsWith("http://") || url.startsWith("https://"))) {
     let errorMsg = "Only http:// and https:// URLs can be loaded in about:reader.";
     if (Services.prefs.getBoolPref("reader.errors.includeURLs"))
       errorMsg += " Tried to load: " + url + ".";
@@ -31,18 +29,16 @@ var AboutReader = function(mm, win, arti
     return;
   }
 
   let doc = win.document;
 
   this._mm = mm;
   this._mm.addMessageListener("Reader:Added", this);
   this._mm.addMessageListener("Reader:Removed", this);
-  this._mm.addMessageListener("Sidebar:VisibilityChange", this);
-  this._mm.addMessageListener("ReadingList:VisibilityStatus", this);
   this._mm.addMessageListener("Reader:CloseDropdown", this);
   this._mm.addMessageListener("Reader:AddButton", this);
   this._mm.addMessageListener("Reader:RemoveButton", this);
 
   this._docRef = Cu.getWeakReference(doc);
   this._winRef = Cu.getWeakReference(win);
 
   this._article = null;
@@ -70,17 +66,16 @@ var AboutReader = function(mm, win, arti
   doc.addEventListener("visibilitychange", this, false);
 
   this._setupStyleDropdown();
   this._setupButton("close-button", this._onReaderClose.bind(this), "aboutReader.toolbar.close");
 
   try {
     if (Services.prefs.getBoolPref("browser.readinglist.enabled")) {
       this._setupButton("toggle-button", this._onReaderToggle.bind(this, "button"), "aboutReader.toolbar.addToReadingList");
-      this._setupButton("list-button", this._onList.bind(this), "aboutReader.toolbar.openReadingList");
     }
   } catch (e) {
     // Pref doesn't exist.
   }
 
   const gIsFirefoxDesktop = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
   if (gIsFirefoxDesktop) {
     // we're ready for any external setup, send a signal for that.
@@ -116,19 +111,16 @@ var AboutReader = function(mm, win, arti
   this._setFontType(fontType);
 
   this._setupFontSizeButtons();
 
   // Track status of reader toolbar add/remove toggle button
   this._isReadingListItem = -1;
   this._updateToggleButton();
 
-  // Setup initial ReadingList button styles.
-  this._updateListButton();
-
   this._loadArticle();
 }
 
 AboutReader.prototype = {
   _BLOCK_IMAGES_SELECTOR: ".content p > img:only-child, " +
                           ".content p > a:only-child > img:only-child, " +
                           ".content .wp-caption img, " +
                           ".content figure img",
@@ -234,30 +226,16 @@ AboutReader.prototype = {
       }
       case "Reader:RemoveButton": {
         if (message.data.id) {
           let btn = this._doc.getElementById(message.data.id);
           btn.remove();
         }
         break;
       }
-
-      // Notifys us of Sidebar updates, user clicks X to close,
-      // checks View -> Sidebar -> (Bookmarks, Histroy, Readinglist, etc).
-      case "Sidebar:VisibilityChange": {
-        let data = message.data;
-        this._updateListButtonStyle(data.isOpen && data.commandID === READINGLIST_COMMAND_ID);
-        break;
-      }
-
-      // Returns requested status of current ReadingList Sidebar.
-      case "ReadingList:VisibilityStatus": {
-        this._updateListButtonStyle(message.data.isOpen);
-        break;
-      }
     }
   },
 
   handleEvent: function(aEvent) {
     if (!aEvent.isTrusted)
       return;
 
     switch (aEvent.type) {
@@ -286,18 +264,16 @@ AboutReader.prototype = {
         break;
 
       case "unload":
         // Close the Banners Font-dropdown, cleanup Android BackPressListener.
         this._closeDropdown();
 
         this._mm.removeMessageListener("Reader:Added", this);
         this._mm.removeMessageListener("Reader:Removed", this);
-        this._mm.removeMessageListener("Sidebar:VisibilityChange", this);
-        this._mm.removeMessageListener("ReadingList:VisibilityStatus", this);
         this._mm.removeMessageListener("Reader:CloseDropdown", this);
         this._mm.removeMessageListener("Reader:AddButton", this);
         this._mm.removeMessageListener("Reader:RemoveButton", this);
         this._windowUnloaded = true;
         break;
     }
   },
 
@@ -353,60 +329,16 @@ AboutReader.prototype = {
       this._mm.sendAsyncMessage("Reader:AddToList", { article: this._article });
       UITelemetry.addEvent("save.1", aMethod, null, "reading_list");
     } else {
       this._mm.sendAsyncMessage("Reader:RemoveFromList", { url: this._article.url });
       UITelemetry.addEvent("unsave.1", aMethod, null, "reading_list");
     }
   },
 
-  /**
-   * To help introduce ReadingList, we want to automatically
-   * open the Desktop sidebar the first time ReaderMode is used.
-   */
-  _showListIntro: function() {
-    this._mm.sendAsyncMessage("ReadingList:ShowIntro");
-  },
-
-  /**
-   * Toggle ReadingList Sidebar visibility. SidebarUI will trigger
-   * _updateListButtonStyle().
-   */
-  _onList: function() {
-    this._mm.sendAsyncMessage("ReadingList:ToggleVisibility");
-  },
-
-  /**
-   * Request ReadingList Sidebar-button visibility status update.
-   * Only desktop currently responds to this message.
-   */
-  _updateListButton: function() {
-    this._mm.sendAsyncMessage("ReadingList:GetVisibility");
-  },
-
-  /**
-   * Update ReadingList toggle button styles.
-   * @param   isVisible
-   *          What Sidebar ReadingList visibility style the List
-   *          toggle-button should be set to reflect, and what
-   *          button-action the tip will provide.
-   */
-  _updateListButtonStyle: function(isVisible) {
-    let classes = this._doc.getElementById("list-button").classList;
-    if (isVisible) {
-      classes.add("on");
-      // When on, action tip is "close".
-      this._setButtonTip("list-button", "aboutReader.toolbar.closeReadingList");
-    } else {
-      classes.remove("on");
-      // When off, action tip is "open".
-      this._setButtonTip("list-button", "aboutReader.toolbar.openReadingList");
-    }
-  },
-
   _setFontSize: function(newFontSize) {
     let containerClasses = this._doc.getElementById("container").classList;
 
     if (this._fontSize > 0)
       containerClasses.remove("font-size" + this._fontSize);
 
     this._fontSize = newFontSize;
     containerClasses.add("font-size" + this._fontSize);
@@ -500,21 +432,16 @@ AboutReader.prototype = {
     this._updateColorScheme(averageLuxValue);
     // Pop the oldest value off the array.
     let oldLux = this._luxValues.pop();
     // Subtract oldLux since it has been discarded from the array.
     this._totalLux -= oldLux;
   },
 
   _handleVisibilityChange: function() {
-    // ReadingList / Sidebar state might change while we're not the selected tab.
-    if (this._doc.visibilityState === "visible") {
-      this._updateListButton();
-    }
-
     let colorScheme = Services.prefs.getCharPref("reader.color_scheme");
     if (colorScheme != "auto") {
       return;
     }
 
     // Turn off the ambient light sensor if the page is hidden
     this._enableAmbientLighting(!this._doc.hidden);
   },
@@ -782,17 +709,16 @@ AboutReader.prototype = {
     this._contentElement.innerHTML = "";
     this._contentElement.appendChild(contentFragment);
     this._maybeSetTextDirection(article);
 
     this._contentElement.style.display = "block";
     this._updateImageMargins();
     this._requestReadingListStatus();
 
-    this._showListIntro();
     this._requestFavicon();
     this._doc.body.classList.add("loaded");
 
     Services.obs.notifyObservers(null, "AboutReader:Ready", "");
   },
 
   _hideContent: function() {
     this._headerElement.style.display = "none";
--- a/toolkit/components/reader/content/aboutReader.html
+++ b/toolkit/components/reader/content/aboutReader.html
@@ -53,14 +53,13 @@
           <button id="font-size-plus" class="plus-button"/>
         </div>
         <hr></hr>
         <div id="color-scheme-buttons"></div>
         <div class="dropdown-arrow"/>
       </li>
     </ul>
     <li><button id="toggle-button" class="button toggle-button" hidden="true"/></li>
-    <li><button id="list-button" class="button list-button" hidden="true"/></li>
   </ul>
 
 </body>
 
 </html>
--- a/toolkit/locales/en-US/chrome/global/aboutReader.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutReader.properties
@@ -20,17 +20,15 @@ aboutReader.fontType.sans-serif=Sans-ser
 
 # LOCALIZATION NOTE (aboutReader.fontTypeSample): String used to sample font types.
 aboutReader.fontTypeSample=Aa
 
 aboutReader.toolbar.close=Close Reader View
 aboutReader.toolbar.typeControls=Type controls
 aboutReader.toolbar.addToReadingList=Add to Reading List
 aboutReader.toolbar.removeFromReadingList=Remove from Reading List
-aboutReader.toolbar.openReadingList=Open Reading List
-aboutReader.toolbar.closeReadingList=Close Reading List
 
 # These are used for the Reader View toolbar button and the menuitem within the
 # View menu.
 readerView.enter=Enter Reader View
 readerView.enter.accesskey=R
 readerView.close=Close Reader View
 readerView.close.accesskey=R
--- a/toolkit/themes/shared/aboutReaderControls.css
+++ b/toolkit/themes/shared/aboutReaderControls.css
@@ -329,23 +329,16 @@
 .toggle-button.on {
   background-image: url("chrome://global/skin/reader/RM-Delete-24x24.svg");
 }
 
 .toggle-button {
   background-image: url("chrome://global/skin/reader/RM-Add-24x24.svg");
 }
 
-.list-button {
-  background-image: url("chrome://global/skin/reader/RM-Reading-List-24x24.svg");
-}
-.list-button.on {
-  background-color: #d9d9d9;
-}
-
 .minus-button {
   background-image: url("chrome://global/skin/reader/RM-Minus-24x24.svg");
 }
 
 .plus-button {
   background-image: url("chrome://global/skin/reader/RM-Plus-24x24.svg");
 }
 
--- a/toolkit/themes/shared/jar.inc.mn
+++ b/toolkit/themes/shared/jar.inc.mn
@@ -36,12 +36,11 @@ toolkit.jar:
   skin/classic/global/in-content/dropdown.svg              (../../shared/in-content/dropdown.svg)
   skin/classic/global/in-content/help-glyph.svg            (../../shared/in-content/help-glyph.svg)
   skin/classic/global/in-content/radio.svg                 (../../shared/in-content/radio.svg)
   skin/classic/global/reader/RM-Add-24x24.svg              (../../shared/reader/RM-Add-24x24.svg)
   skin/classic/global/reader/RM-Close-24x24.svg            (../../shared/reader/RM-Close-24x24.svg)
   skin/classic/global/reader/RM-Delete-24x24.svg           (../../shared/reader/RM-Delete-24x24.svg)
   skin/classic/global/reader/RM-Minus-24x24.svg            (../../shared/reader/RM-Minus-24x24.svg)
   skin/classic/global/reader/RM-Plus-24x24.svg             (../../shared/reader/RM-Plus-24x24.svg)
-  skin/classic/global/reader/RM-Reading-List-24x24.svg     (../../shared/reader/RM-Reading-List-24x24.svg)
   skin/classic/global/reader/RM-Type-Controls-24x24.svg    (../../shared/reader/RM-Type-Controls-24x24.svg)
   skin/classic/global/reader/RM-Type-Controls-Arrow.svg    (../../shared/reader/RM-Type-Controls-Arrow.svg)
 
deleted file mode 100644
--- a/toolkit/themes/shared/reader/RM-Reading-List-24x24.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
-  <rect x="8" y="10" fill="#808080" width="14" height="4"/>
-  <rect x="8" y="16" fill="#808080" width="14" height="4"/>
-  <rect x="8" y="4" fill="#808080" width="14" height="4"/>
-  <circle fill="#808080" cx="4" cy="6" r="2"/>
-  <circle fill="#808080" cx="4" cy="12" r="2"/>
-  <circle fill="#808080" cx="4" cy="18" r="2"/>
-</svg>