Bug 1578982 - Fix category colour display if category name contains space; r+a=pmorris
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 16 Sep 2019 14:55:33 +1200
changeset 35862 7d67effb480b0cb42e6ccb6a73a95ceb88d45570
parent 35861 73214b3f677012ca0e5a5f15f9ce614f13ae9905
child 35863 9b49afdcea350484ddeb9acf0b570b3abed843aa
push id32
push usermozilla@jorgk.com
push dateFri, 20 Sep 2019 19:37:06 +0000
treeherdercomm-esr68@0f180c4b528c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1578982
Bug 1578982 - Fix category colour display if category name contains space; r+a=pmorris
calendar/base/modules/utils/calViewUtils.jsm
--- a/calendar/base/modules/utils/calViewUtils.jsm
+++ b/calendar/base/modules/utils/calViewUtils.jsm
@@ -390,24 +390,26 @@ calview.colorTracker = {
   },
   _removeCalendarFromDocument(aDocument, aCalendar) {
     let cssSafeId = calview.formatStringForCSSRule(aCalendar.id);
     let style = aDocument.documentElement.style;
     style.removeProperty(`--calendar-${cssSafeId}-backcolor`);
     style.removeProperty(`--calendar-${cssSafeId}-forecolor`);
   },
   _addCategoryToDocument(aDocument, aCategoryName) {
+    // aCategoryName should already be formatted for CSS, because that's
+    // what is stored in the prefs, and this function is only called with
+    // arguments that come from the prefs.
     if (/[^\w-]/.test(aCategoryName)) {
       return;
     }
 
-    let cssSafeName = calview.formatStringForCSSRule(aCategoryName);
     let style = aDocument.documentElement.style;
     let color = this.categoryBranch.getStringPref(aCategoryName, "transparent");
-    style.setProperty(`--category-${cssSafeName}-color`, color);
+    style.setProperty(`--category-${aCategoryName}-color`, color);
   },
   _addAllCategoriesToDocument(aDocument) {
     for (let categoryName of this.categoryBranch.getChildList("")) {
       this._addCategoryToDocument(aDocument, categoryName);
     }
   },
 
   // calICalendarManagerObserver methods