Bug 508115. Don't reparent the views for popups, since they should always have the root view as their parent. r=dbaron
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 05 Aug 2009 09:58:46 +1200
changeset 31129 14a9da98c6452dc53aa4ddf3fc8130afb253d0f1
parent 31128 be99b00e43f60d67baf024252d17203065d40519
child 31130 22588ab14ac69be73ff8ebda2099f96adcfa647c
push id8388
push userrocallahan@mozilla.com
push dateWed, 05 Aug 2009 02:43:46 +0000
treeherdermozilla-central@73e08f744e9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs508115
milestone1.9.2a1pre
Bug 508115. Don't reparent the views for popups, since they should always have the root view as their parent. r=dbaron
layout/generic/crashtests/508115-1.xul
layout/generic/crashtests/crashtests.list
layout/generic/nsHTMLContainerFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/508115-1.xul
@@ -0,0 +1,48 @@
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        onload="setTimeout(doTest, 0)"
+        class="reftest-wait">
+<script class="testbody" type="application/javascript"><![CDATA[
+function doTest() {
+  document.getElementById("panel").style.display = '';
+  document.getElementById("deck").selectedIndex = 1;
+  document.getElementById("anchor").open = true;
+  document.getElementById("container").style.width = "0";
+  document.getElementById("anchor2").open = true;
+}
+var count = 0;
+function shown() {
+  ++count;
+  if (count >= 2) {
+    document.documentElement.removeAttribute("class");
+  }
+}
+]]></script>
+<deck id="deck" style="margin:50px;">
+  <vbox></vbox>
+  <vbox id="panel" style="display:none">
+    <vbox>
+    <menulist id="anchor">
+      <menupopup id="popup" onpopupshown="shown()">
+        <menuitem label="One"/>
+        <menuitem label="Two"/>
+        <menuitem label="Three"/>
+      </menupopup>
+    </menulist>
+    </vbox>
+  </vbox>
+</deck>
+<description>
+<html:div id="container">
+  <html:span id="span" style="-moz-transform: translate(0,0)">Hello Kitty
+    <menulist id="anchor2" style="display:-moz-inline-box;">
+      <menupopup id="popup" onpopupshown="shown()">
+        <menuitem label="One"/>
+        <menuitem label="Two"/>
+        <menuitem label="Three"/>
+      </menupopup>
+    </menulist>
+  </html:span>
+</html:div>
+</description>
+</window>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -232,8 +232,9 @@ load 472950-1.html
 load 477928.html
 load 478170-1.html
 load 478185-1.html
 load 479938-1.html
 load 480345-1.html
 load 494332-1.html
 load 501535-1.html
 load 505912-1.html
+load 508115-1.html
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -516,16 +516,22 @@ ReparentFrameViewTo(nsIFrame*       aFra
                     nsIView*        aOldParentView)
 {
 
   // XXX What to do about placeholder views for "position: fixed" elements?
   // They should be reparented too.
 
   // Does aFrame have a view?
   if (aFrame->HasView()) {
+#ifdef MOZ_XUL
+    if (aFrame->GetType() == nsGkAtoms::menuPopupFrame) {
+      // This view must be parented by the root view, don't reparent it.
+      return NS_OK;
+    }
+#endif
     nsIView* view = aFrame->GetView();
     // Verify that the current parent view is what we think it is
     //nsIView*  parentView;
     //NS_ASSERTION(parentView == aOldParentView, "unexpected parent view");
 
     aViewManager->RemoveChild(view);
     
     // The view will remember the Z-order and other attributes that have been set on it.