Backed out 2 changesets (bug 1679129, bug 1689839) for failing tests. a=backout THUNDERBIRD_78_8_1_BUILD1 THUNDERBIRD_78_8_1_RELEASE
authorRob Lemley <rob@thunderbird.net>
Thu, 04 Mar 2021 18:45:03 -0500
changeset 40299 41dfa822c6c0b3cfda385548a394ae42d01249a4
parent 40298 0c8606e7f45d805bf12d8e67828c24a343b34f11
child 40300 8a94f8a6d180151a6d2b613b309531979837efc1
push id161
push userthunderbird@calypsoblue.org
push dateThu, 04 Mar 2021 23:46:16 +0000
treeherdercomm-esr78@41dfa822c6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1679129, 1689839
backs outb5383265242b0be09bf5a3f00619f8c069b174e7
23cf46e67fa4471e40ff809c47396d6d4fbccb9e
Backed out 2 changesets (bug 1679129, bug 1689839) for failing tests. a=backout Backed out changeset b5383265242b (bug 1689839) Backed out changeset 23cf46e67fa4 (bug 1679129)
calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
calendar/base/content/dialogs/calendar-event-dialog-recurrence.xhtml
calendar/base/themes/common/dialogs/calendar-event-dialog.css
calendar/test/browser/recurrence/browser.ini
calendar/test/browser/recurrence/browser_customMinimonthCount.js
--- a/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
@@ -66,63 +66,71 @@ const RecurrencePreview = {
 
     let minimonthRect = minimonth.getBoundingClientRect();
     let nodeRect = this.node.getBoundingClientRect();
     let contentWidth = minimonthRect.width;
     let containerWidth = nodeRect.width;
 
     // Now find out how much elements can be displayed.
     // this is a simple division which always yields a positive integer value.
-    let cWidth = containerWidth % contentWidth;
+    const cWidth = containerWidth % contentWidth;
     let numHorizontal = (containerWidth - cWidth) / contentWidth;
 
     let contentHeight = minimonthRect.height;
     let containerHeight = nodeRect.height;
 
-    let cHeight = containerHeight % contentHeight;
+    const cHeight = containerHeight % contentHeight;
     // Now find out how much elements can be displayed.
     // this is a simple division which always yields a positive integer value.
     let numVertical = (containerHeight - cHeight) / contentHeight;
 
-    // To cut down on reflows, use a new vbox instead of the live one.
-    let newVbox = document.createXULElement("vbox");
-
-    // Add the existing rows to the fragment.
-    for (let hbox of vbox.children) {
-      newVbox.appendChild(hbox);
+    // Count the number of existing rows
+    let numRows = 0;
+    let hboxIterator = hbox;
+    while (hboxIterator) {
+      numRows++;
+      hboxIterator = hboxIterator.nextElementSibling;
     }
 
-    // Add the extra rows we can accomodate.
-    for (let i = newVbox.childElementCount; i < numVertical; i++) {
-      newVbox.appendChild(document.createXULElement("hbox"));
+    // Adjust rows
+    while (numRows < numVertical) {
+      let newNode = hbox.cloneNode(true);
+      vbox.appendChild(newNode);
+      numRows++;
+    }
+    while (numRows > numVertical) {
+      vbox.firstElementChild.remove();
+      numRows--;
     }
 
-    // Walk all rows and adjust column elements.
-    for (let hbox of newVbox.children) {
-      for (let i = hbox.childElementCount; i < numHorizontal; i++) {
-        let newNode = document.createXULElement("calendar-minimonth");
-        newNode.setAttribute("readonly", "true");
-        hbox.appendChild(newNode);
+    // Walk all rows and adjust column elements
+    hbox = this.node.querySelector("hbox");
+    while (hbox) {
+      let firstElementChild = hbox.firstElementChild;
+      while (hbox.children.length - 1 < numHorizontal) {
+        let newNode = firstElementChild.cloneNode(true);
+        firstElementChild.parentNode.insertBefore(newNode, firstElementChild);
       }
+      while (hbox.children.length - 1 > numHorizontal) {
+        hbox.firstElementChild.remove();
+      }
+      hbox = hbox.nextElementSibling;
     }
 
-    // Now replace the current vbox with the new one.
-    vbox.replaceWith(newVbox);
-
     this.updateContent();
     this.updatePreview(this.mRecurrenceInfo);
   },
   /**
    * Updates content of #recurrence-preview node.
    */
   updateContent() {
     let date = cal.dtz.dateTimeToJsDate(this.dateTime);
     let hbox = this.node.querySelector("hbox");
     while (hbox) {
-      let numChilds = hbox.childElementCount;
+      let numChilds = hbox.children.length - 1;
       for (let i = 0; i < numChilds; i++) {
         let minimonth = hbox.children[i];
         minimonth.showMonth(date);
         date.setMonth(date.getMonth() + 1);
       }
       hbox = hbox.nextElementSibling;
     }
   },
@@ -143,17 +151,17 @@ const RecurrencePreview = {
     end.month++;
 
     // the 'minimonth' controls are arranged in a
     // grid, sorted by rows first -> iterate the rows that may exist.
     let hbox = this.node.querySelector("hbox");
     while (hbox) {
       // now iterate all the child nodes of this row
       // in order to visit each minimonth in turn.
-      let numChilds = hbox.childElementCount;
+      let numChilds = hbox.children.length - 1;
       for (let i = 0; i < numChilds; i++) {
         // we now have one of the minimonth controls while 'start'
         // and 'end' are set to the interval this minimonth shows.
         minimonth = hbox.children[i];
         minimonth.showMonth(cal.dtz.dateTimeToJsDate(start));
         if (recurrenceInfo) {
           // retrieve an array of dates that represents all occurrences
           // that fall into this time interval [start,end[.
--- a/calendar/base/content/dialogs/calendar-event-dialog-recurrence.xhtml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-recurrence.xhtml
@@ -763,20 +763,21 @@
         </box>
       </radiogroup>
     </vbox>
   </html:fieldset>
 
   <!-- preview -->
   <html:fieldset id="preview-border">
     <html:legend id="recurrence-preview-label">&event.recurrence.preview.label;</html:legend>
-    <hbox id="recurrence-preview">
+    <box id="recurrence-preview" flex="1">
       <vbox>
         <hbox>
             <calendar-minimonth readonly="true"/>
             <calendar-minimonth readonly="true"/>
             <calendar-minimonth readonly="true"/>
+            <spacer/>
         </hbox>
       </vbox>
-    </hbox>
+    </box>
   </html:fieldset>
 </dialog>
 </window>
--- a/calendar/base/themes/common/dialogs/calendar-event-dialog.css
+++ b/calendar/base/themes/common/dialogs/calendar-event-dialog.css
@@ -405,18 +405,16 @@ label.label {
 }
 
 /*--------------------------------------------------------------------
  *   Recurrence dialog preview border
  *-------------------------------------------------------------------*/
 #preview-border {
   border: none;
   padding: 0px;
-  display: flex;
-  -moz-box-flex: 1;
 }
 
 /*--------------------------------------------------------------------
  *   freebusy
  *-------------------------------------------------------------------*/
 #freebusy-container {
   overflow: hidden;
   min-width: 100px;
--- a/calendar/test/browser/recurrence/browser.ini
+++ b/calendar/test/browser/recurrence/browser.ini
@@ -7,14 +7,13 @@ prefs =
   mail.winsearch.firstRunDone=true
   mailnews.start_page.override_url=about:blank
   mailnews.start_page.url=about:blank
 subsuite = thunderbird
 tags = recurrence
 
 [browser_annual.js]
 [browser_biweekly.js]
-[browser_customMinimonthCount.js]
 [browser_daily.js]
 [browser_lastDayOfMonth.js]
 [browser_weeklyN.js]
 [browser_weeklyUntil.js]
 [browser_weeklyWithException.js]
deleted file mode 100644
--- a/calendar/test/browser/recurrence/browser_customMinimonthCount.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/* 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/. */
-
-/**
- * Test minimonth count of the calendar-event-dialog-recurrence dialog when
- * resized.
- */
-
-const { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-const { CalendarTestUtils } = ChromeUtils.import(
-  "resource://testing-common/mozmill/CalendarTestUtils.jsm"
-);
-
-const manager = cal.getCalendarManager();
-const _calendar = manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
-_calendar.name = "Minimonths";
-
-manager.registerCalendar(_calendar);
-registerCleanupFunction(() => {
-  manager.unregisterCalendar(_calendar);
-});
-
-const calendar = cal.async.promisifyCalendar(_calendar);
-
-requestLongerTimeout(2);
-
-/**
- * Test the custom recurrence dialog's minimonths take up the available space
- * when the window is resized. See bug 1679129.
- */
-add_task(async function testMinimonthsFillAvailableSpaceOnResize() {
-  await CalendarTestUtils.setCalendarView(window, "month");
-
-  let targetDate = cal.createDateTime("20201201T000001Z");
-  window.goToDate(targetDate);
-
-  let newEventBtn = window.document.querySelector("#calendar-newevent-button");
-  let getEventWin = CalendarTestUtils.waitForEventDialog("edit");
-  EventUtils.synthesizeMouseAtCenter(newEventBtn, {});
-
-  let eventWin = await getEventWin;
-  let iframe = eventWin.document.querySelector("iframe");
-
-  // For each x,y dimension, open and resize the window. Re-resizing an open
-  // window does not always seems to have the precise dimensions we specifiy so
-  // we test with a fresh one each time. The x and y values here are actually
-  // the number of minimonth boxes we want to resize by horizontal/vertically
-  // or both.
-  for (let x = 0; x <= 3; x++) {
-    for (let y = 0; y <= 3; y++) {
-      if (x + y == 0) {
-        // Skip resizing to 0,0.
-        continue;
-      }
-
-      let getRepeatWin = BrowserTestUtils.promiseAlertDialogOpen(
-        "",
-        "chrome://calendar/content/calendar-event-dialog-recurrence.xhtml",
-        async win => {
-          let container = win.document.querySelector("#recurrence-preview");
-          let containerRect = container.getBoundingClientRect();
-          let containerWidth = containerRect.width;
-          let containerHeight = containerRect.height;
-          let minimonth = container.querySelector("calendar-minimonth");
-          let minimonthRect = minimonth.getBoundingClientRect();
-          let minimonthWidth = minimonthRect.width;
-          let minimonthHeight = minimonthRect.height;
-          let widthRemainder = containerWidth % minimonthWidth;
-          let heightRemainder = containerHeight % minimonthHeight;
-
-          // Determine how many rows and columns to expect when first opened.
-          let defaultCols = (containerWidth - widthRemainder) / minimonthRect.width;
-          let defaultRows = (containerHeight - heightRemainder) / minimonthRect.height;
-          let defaultMinimonthCount = container.querySelectorAll("calendar-minimonth").length;
-          let expectedDefaultMinimonthCount = defaultCols * defaultRows;
-
-          // Ensure the number of minimonths shown is the amount we expect.
-          Assert.equal(
-            defaultMinimonthCount,
-            expectedDefaultMinimonthCount,
-            `default minimonth box count is ${expectedDefaultMinimonthCount}`
-          );
-
-          // Calculate the expected number of minimonths after resize.
-          let expectedCols = defaultCols + x;
-          let expectedRows = defaultRows + y;
-          let expectedCount = expectedCols * expectedRows;
-
-          // Calculate the actual number of pixels to resize the window by.
-          let xDelta = Math.ceil(minimonthWidth * x);
-          let yDelta = Math.ceil(minimonthHeight * y);
-
-          // Resize the window.
-          let wasResized = BrowserTestUtils.waitForEvent(win, "resize");
-          win.resizeBy(xDelta, yDelta);
-          await wasResized;
-
-          // Occasionally, the container's vertical height is not what we expect
-          // (12px less when resized by 1 minimonth). This seems to be only
-          // happening during mochitests. The onResize() handler will not render
-          // extra rows when this happens so resize the window incrementally
-          // here until the container has the desired vertical height.
-          let expectedContainerWidth = containerWidth + xDelta;
-          let expectedContainerHeight = containerHeight + yDelta;
-          await TestUtils.waitForCondition(async () => {
-            let { width, height } = container.getBoundingClientRect();
-
-            if (width >= expectedContainerWidth && height >= expectedContainerHeight) {
-              return true;
-            }
-
-            let reXDelta = Math.ceil(expectedContainerWidth - width);
-            let reYDelta = Math.ceil(expectedContainerHeight - height);
-            let wasResizedAgain = BrowserTestUtils.waitForEvent(win, "resize");
-            win.resizeBy(reXDelta, reYDelta);
-            await wasResizedAgain;
-
-            let rect = container.getBoundingClientRect();
-            return rect.width >= expectedContainerWidth && rect.height >= expectedContainerHeight;
-          }, `(+${x},+${y}): minimonth container was not resized to ${expectedContainerWidth}x${expectedContainerHeight}`);
-
-          let actualCount = container.querySelectorAll("calendar-minimonth").length;
-          Assert.equal(
-            actualCount,
-            expectedCount,
-            `minimonth count is ${expectedCount} when resized by +${x},+${y} minimonths`
-          );
-
-          // Close the window here to avoid blocking.
-          await BrowserTestUtils.closeWindow(win);
-        }
-      );
-      let repeatMenu = iframe.contentDocument.querySelector("#item-repeat");
-      repeatMenu.value = "custom";
-      repeatMenu.doCommand();
-      await getRepeatWin;
-    }
-  }
-  await BrowserTestUtils.closeWindow(eventWin);
-});