Bug 230959 - Inconsistent extra 1 pixel width of XUL window. r=neil
☠☠ backed out by f4e1e9d38bc0 ☠ ☠
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 07 Sep 2011 22:14:04 +1200
changeset 76718 9f150c4e1a48ead55879da80826709267909dff8
parent 76717 604544452285ebe690bf00ce554c507de16db608
child 76719 798802af903814fc532023327af1acf5e407b9aa
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersneil
bugs230959
milestone9.0a1
Bug 230959 - Inconsistent extra 1 pixel width of XUL window. r=neil
layout/base/nsDocumentViewer.cpp
toolkit/components/alerts/resources/content/alert.js
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3294,27 +3294,18 @@ NS_IMETHODIMP DocumentViewerImpl::SizeTo
                   NS_ERROR_FAILURE);
    width = presContext->AppUnitsToDevPixels(shellArea.width);
    height = presContext->AppUnitsToDevPixels(shellArea.height);
 
    nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
    docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
    NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE);
 
-   /* presContext's size was calculated in app units and has already been
-      rounded to the equivalent pixels (so the width/height calculation
-      we just performed was probably exact, though it was based on
-      values already rounded during ResizeReflow). In a surprising
-      number of instances, this rounding makes a window which for want
-      of one extra pixel's width ends up wrapping the longest line of
-      text during actual window layout. This makes the window too short,
-      generally clipping the OK/Cancel buttons. Here we add one pixel
-      to the calculated width, to circumvent this problem. */
-   NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width+1, height),
-      NS_ERROR_FAILURE);
+   NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
+                     NS_ERROR_FAILURE);
 
    return NS_OK;
 }
 
 
 NS_IMPL_ISUPPORTS1(nsDocViewerSelectionListener, nsISelectionListener)
 
 nsresult nsDocViewerSelectionListener::Init(DocumentViewerImpl *aDocViewer)
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -119,21 +119,16 @@ function onAlertLoad()
       document.documentElement.pack = "end";
   }
 
   var alertBox = document.getElementById("alertBox");
   alertBox.orient = (gOrigin & NS_ALERT_HORIZONTAL) ? "vertical" : "horizontal";
 
   sizeToContent();
 
-  // Work around a bug where sizeToContent() leaves a border outside of the content
-  var contentDim = document.getElementById("alertBox").boxObject;
-  if (window.innerWidth == contentDim.width + 1)
-    --window.innerWidth;
-
   // Start with a 1px width/height, because 0 causes trouble with gtk1/2
   gCurrentSize = 1;
 
   // Determine final size
   if (gOrigin & NS_ALERT_HORIZONTAL)
   {
     gFinalSize = window.outerWidth;
     window.outerWidth = gCurrentSize;