don't add scrollbar width to getPrefWidth in nsComboboxControlFrame if the themed widget has set the internal button width to 0. b=381669 r/sr=roc
authorjoshmoz@gmail.com
Wed, 23 May 2007 12:16:27 -0700
changeset 1790 c807ac6313a156481d4888175cb28a9997fdd38a
parent 1789 031267c85e2cad60be935157104b31beb6eac907
child 1791 405c37075debcc1170f0794ae06bf22e87ff821a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs381669
milestone1.9a5pre
don't add scrollbar width to getPrefWidth in nsComboboxControlFrame if the themed widget has set the internal button width to 0. b=381669 r/sr=roc
layout/forms/nsComboboxControlFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -588,25 +588,26 @@ nsComboboxControlFrame::GetPrefWidth(nsI
   } else {
     result = 0;
   }
 
   // It's also possible that the pref width of our dropdown is less than that
   // of our display frame plus a scrollbar.  This can happen, eg, if the
   // dropdown is empty.
   if (NS_LIKELY(mListControlFrame && mDisplayFrame)) {
-    nsIScrollableFrame* scrollable;
-    CallQueryInterface(mListControlFrame, &scrollable);
-    NS_ASSERTION(scrollable, "List must be a scrollable frame");
-    nsBoxLayoutState bls(PresContext(), aRenderingContext);
-    nscoord displayResult =
-      scrollable->GetDesiredScrollbarSizes(&bls).LeftRight() +
-      nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mDisplayFrame,
-                                           nsLayoutUtils::PREF_WIDTH);
-
+    nscoord displayResult = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mDisplayFrame,
+                                                                 nsLayoutUtils::PREF_WIDTH);
+    nsPresContext *presContext = PresContext();
+    if (!IsThemed() || presContext->GetTheme()->ThemeNeedsComboboxDropmarker()) {
+      nsIScrollableFrame* scrollable;
+      CallQueryInterface(mListControlFrame, &scrollable);
+      NS_ASSERTION(scrollable, "List must be a scrollable frame");
+      nsBoxLayoutState bls(presContext, aRenderingContext);
+      displayResult += scrollable->GetDesiredScrollbarSizes(&bls).LeftRight();
+    }
     result = PR_MAX(result, displayResult);
   }
 
   return result;
 }
 
 NS_IMETHODIMP 
 nsComboboxControlFrame::Reflow(nsPresContext*          aPresContext,