Bug 807174 - Drop-down list used inside a frameset document renders outside the frame. r=roc
authorMats Palmgren <matspal@gmail.com>
Wed, 31 Oct 2012 06:10:38 +0100
changeset 111867 1858a5369d221c56389335d70a10242269356f87
parent 111866 883af38f81c5baff5d391176a18f595597904b96
child 111868 3781f04d144d29aba4a14813ea18ae2a82e96948
push id17300
push usermpalmgren@mozilla.com
push dateWed, 31 Oct 2012 05:10:35 +0000
treeherdermozilla-inbound@3781f04d144d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs807174
milestone19.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 807174 - Drop-down list used inside a frameset document renders outside the frame. r=roc
layout/forms/nsComboboxControlFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -639,21 +639,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;