Backed out changeset f1ce87511750 (bug 1044597) for bc1 orange
authorWes Kocher <wkocher@mozilla.com>
Mon, 09 Feb 2015 16:08:46 -0800
changeset 242046 f6fde9d79acf40f027c5f5356aaebc15e6c5a0b7
parent 242045 f74a7a410dd3e8ba6fdcf7bee0c48324c3b00be1
child 242047 7c9cbe8b347dec90fec4a0b1ca0f7277d0143d9d
push id634
push usermozilla@noorenberghe.ca
push dateTue, 10 Feb 2015 22:34:30 +0000
bugs1044597
milestone38.0a1
backs outf1ce8751175006428e5d719da73e50a8d834ca82
Backed out changeset f1ce87511750 (bug 1044597) for bc1 orange
browser/components/preferences/in-content/subdialogs.js
browser/components/preferences/in-content/tests/browser_subdialogs.js
--- a/browser/components/preferences/in-content/subdialogs.js
+++ b/browser/components/preferences/in-content/subdialogs.js
@@ -87,18 +87,16 @@ let gSubDialog = {
     }
 
     this._overlay.style.visibility = "";
     // Clear the sizing inline styles.
     this._frame.removeAttribute("style");
     // Clear the sizing attributes
     this._box.removeAttribute("width");
     this._box.removeAttribute("height");
-    this._box.style.removeProperty("min-height");
-    this._box.style.removeProperty("min-width");
 
     setTimeout(() => {
       // Unload the dialog after the event listeners run so that the load of about:blank isn't
       // cancelled by the ESC <key>.
       this._frame.loadURI("about:blank");
     }, 0);
   },
 
@@ -141,30 +139,20 @@ let gSubDialog = {
 
   _onLoad: function(aEvent) {
     if (aEvent.target.contentWindow.location == "about:blank")
       return;
 
     // Do this on load to wait for the CSS to load and apply before calculating the size.
     let docEl = this._frame.contentDocument.documentElement;
 
-    let groupBoxTitle = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-title");
-    let groupBoxTitleHeight = groupBoxTitle.clientHeight +
-                              parseFloat(getComputedStyle(groupBoxTitle).borderBottomWidth);
+    // padding-bottom doesn't seem to be included in the scrollHeight of the document element in XUL
+    // so add it ourselves.
+    let paddingBottom = parseFloat(this._frame.contentWindow.getComputedStyle(docEl).paddingBottom);
 
-    let groupBoxBody = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-body");
-    let boxVerticalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingTop);
-    let boxHorizontalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingLeft);
-    let frameWidth = docEl.scrollWidth;
-    let frameHeight = docEl.scrollHeight;
-    let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
-    let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
-
-    this._frame.style.width = frameWidth + "px";
-    this._frame.style.height = frameHeight + "px";
-    this._box.style.minHeight = (boxVerticalBorder + groupBoxTitleHeight + boxVerticalPadding + frameHeight) + "px";
-    this._box.style.minWidth = (boxHorizontalBorder + boxHorizontalPadding + frameWidth) + "px";
+    this._frame.style.width = docEl.style.width || docEl.scrollWidth + "px";
+    this._frame.style.height = docEl.style.height || (docEl.scrollHeight + paddingBottom) + "px";
 
     this._overlay.style.visibility = "visible";
     this._frame.focus();
     this._overlay.style.opacity = ""; // XXX: focus hack continued from _onContentLoaded
   },
 };
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -136,18 +136,18 @@ let gTests = [{
 {
   desc: "Check that width and height from the sub-dialog are used to size the <browser>",
   run: function* () {
     let deferredClose = Promise.defer();
     let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
                                              (aEvent) => dialogClosingCallback(deferredClose, aEvent));
     let dialog = yield dialogPromise;
 
-    ise(content.gSubDialog._frame.style.width, "528px", "Width should be set on the frame from the dialog");
-    ise(content.gSubDialog._frame.style.height, "280px", "Height should be set on the frame from the dialog");
+    ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
+    ise(content.gSubDialog._frame.style.height, "40em", "Height should be set on the frame from the dialog");
 
     content.gSubDialog.close();
     yield deferredClose.promise;
   },
 },
 {
   desc: "Check that scrollWidth and scrollHeight from the sub-dialog are used to size the <browser>",
   run: function* () {