Bug 1484680 - Remove treenode-checkbox binding. r=philipp,mkmelin
authorArshad Khan <arshdkhn1@gmail.com>
Mon, 20 Aug 2018 18:30:13 +0530
changeset 33146 779d0a64b2dddc27f05c2412be52271a4cf83252
parent 33145 f3343302b310a9a4a1a7b7084981e7932928010a
child 33147 428645c8b28ee2ebbd2e1daa71f8a721f61c0d90
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersphilipp, mkmelin
bugs1484680
Bug 1484680 - Remove treenode-checkbox binding. r=philipp,mkmelin
calendar/base/content/agenda-listbox.xml
calendar/base/content/widgets/calendar-widget-bindings.css
calendar/base/content/widgets/calendar-widgets.xml
calendar/base/themes/common/widgets/calendar-widgets.css
calendar/lightning/content/messenger-overlay-sidebar.xul
calendar/test/mozmill/testTodayPane.js
--- a/calendar/base/content/agenda-listbox.xml
+++ b/calendar/base/content/agenda-listbox.xml
@@ -35,17 +35,17 @@
           onMouseOverItem(event);
       ]]></handler>
     </handlers>
   </binding>
 
   <binding id="agenda-checkbox-richlist-item"
            extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
     <content>
-      <xul:treenode-checkbox class="agenda-checkbox" anonid="agenda-checkbox-widget"
+      <xul:checkbox class="agenda-checkbox treenode-checkbox" anonid="agenda-checkbox-widget"
                                                    flex="1"
                                                    xbl:inherits="selected,label,hidden,disabled"/>
     </content>
     <implementation>
       <field name="kCheckbox">null</field>;
       <constructor><![CDATA[
           this.kCheckbox = document.getAnonymousElementByAttribute(this, "anonid", "agenda-checkbox-widget");
 
--- a/calendar/base/content/widgets/calendar-widget-bindings.css
+++ b/calendar/base/content/widgets/calendar-widget-bindings.css
@@ -1,15 +1,12 @@
 /* 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/. */
 
-treenode-checkbox {
-  -moz-binding: url("chrome://calendar/content/widgets/calendar-widgets.xml#treenode-checkbox");
-}
 
 modebox,
 modevbox {
   -moz-binding: url(chrome://calendar/content/widgets/calendar-widgets.xml#modebox);
   -moz-user-focus: normal;
 }
 
 modevbox {
--- a/calendar/base/content/widgets/calendar-widgets.xml
+++ b/calendar/base/content/widgets/calendar-widgets.xml
@@ -43,29 +43,25 @@
         <body><![CDATA[
             let dayNumber = cal.l10n.getDateFmtString(`day.${cal.dtz.now().day}.number`);
             document.getAnonymousElementByAttribute(this, "anonid", "day-label").value = dayNumber;
         ]]></body>
       </method>
     </implementation>
    </binding>
 
-  <!-- this binding directly extends to a checkbox but is visualized as
-       a treenode in a treecontrol-->
-  <binding id="treenode-checkbox" extends="chrome://global/content/bindings/checkbox.xml#checkbox"/>
-
   <!-- this binding directly extends to a xul:box element and enriches this with some functionality: It is designed
       to be displayed only 1) in given application modes (e.g "task" mode, "calendar" mode) and 2) only in relation
       to the "checked" attribute of command or a checkbox control.
     - The attribute "mode" denotes a coma-separated list of all modes that the binding should not be collapsed in,
       e.g. mode="calendar,task"
     - The attribute "broadcaster" points to the id of a broadcaster that is supposed to be notified (by the application)
       as soon as the mode changes. When this happens the modebox" will be notified and will check if it should
       collapse itself or not.
-    - The attribute "refcontrol" points to a control either a "command", "checkbox" or a "treenode-checkbox" or other
+    - The attribute "refcontrol" points to a control either a "command", "checkbox" or other
       elements that support a "checked" attribute that is often used to denote whether a modebox is supposed to be
       displayed or not. If "refcontrol" is set to the id of a command you can there set the oncommend attribute like:
       "oncommand='document.getElementById('my-mode-pane').togglePane(event)'. In case it is a checkbox element or derived
       checkbox element this is done automatically by listening to the event "CheckboxChange";
       So if the current application mode is one of the modes listed in the "mode" attribute it is
       additionally verified if the xul-element denoted by "refcontrol" is checked or not. During runtime an attribute named
       "collapsedinmodes" with the collpsed modes comma-separated e.g. "mail,calendar,task. This attribute is also made
       persistent-->
@@ -77,18 +73,17 @@
       <field name="mControlHandler">null</field>;
 
       <constructor><![CDATA[
           if (this.hasAttribute("broadcaster")) {
               this.setAttribute("broadcaster", this.getAttribute("broadcaster"));
           }
           if (this.hasAttribute("refcontrol")) {
               this.mRefControl = document.getElementById(this.getAttribute("refcontrol"));
-              if (this.mRefControl && ((this.mRefControl.localName == "treenode-checkbox") ||
-                                    (this.mRefControl.localName == "checkbox"))) {
+              if (this.mRefControl && (this.mRefControl.localName == "checkbox")) {
                   this.mControlHandler = {
                       binding: this,
                       handleEvent: function(aEvent, aHandled) {
                           return this.binding.onCheckboxStateChange(aEvent, this.binding);
                       }
                   };
                   this.mRefControl.addEventListener("CheckboxStateChange", this.mControlHandler, true);
               }
--- a/calendar/base/themes/common/widgets/calendar-widgets.css
+++ b/calendar/base/themes/common/widgets/calendar-widgets.css
@@ -1,52 +1,52 @@
 /* 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/. */
 
-treenode-checkbox {
+checkbox.treenode-checkbox {
   -moz-box-align: center;
   padding-top: 4px;
   padding-inline-start: 4px;
   padding-inline-end: 4px;
   font-weight: bold;
 }
 
-treenode-checkbox > .checkbox-check {
+checkbox.treenode-checkbox > .checkbox-check {
   -moz-appearance: none;
   -moz-box-align: center;
   border: none;
   width: 8px; /* The image's width is 8 pixels */
   height: 8px;
   background: url(chrome://global/skin/icons/twisty-collapsed.svg) center no-repeat;
   -moz-context-properties: fill;
   fill: currentColor;
 }
 
-treenode-checkbox[checked="true"] > .checkbox-check {
+checkbox.treenode-checkbox[checked="true"] > .checkbox-check {
   background-image: url("chrome://global/skin/icons/twisty-expanded.svg");
 }
 
-treenode-checkbox:-moz-locale-dir(rtl) > .checkbox-check {
+checkbox.treenode-checkbox:-moz-locale-dir(rtl) > .checkbox-check {
   background-image: url("chrome://global/skin/icons/twisty-collapsed-rtl.svg");
 }
 
 .checkbox-label-box {
   margin-inline-start: 4px;
 }
 
 .checkbox-icon {
   margin-inline-end: 2px;
 }
 
 .checkbox-label {
   margin: 0 !important;
 }
 
-treenode-checkbox > .checkbox-label-center-box > .checkbox-label-box > .checkbox-label {
+checkbox.treenode-checkbox > .checkbox-label-center-box > .checkbox-label-box > .checkbox-label {
   font-weight: bold;
   border-bottom: 1px solid -moz-Dialog;
 }
 
 .view-navigation-button {
   -moz-context-properties: fill;
   fill: currentColor;
   list-style-image: url(chrome://calendar-common/skin/view-cycler.svg);
--- a/calendar/lightning/content/messenger-overlay-sidebar.xul
+++ b/calendar/lightning/content/messenger-overlay-sidebar.xul
@@ -145,17 +145,17 @@
               <hbox id="calMinimonthBox" pack="center">
                 <minimonth id="calMinimonth" onchange="minimonthPick(this.value);" freebusy="true"/>
               </hbox>
             </vbox>
           </modevbox>
           <separator id="minimonth-splitter" minwidth="100"/>
           <vbox id="calendar-panel" flex="1">
             <modevbox id="task-filter-pane" mode="task" broadcaster="modeBroadcaster" refcontrol="calendar_toggle_filter_command">
-              <treenode-checkbox id="task-tree-filter-header"
+              <checkbox id="task-tree-filter-header"
                                checked="true"
                                class="treenode-checkbox"
                                label="&calendar.task.filter.title.label;"/>
               <modevbox id="task-filtertree-pane" flex="1" mode="task" broadcaster="modeBroadcaster" refcontrol="task-tree-filter-header">
                  <radiogroup id="task-tree-filtergroup" class="task-tree-subpane"
                              persist="value">
                    <observes element="filterBroadcaster"
                              attribute="value"
@@ -168,17 +168,17 @@
                    <radio id="opt_completed_filter" label="&calendar.task.filter.completed.label;" value="completed" command="calendar_task_filter_command"/>
                    <radio id="opt_open_filter" label="&calendar.task.filter.open.label;" value="open" command="calendar_task_filter_command"/>
                    <radio id="opt_all_filter" label="&calendar.task.filter.all.label;" value="all" command="calendar_task_filter_command"/>
                  </radiogroup>
               </modevbox>
             </modevbox>
             <modevbox id="calendar-list-pane" flex="1" mode="calendar,task" broadcaster="modeBroadcaster"
                       refcontrol="calendar_toggle_calendarlist_command">
-              <treenode-checkbox id="calendar-list-header"
+              <checkbox id="calendar-list-header"
                                checked="true"
                                class="treenode-checkbox"
                                ondrop="return document.getElementById('calendar-list-tree-widget').foreignDrop(event)"
                                ondragenter="return document.getElementById('calendar-list-tree-widget').foreignCanDrop(event)"
                                ondragover="return document.getElementById('calendar-list-tree-widget').foreignCanDrop(event)"
                                label="&calendar.list.header.label;"/>
               <modevbox id="calendar-listtree-pane" flex="1" mode="calendar,task" broadcaster="modeBroadcaster"
                         refcontrol="calendar-list-header">
--- a/calendar/test/mozmill/testTodayPane.js
+++ b/calendar/test/mozmill/testTodayPane.js
@@ -259,23 +259,23 @@ function testTodayPane() {
         anon({"anonid":"agenda-checkbox-widget"})/anon({"class":"checkbox-check"})
     `));
     sleep();
 
     // verify tomorrow and soon collapsed
     tomorrow = lookup(`
         /id("messengerWindow")/id("tabmail-container")/id("today-pane-panel")/
         [1]/id("agenda-panel")/{"flex":"1"}/id("agenda-listbox")/[1]/
-        anon({"class":"agenda-checkbox"})
+        anon({"class":"agenda-checkbox treenode-checkbox"})
     `).getNode();
 
     let soon = lookup(`
         /id("messengerWindow")/id("tabmail-container")/id("today-pane-panel")/
         [1]/id("agenda-panel")/{"flex":"1"}/id("agenda-listbox")/[2]/
-        anon({"class":"agenda-checkbox"})
+        anon({"class":"agenda-checkbox treenode-checkbox"})
     `).getNode();
 
     // TODO This is failing, which might actually be an error in our code!
     //  controller.assertJS(!tomorrow.hasAttribute("checked")
     //    || tomorrow.getAttribute("checked") != "true");
     controller.assertJS(
         !soon.hasAttribute("checked") ||
         soon.getAttribute("checked") != "true"