Bug 561054 - No search icon or text on global search bar. This brings them back for linux and windows with a transient blankage and italics-flex complication fix. a=bustage-fix
authorAndrew Sutherland <asutherland@asutherland.org>
Thu, 22 Apr 2010 19:08:16 -0700
changeset 5518 9759a8e7417fb65bde3430e1f260ec154f04d5de
parent 5517 b4b8c96d6dbdda6ef195b0f4af31f79e5205d97f
child 5519 2974e8b4fb57419b249c8c64a88a9e0728bf1d7b
push idunknown
push userunknown
push dateunknown
reviewersbustage-fix
bugs561054
Bug 561054 - No search icon or text on global search bar. This brings them back for linux and windows with a transient blankage and italics-flex complication fix. a=bustage-fix
mail/base/content/extraCustomizeItems.xul
mail/base/content/search.xml
mail/base/content/searchBar.js
mail/base/modules/quickFilterManager.js
mail/themes/gnomestripe/mail/searchBox.css
mail/themes/pinstripe/mail/searchBox.css
mail/themes/qute/mail/searchBox.css
--- a/mail/base/content/extraCustomizeItems.xul
+++ b/mail/base/content/extraCustomizeItems.xul
@@ -45,16 +45,18 @@
   <!ENTITY % msgViewPickerDTD SYSTEM "chrome://messenger/locale/msgViewPickerOverlay.dtd" >
   %msgViewPickerDTD;
   <!ENTITY % msgFolderPickerDTD SYSTEM "chrome://messenger/locale/msgFolderPickerOverlay.dtd" >
   %msgFolderPickerDTD;
   <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
   %brandDTD;
 ]>
 
+<?xml-stylesheet href="chrome://messenger/skin/searchBox.css" type="text/css"?>
+
 <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <popupset>
     <panel type="glodacomplete-richlistbox"
            id="PopupGlodaAutocomplete" noautofocus="true" />
   </popupset>
 
   <toolbarpalette id="MailToolbarPalette">
@@ -80,17 +82,17 @@
                  >
           <!-- Mimic the search/clear buttons of the standard search textbox,
                but adjust for the reality that clear doesn't make much sense
                since gloda results only show in a tab and the idiom for closing
                tabs is closing the tab.  Our binding does process escape to
                clear the box, if people want to clear it that way...
                -->
           <hbox>
-            <image class="textbox-search-icon"
+            <image class="gloda-search-icon"
                    onclick="document.getElementById('searchInput').doSearch();"
                    />
           </hbox>
         </textbox>
     </toolbaritem>
 
     <toolbarbutton id="button-compact" class="toolbarbutton-1"
                    insertafter="button-mark"
--- a/mail/base/content/search.xml
+++ b/mail/base/content/search.xml
@@ -130,16 +130,19 @@
                                    this._prefObserver, false);
             observerSvc.addObserver(this, "autocomplete-did-enter-text", false);
             gSearchInputObserversRegistered = true;
           }
 
           this.glodaEnabled =
             prefBranch.getBoolPref("mailnews.database.global.indexer.enabled");
           this.collapsed = !this.glodaEnabled;
+
+          // make sure we set our emptytext here from the get-go
+          this._updateVisibleText();
         } catch (e) {
           logException(e, true);
         }
       ]]></constructor>
 
       <destructor>
         <![CDATA[
           var prefBranch =
--- a/mail/base/content/searchBar.js
+++ b/mail/base/content/searchBar.js
@@ -47,17 +47,17 @@ var gSearchBundle;
 var gStatusBar = document.getElementById('statusbar-icon');
 
 var gGlodaCompleteStrings = new StringBundle("chrome://messenger/locale/glodaComplete.properties");
 
 /* see the constructor of searchbar in search.xml's constructor for details */
 var gSearchInputObserversRegistered = false;
 
 /**
- * The quicksearch widget is a UI widget (the #searchInput textbox) which is
+ * The glodasearch widget is a UI widget (the #searchInput textbox) which is
  * outside of the mailTabType's display panel, but acts as though it were within
  * it..  This means we need to use a tab monitor so that we can appropriately
  * update the contents of the textbox.
  *
  * Every time a tab is changed, we save the state of the text box and restore
  *  its previous value for the tab we are switching to, as well as whether this
  *  value is a change to the currently-used value (if it is a faceted search) tab.
  *  The behaviour rationale for this is that the searchInput is like the
@@ -86,13 +86,17 @@ var GlodaSearchBoxTabMonitor = {
     let searchInput = document.getElementById("searchInput");
     if (!searchInput) // customized out of the way
       return;
 
     // save the current search field value
     if (aOldTab) {
       aOldTab._ext.glodaSearchBox.value = searchInput.value;
     }
-    // load (or clear if there is none) the persisted search field value
-    searchInput.value = aTab._ext.glodaSearchBox.value || "";
+    // Load (or clear if there is none) the persisted search field value
+    // (We check first to avoid weird blank field / empty text transitions on
+    // tab change.)
+    let desiredValue = aTab._ext.glodaSearchBox.value || "";
+    if (searchInput.value != desiredValue)
+      searchInput.value = desiredValue;
   }
 };
 
--- a/mail/base/modules/quickFilterManager.js
+++ b/mail/base/modules/quickFilterManager.js
@@ -1077,16 +1077,18 @@ let MessageTextFilter = {
    */
   domBindExtra: function MessageTextFilter_domBind(aDocument, aMuxer, aNode) {
     // -- platform-dependent emptytext setup
     aNode.setAttribute(
       "emptytext",
       aNode.getAttribute("emptytextbase")
            .replace("#1", aNode.getAttribute(Application.platformIsMac ?
                                              "keyLabelMac" : "keyLabelNonMac")));
+    // force an update of the emptytext now that we've updated it.
+    aNode.value = "";
 
     // -- Keypresses for focus transferral and upsell
     aNode.addEventListener("keypress", function(aEvent) {
       // - Down key into the thread pane
       if (aEvent.keyCode == aEvent.DOM_VK_DOWN) {
         let threadPane = aDocument.getElementById("threadTree");
         // focusing does not actually select the row...
         threadPane.focus();
@@ -1170,18 +1172,21 @@ let MessageTextFilter = {
     }
 
     // Make sure we have no visible upsell on state change while our textbox
     //  retains focus.
     let panel = aDocument.getElementById("qfb-text-search-upsell");
     if (panel.state != "closed")
       panel.hidePopup();
 
-    // Update the text
-    aNode.value = aFilterValue.text;
+    // Update the text if it has changed (linux does weird things with empty
+    //  text if we're transitioning emptytext to emptytext)
+    let desiredValue = aFilterValue.text || "";
+    if (aNode.value != desiredValue)
+      aNode.value = desiredValue;
 
     // Update our expando buttons
     let states = aFilterValue.states;
     for each (let [, textFilter] in Iterator(this.textFilterDefs)) {
       aDocument.getElementById(textFilter.domId).checked =
         states[textFilter.name];
     }
 
--- a/mail/themes/gnomestripe/mail/searchBox.css
+++ b/mail/themes/gnomestripe/mail/searchBox.css
@@ -32,56 +32,35 @@
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 */
 
-/* ..... tree adjustments ..... */
-
 .quick-search-textbox {
   padding-top: 1px;
 }
 
-#quick-search-button  {
-  margin-top: 0px;
-  margin-bottom: 0px;
-  -moz-margin-start: 0px;
-  -moz-margin-end: 2px;
+.gloda-search-icon {
+  list-style-image: url(chrome://global/skin/icons/Search-glass.png);
 }
 
-.quick-search-button-image {
-  margin: 0px;
-  list-style-image: url(moz-icon://stock/gtk-find?size=menu);
-}
-
-.quick-search-clearbutton[clearButtonHidden="true"] {
-  visibility: hidden;
+.gloda-search-icon:-moz-locale-dir(rtl) {
+  -moz-transform: scaleX(-1);
 }
 
-.quick-search-button-dropmarker {
-  -moz-margin-start: 16px;
-  list-style-image: url("chrome://messenger/skin/icons/search-arrow.png");
+.gloda-search-icon[searchbutton]:not([disabled]) {
+  cursor: pointer;
 }
 
-.quick-search-clearbutton {
-  list-style-image: url("moz-icon://stock/gtk-clear?size=menu");
-  -moz-appearance: none;
-  padding: 0px !important;
-  border: none !important;
-}
 
-.quick-search-clearbutton > .toolbarbutton-icon {
-  -moz-margin-end: 0px; /* override toolkit's default value */
-}
-
-/* things from xul.css that only exist if Thunderbird did not define 
- * AUTOCOMPLETE_OLD_STYLE 
+/* things from xul.css that only exist if Thunderbird did not define
+ * AUTOCOMPLETE_OLD_STYLE
  */
 
 .autocomplete-history-dropmarker {
   display: none;
 }
 
 .autocomplete-history-dropmarker[enablehistory="true"] {
   display: -moz-box;
--- a/mail/themes/pinstripe/mail/searchBox.css
+++ b/mail/themes/pinstripe/mail/searchBox.css
@@ -32,57 +32,21 @@
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 */
 
-.quick-search-button {
-  -moz-margin-start: -10px;
-  -moz-margin-end: 4px;
-  margin-bottom: 0;
-  margin-top: 0;
-}
-
 .quick-search-button-image {
   padding: 0px;
 }
 
-.quick-search-button-dropmarker {
-  -moz-padding-start: 8px;
-  -moz-padding-end: 0;
-  padding-top: 6px;
-  padding-bottom: 5px;
-  list-style-image: url("chrome://global/skin/arrow/arrow-dn.png");
-}
-
-.quick-search-clearbutton {
-  list-style-image: none;
-  -moz-appearance: none;
-  padding: 0px !important;
-  border: none !important;
-  margin: 0 0 1px !important;
-  width: 14px;
-}
-
-.quick-search-clearbutton[clearButtonHidden="false"] {
-  list-style-image: url(chrome://global/skin/icons/searchfield-regular-cancel.png);
-  -moz-image-region: rect(0, 14px, 14px, 0);
-}
-
-.quick-search-clearbutton > .toolbarbutton-text {
-  display: none;
-}
-
-.quick-search-clearbutton[clearButtonHidden="false"]:hover:active {
-  -moz-image-region: rect(0, 28px, 14px, 14px);
-}
-
+/* it looks like appearance: searchfield gets us our search icon... */
 #searchInput {
   margin: 3px 4px 4px !important;
   -moz-appearance: searchfield;
   font: icon;
   height: 22px !important;
 }
 
 #searchInput > .textbox-input-box {
@@ -90,8 +54,21 @@
   padding-top: 1px;
   height: 21px !important;
   margin: 0 !important;
 }
 
 #searchInput:-moz-lwtheme:not([focused="true"]) {
   opacity: .9;
 }
+
+/* things from xul.css that only exist if Thunderbird did not define
+ * AUTOCOMPLETE_OLD_STYLE
+ */
+
+.autocomplete-history-dropmarker {
+  display: none;
+}
+
+.autocomplete-history-dropmarker[enablehistory="true"] {
+  display: -moz-box;
+  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#history-dropmarker");
+}
--- a/mail/themes/qute/mail/searchBox.css
+++ b/mail/themes/qute/mail/searchBox.css
@@ -32,64 +32,66 @@
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 */
 
-/* ..... tree adjustments ..... */
+/*
+ * On Vista, the emptytext style would appear to use italics.  This is causing
+ * problems for the search box because it has no minwidth and is flexy, so
+ * removing the emptytext causes the size of the box to change and this is silly
+ * and undesirable.  This change is being made to maintain the generally
+ * accepted status quo while reducing breakage.  This will cause visual
+ * inconsistency with the quick filter bar unless it gets a change like this
+ * too.
+ */
+#searchInput {
+  font-style: normal !important;
+}
 
 .quick-search-textbox {
   padding-top: 1px;
 }
 
 #quick-search-button  {
   margin-top: 0px;
   margin-bottom: 0px;
   -moz-margin-start: 0px;
   -moz-margin-end: 2px;
 }
 
-.quick-search-button-image {
-  margin: 0px;
-  list-style-image: url("chrome://global/skin/icons/Search-glass.png");
-  -moz-image-region: rect(0px 32px 16px 16px);
-  width: 16px;
-  height: 16px;
+.gloda-search-icon {
+  list-style-image: url(chrome://global/skin/icons/Search-glass.png);
+  -moz-image-region: rect(0, 16px, 16px, 0);
 }
 
-.quick-search-button-image:-moz-locale-dir(rtl) {
+.gloda-search-icon:-moz-locale-dir(rtl) {
   -moz-transform: scaleX(-1);
 }
 
-.quick-search-clearbutton[clearButtonHidden="true"] {
-  visibility: hidden;
+.gloda-search-icon[searchbutton]:not([disabled]) {
+  cursor: pointer;
 }
 
-.quick-search-button-dropmarker {
-  -moz-margin-start: 12px;
-  margin-top: 8px;
-  list-style-image: url("chrome://messenger/skin/icons/search-arrow.gif");
+.gloda-search-icon[searchbutton]:not([disabled]):hover {
+  -moz-image-region: rect(0, 32px, 16px, 16px);
+}
+
+.gloda-search-icon[searchbutton]:not([disabled]):hover:active {
+  -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
-.quick-search-clearbutton {
-  list-style-image: url("chrome://messenger/skin/icons/quick-search-clear.png");
-  -moz-image-region: rect(0px, 16px, 16px, 0px);
-  -moz-appearance: none;
-  padding: 0px !important;
-  border: none !important;
+
+/* things from xul.css that only exist if Thunderbird did not define
+ * AUTOCOMPLETE_OLD_STYLE
+ */
+
+.autocomplete-history-dropmarker {
+  display: none;
 }
 
-.quick-search-clearbutton > .toolbarbutton-icon {
-  -moz-margin-end: 0px; /* override toolkit's default value */
+.autocomplete-history-dropmarker[enablehistory="true"] {
+  display: -moz-box;
+  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#history-dropmarker");
 }
-
-.quick-search-clearbutton:hover {
-  -moz-image-region: rect(0px, 32px, 16px, 16px);
-  padding: 0px !important;
-}
-
-.quick-search-clearbutton:hover:active {
-  -moz-image-region: rect(0px, 48px, 16px, 32px);
-  padding: 0px !important;
-}