Bug 1470371 - Port bug 1454358: Replace use of ScrollBoxObject in calendar/. r=philipp
authorGeoff Lankow <geoff@darktrojan.net>
Sat, 14 Jul 2018 13:36:09 +1200
changeset 24263 d88a6041b55f7b1a4dcc742b20621acd5b8c1834
parent 24262 0bfa777345f9a8c517ba55df4f75f4cd7b35477d
child 24264 70ce87dcbe19982d0fdd343e64badbde098d78b5
push id14617
push usermozilla@jorgk.com
push dateSun, 15 Jul 2018 08:12:37 +0000
treeherdercomm-central@70ce87dcbe19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs1470371, 1454358
Bug 1470371 - Port bug 1454358: Replace use of ScrollBoxObject in calendar/. r=philipp
calendar/base/content/calendar-multiday-view.xml
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -2220,23 +2220,16 @@
           this.calendarView.selectedDateTime = newStart;
           event.stopPropagation();
       ]]></handler>
       <handler event="wheel"><![CDATA[
           if (this.getAttribute("orient") == "vertical") {
               // In vertical view (normal), don't let the parent multiday view
               // handle the scrolling in its bubbling phase. The default action
               // will make the box scroll here.
-
-              // TODO We could scroll by the height of exactly one event box, but
-              // since a normal box's boxObject doesn't implement ScrollBoxObject,
-              // there is no way to scroll by pixels. Using a xul:scrollbox has
-              // problems since the equalsize attribute isn't inherited by the
-              // inner box, and even if that is worked around, something makes the
-              // rotated view look bad in that case.
               event.stopPropagation();
           }
       ]]></handler>
     </handlers>
   </binding>
 
   <!--
      -  An individual event box, to be inserted into a column.
@@ -3750,30 +3743,29 @@
         ]]></body>
       </method>
 
       <field name="mFirstVisibleMinute">0</field>
       <method name="scrollToMinute">
         <parameter name="aMinute"/>
         <body><![CDATA[
             let scrollbox = document.getAnonymousElementByAttribute(this, "anonid", "scrollbox");
-            let scrollBoxObject = scrollbox.boxObject;
             // 'aMinute' will be the first minute showed in the view, so it must
             // belong to the range 0 <-> (24*60 - minutes_showed_in_the_view) but
             // we consider 25 hours instead of 24 to let the view scroll until
             // showing events that start just before 0.00
-            let maxFirstMin = 25 * 60 - Math.round(scrollBoxObject.height / this.mPixPerMin);
+            let maxFirstMin = 25 * 60 - Math.round(scrollbox.boxObject.height / this.mPixPerMin);
             aMinute = Math.min(maxFirstMin, Math.max(0, aMinute));
 
-            if (scrollBoxObject && scrollbox.scrollHeight > 0) {
+            if (scrollbox.scrollHeight > 0) {
                 let pos = Math.round(aMinute * this.mPixPerMin);
                 if (scrollbox.getAttribute("orient") == "horizontal") {
-                    scrollBoxObject.scrollTo(scrollBoxObject.positionX, pos);
+                    scrollbox.scrollTo(scrollbox.scrollLeft, pos);
                 } else {
-                    scrollBoxObject.scrollTo(pos, scrollBoxObject.positionY);
+                    scrollbox.scrollTo(pos, scrollbox.scrollTop);
                 }
             }
 
             // Set the first visible minute in any case, we want to move to the
             // right minute as soon as possible if we couldn't do so above.
             this.mFirstVisibleMinute = aMinute;
         ]]></body>
       </method>
@@ -3867,22 +3859,21 @@
 
           // We are taking care of scrolling, so prevent the default
           // action in any case.
           event.preventDefault();
       ]]></handler>
 
       <handler event="scroll" phase="bubbling"><![CDATA[
           let scrollbox = document.getAnonymousElementByAttribute(this, "anonid", "scrollbox");
-          let scrollBoxObject = scrollbox.boxObject;
-          if (scrollBoxObject && scrollbox.scrollHeight > 0) {
+          if (scrollbox.scrollHeight > 0) {
               // We need to update the first visible minute, but only if the
               // scrollbox has been sized.
               if (scrollbox.getAttribute("orient") == "horizontal") {
-                  this.mFirstVisibleMinute = Math.round(scrollBoxObject.positionY / this.mPixPerMin);
+                  this.mFirstVisibleMinute = Math.round(scrollbox.scrollTop / this.mPixPerMin);
               } else {
-                  this.mFirstVisibleMinute = Math.round(scrollBoxObject.positionX / this.mPixPerMin);
+                  this.mFirstVisibleMinute = Math.round(scrollbox.scrollLeft / this.mPixPerMin);
               }
           }
       ]]></handler>
     </handlers>
   </binding>
 </bindings>