Bug 1590153 - Remove keywordrelated code from SM mail. r=frg a=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Wed, 30 Oct 2019 19:29:28 +0100
changeset 32350 a93a71b87c7e1c0f4914e2ac64105e968c8005fb
parent 32349 657fd8bb6fac578f356626d4ffb25344e86c6bf6
child 32351 a034a02220f00215ce87c5662432cf9af05a9508
push id225
push userfrgrahl@gmx.net
push dateWed, 30 Oct 2019 18:44:45 +0000
treeherdercomm-esr60@4f5c19b9a6b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1590153
Bug 1590153 - Remove keywordrelated code from SM mail. r=frg a=frg
suite/mailnews/content/mailWindow.js
suite/mailnews/content/messageWindow.js
suite/mailnews/content/msgHdrViewOverlay.xul
--- a/suite/mailnews/content/mailWindow.js
+++ b/suite/mailnews/content/mailWindow.js
@@ -25,19 +25,16 @@ var folderDataSource;
 
 var accountCentralBox = null;
 var gDisableViewsSearch = null;
 var gAccountCentralLoaded = true;
 //End progress and Status variables
 
 var gOfflineManager;
 
-// cache the last keywords
-var gLastKeywords = "";
-
 function OnMailWindowUnload()
 {
   RemoveMailOfflineObserver();
   ClearPendingReadTimer();
 
   var searchSession = GetSearchSession();
   if (searchSession)
   {
@@ -622,56 +619,16 @@ function OpenInboxForServer(server)
 function GetSearchSession()
 {
   if (("gSearchSession" in top) && gSearchSession)
     return gSearchSession;
   else
     return null;
 }
 
-function SetKeywords(aKeywords)
-{
-  // we cache the last keywords.
-  // if there is no chagne, we do nothing.
-  // most of the time, this will be the case.
-  if (aKeywords == gLastKeywords)
-    return;
-
-  // these are the UI elements who care about keywords
-  var elements = document.getElementsByAttribute("keywordrelated","true");
-  var len = elements.length;
-  for (var i=0; i<len; i++) {
-    var element = elements[i];
-    var originalclass = element.getAttribute("originalclass");
-
-    // we use XBL for certain headers.
-    // if the element has keywordrelated="true"
-    // but no original class, it's an XBL widget
-    // so to get the real element, use getAnonymousElementByAttribute()
-    if (!originalclass) {
-      element = document.getAnonymousElementByAttribute(element, "keywordrelated", "true");
-      originalclass = element.getAttribute("originalclass");
-    }
-
-    if (aKeywords) {
-      if (element.getAttribute("appendoriginalclass") == "true") {
-        aKeywords += " " + originalclass;
-      }
-      element.setAttribute("class", aKeywords);
-    }
-    else {
-      // if no keywords, reset class to the original class
-      element.setAttribute("class", originalclass);
-    }
-  }
-
-  // cache the keywords
-  gLastKeywords = aKeywords;
-}
-
 function MailSetCharacterSet(aEvent)
 {
   if (aEvent.target.hasAttribute("charset")) {
     msgWindow.mailCharacterSet = aEvent.target.getAttribute("charset");
     msgWindow.charsetOverride = true;
   }
   messenger.setDocumentCharset(msgWindow.mailCharacterSet);
 }
--- a/suite/mailnews/content/messageWindow.js
+++ b/suite/mailnews/content/messageWindow.js
@@ -143,17 +143,16 @@ nsMsgDBViewCommandUpdater.prototype =
     },
 
   displayMessageChanged : function(aFolder, aSubject, aKeywords)
   {
     setTitleFromFolder(aFolder, aSubject);
     ClearPendingReadTimer(); // we are loading / selecting a new message so kill the mark as read timer for the currently viewed message
     gCurrentMessageUri = gDBView.URIForFirstSelectedMessage;
     UpdateStandAloneMessageCounts();
-    SetKeywords(aKeywords);
     goUpdateCommand("button_delete");
     goUpdateCommand("button_junk");
     goUpdateCommand("button_goBack");
     goUpdateCommand("button_goForward");
   },
 
   updateNextMessageAfterDelete : function()
   {
--- a/suite/mailnews/content/msgHdrViewOverlay.xul
+++ b/suite/mailnews/content/msgHdrViewOverlay.xul
@@ -124,111 +124,127 @@
   <menuitem label="&bookmarkLinkCmd.label;"
             accesskey="&bookmarkLinkCmd.accesskey;"
             oncommand="BookmarkWebsite(document.popupNode);"/>
   <menuitem label="&copyLinkCmd.label;"
             accesskey="&copyLinkCmd.accesskey;"
             oncommand="CopyWebsiteAddress(document.popupNode);"/>
 </menupopup>
 
-<hbox id="msgHeaderView" keywordrelated="true" originalclass="none" persist="state">
+<hbox id="msgHeaderView" persist="state">
 
-<grid id="collapsedHeaderView" class="header-part1" keywordrelated="true" originalclass="header-part1" flex="1" collapsed="true">
+<grid id="collapsedHeaderView" class="header-part1" flex="1" collapsed="true">
   <rows>
     <row flex="1"/>
   </rows>
   <columns>
     <column class="collapsedToggleHdrBox">
       <hbox align="start">
         <image id="toggleHeaderView" class="collapsedHeaderViewButton"
           onclick="ToggleHeaderView();"/>
       </hbox>
     </column>
 
     <column id="collapsedsubjectBox" collapsed="true" flex="1">
       <hbox>
         <label class="collapsedHeaderDisplayName" value="&subjectField.label;" control="collapsedsubjectValue"/>
-        <textbox id="collapsedsubjectValue" keywordrelated="true" class="collapsedHeaderValue plain" originalclass="collapsedHeaderValue plain" readonly="true" crop="right" appendoriginalclass="true" flex="1"/>
+        <textbox id="collapsedsubjectValue"
+                 class="collapsedHeaderValue plain"
+                 readonly="true" crop="right" flex="1"/>
       </hbox>
     </column>
 
     <column id="collapsedfromBox" flex="1">
       <hbox align="start">
         <mail-multi-emailHeaderField id="collapsedfromValue" class="collapsedHeaderDisplayName" label="&fromField.label;" collapsed="true" flex="1"/>
       </hbox>
     </column>
 
     <column id = "collapseddateBox" collapsed="true">
       <hbox align="start">
-        <textbox id="collapseddateValue" keywordrelated="true" class="collapsedHeaderValue plain" originalclass="collapsedHeaderValue plain" appendoriginalclass="true" readonly="true"/>
+        <textbox id="collapseddateValue"
+                 class="collapsedHeaderValue plain"
+                 readonly="true"/>
       </hbox>
     </column>
 
     <column id="collapsedKeywordBox">
       <hbox align="start">
-      <image id="collapsedKeywordImage" keywordrelated="true" originalclass="none"/>
+      <image id="collapsedKeywordImage"/>
       </hbox>
     </column>
 
     <column id="collapsedAttachmentBox" collapsed="true">
       <hbox align="start">
       <image id="collapsedAttachment" class="collapsedAttachmentButton" onclick="ToggleHeaderView();" />
       </hbox>
     </column>
   </columns>
 </grid>
 
-<hbox id="expandedHeaderView" class="header-part1" keywordrelated="true" originalclass="header-part1" flex="1" collapsed="true">
+<hbox id="expandedHeaderView" class="header-part1" flex="1" collapsed="true">
 
   <vbox id="expandedHeaders" flex="1">
-    <mail-toggle-headerfield keywordrelated="true" id="expandedsubjectBox" class="subjectvalue" label="&subjectField.label;" ontwistyclick="ToggleHeaderView();" collapsed="true"/>
+    <mail-toggle-headerfield id="expandedsubjectBox"
+                             class="subjectvalue"
+                             label="&subjectField.label;"
+                             ontwistyclick="ToggleHeaderView();"
+                             collapsed="true"/>
 
     <mail-multi-emailHeaderField id="expandedfromBox" label="&fromField.label;" collapsed="true"/>
     <mail-emailheaderfield id="expandedsenderBox" label="&senderField.label;" collapsed="true"/>
     <mail-headerfield id="expandedorganizationBox" label="&organizationField.label;" collapsed="true"/>
     <mail-multi-emailHeaderField id="expandedreply-toBox" label="&replyToField.label;" collapsed="true"/>
 
-    <mail-headerfield keywordrelated="true" id="expandeddateBox" label="&dateField.label;" collapsed="true"/>
+    <mail-headerfield id="expandeddateBox"
+                      label="&dateField.label;"
+                      collapsed="true"/>
 
     <mail-multi-emailHeaderField id="expandedtoBox"  label="&toField.label;"  collapsed="true"/>
     <mail-multi-emailHeaderField id="expandedccBox"  label="&ccField.label;"  collapsed="true"/>
     <mail-multi-emailHeaderField id="expandedbccBox" label="&bccField.label;" collapsed="true"/>
 
-    <mail-headerfield keywordrelated="true" id="expandednewsgroupsBox" label="&newsgroupsField.label;" collapsed="true"/>
-    <mail-headerfield keywordrelated="true" id="expandedfollowup-toBox" label="&followupToField.label;" collapsed="true"/>
+    <mail-headerfield id="expandednewsgroupsBox"
+                      label="&newsgroupsField.label;"
+                      collapsed="true"/>
+    <mail-headerfield id="expandedfollowup-toBox"
+                      label="&followupToField.label;"
+                      collapsed="true"/>
     <mail-messageids-headerfield id="expandedmessage-idBox" label="&messageIdField.label;" collapsed="true"/>
     <mail-messageids-headerfield id="expandedin-reply-toBox" label="&inReplyToField.label;" collapsed="true"/>
     <mail-messageids-headerfield id="expandedreferencesBox" label="&referencesField.label;" collapsed="true"/>
     <mail-tagfield id="expandedtagsBox" label="&tagsHdr.label;" collapsed="true"/>
     <mail-urlfield id="expandedcontent-baseBox" label="&originalWebsite.label;" collapsed="true"/>
-    <mail-headerfield keywordrelated="true" id="expandeduser-agentBox"  label="&userAgentField.label;"  collapsed="true"/>
+    <mail-headerfield id="expandeduser-agentBox"
+                      label="&userAgentField.label;"
+                      collapsed="true"/>
   </vbox>
 
   <vbox id="expandedKeywordBox">
     <spacer flex="1"/>
-    <image id="expandedKeywordImage" keywordrelated="true" originalclass="none" />
+    <image id="expandedKeywordImage"/>
     <spacer flex="1"/>
   </vbox>
 
-  <vbox id="editMessageBox" class="header-part1" keywordrelated="true" originalclass="header-part1" collapsed="true">
+  <vbox id="editMessageBox" class="header-part1" collapsed="true">
     <spacer flex="1"/>
     <button id="editMessageButton"
             label="&editMessage.label;"
             accesskey="&editMessage.accesskey;"
             oncommand="MsgComposeDraftMessage()"/>
     <spacer flex="1"/>
   </vbox>
 
   <vbox>
     <spacer flex="1"/>
     <image style="padding: 5px" id="fromBuddyIcon"/>
     <spacer flex="1"/>
   </vbox>
 
-  <vbox id="expandedAttachmentBox" class="header-part1" keywordrelated="true" originalclass="header-part1" collapsed="true">
+  <vbox id="expandedAttachmentBox" class="header-part1" collapsed="true">
     <label id="attachmentText"
            value="&attachmentsTree.label;"
            accesskey="&attachmentsTree.accesskey;"
            crop="right"
            control="attachmentList"/>
     <listbox id="attachmentList" rows="3" seltype="multiple"
               onclick="attachmentListClick(event);"
               ondragstart="nsDragAndDrop.startDrag(event,attachmentAreaDNDObserver);"