Bug 868327 - Only allow the drop-down menu to open above the combobox if there is room for it, otherwise open it below even though it doesn't fit. r=roc
authorMats Palmgren <matspal@gmail.com>
Thu, 25 Jul 2013 12:55:32 +0000
changeset 139940 2e27eaf8ebc21dadf7ff91959f5760da7a51183a
parent 139939 0f58c42394fef3859bf48cdd17ff806947879ca8
child 139955 c95a82a8c15fb83aa8fbafd7a2b703ecf157ee8c
child 140004 60f09edcad4ffa5cfb737d1168792a22ca044249
push id25006
push useremorley@mozilla.com
push dateThu, 25 Jul 2013 15:31:33 +0000
treeherdermozilla-central@2e27eaf8ebc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs868327
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 868327 - Only allow the drop-down menu to open above the combobox if there is room for it, otherwise open it below even though it doesn't fit. r=roc
layout/forms/nsComboboxControlFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -641,19 +641,20 @@ nsComboboxControlFrame::AbsolutelyPositi
     // The drop-down fits but there is room for at least 1.5 more rows -
     // schedule a resize to show more rows if it has more rows to show.
     // (1.5 rows for good measure to avoid any rounding issues that would
     // lead to a loop of reflow requests)
     NS_DispatchToCurrentThread(new nsAsyncResize(this));
     return eDropDownPositionPendingResize;
   }
 
-  // Position the drop-down below if there is room, otherwise place it
-  // on the side that has more room.
-  bool b = dropdownSize.height <= below || below >= above;
+  // Position the drop-down below if there is room, otherwise place it above
+  // if there is room.  If there is no room for it on either side then place
+  // it below (to avoid overlapping UI like the URL bar).
+  bool b = dropdownSize.height <= below || dropdownSize.height > above;
   nsPoint dropdownPosition(0, b ? GetRect().height : -dropdownSize.height);
   if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
     // Align the right edge of the drop-down with the right edge of the control.
     dropdownPosition.x = GetRect().width - dropdownSize.width;
   }
 
   // Don't position the view unless the position changed since it might cause
   // a call to NotifyGeometryChange() and an infinite loop here.