Bug 807174 - Drop-down list used inside a frameset document renders outside the frame. r=roc a=lsblakk
authorMats Palmgren <matspal@gmail.com>
Mon, 05 Nov 2012 23:44:18 +0100
changeset 109776 6c1314c972a41336ad0b41eed79e3e3f7c2527c2
parent 109775 07fe19d85b51178e8039e93588c21568aebae80d
child 109777 518b70ac56cc396078c3e56f34ba66c810bb65b2
push id1666
push usermpalmgren@mozilla.com
push dateMon, 05 Nov 2012 22:44:22 +0000
treeherdermozilla-beta@6c1314c972a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs807174
milestone17.0
Bug 807174 - Drop-down list used inside a frameset document renders outside the frame. r=roc a=lsblakk
layout/forms/nsComboboxControlFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -651,21 +651,22 @@ nsComboboxControlFrame::GetAvailableDrop
   nsRect screen = nsFormControlFrame::GetUsableScreenRect(PresContext());
   if (mLastDropDownBelowScreenY == nscoord_MIN) {
     nsRect thisScreenRect = GetScreenRectInAppUnits();
     mLastDropDownBelowScreenY = thisScreenRect.YMost() + aTranslation->y;
     mLastDropDownAboveScreenY = thisScreenRect.y + aTranslation->y;
   }
 
   nscoord minY;
-  if (!PresContext()->IsChrome()) {
-    nsIFrame* root = PresContext()->PresShell()->GetRootFrame();
+  nsPresContext* pc = PresContext()->GetToplevelContentDocumentPresContext();
+  nsIFrame* root = pc ? pc->PresShell()->GetRootFrame() : nullptr;
+  if (root) {
     minY = root->GetScreenRectInAppUnits().y;
-    if (mLastDropDownBelowScreenY < root->GetScreenRectInAppUnits().y) {
-      // Don't allow the drop-down to be placed above the top of the root frame.
+    if (mLastDropDownBelowScreenY < minY) {
+      // Don't allow the drop-down to be placed above the content area.
       return;
     }
   } else {
     minY = screen.y;
   }
   
   nscoord below = screen.YMost() - mLastDropDownBelowScreenY;
   nscoord above = mLastDropDownAboveScreenY - minY;