Bug 130078 - Make chrome subdocuments of chrome parents share the view hierarchy [p=roc r+sr=bzbarsky a=blocking1.9+]
authorreed@reedloden.com
Wed, 07 Nov 2007 20:50:49 -0800
changeset 7684 d4caa41a45de98fbeb7da059d497ca4709f4fb78
parent 7683 fd373e6a5ca57fb22af3dc3032f07b0a056d5b35
child 7685 5a605e029a390d080ad21f5145a41a467ff0118a
push idunknown
push userunknown
push dateunknown
reviewersblocking1.9
bugs130078
milestone1.9b2pre
Bug 130078 - Make chrome subdocuments of chrome parents share the view hierarchy [p=roc r+sr=bzbarsky a=blocking1.9+]
layout/base/nsDocumentViewer.cpp
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2194,29 +2194,28 @@ DocumentViewerImpl::MakeWindow(nsIWidget
     do {
       pView = pView->GetParent();
     } while (pView && pView->GetViewManager() == containerVM);
 
     if (!pView) {
       // OK, so the container is not already hooked up into a foreign view manager hierarchy.
       // That means we can choose not to hook ourselves up.
       //
-      // If the parent container is a chrome shell then we won't hook into its view
+      // If the parent container is a chrome shell and we are a content shell
+      // then we won't hook into its view
       // tree. This will improve performance a little bit (especially given scrolling/painting perf bugs)
       // but is really just for peace of mind. This check can be removed if we want to support fancy
       // chrome effects like transparent controls floating over content, transparent Web browsers, and
       // things like that, and the perf bugs are fixed.
       nsCOMPtr<nsIDocShellTreeItem> container(do_QueryReferent(mContainer));
-      nsCOMPtr<nsIDocShellTreeItem> parentContainer;
-      PRInt32 itemType;
-      if (nsnull == container
-          || NS_FAILED(container->GetParent(getter_AddRefs(parentContainer)))
-          || nsnull == parentContainer
-          || NS_FAILED(parentContainer->GetItemType(&itemType))
-          || itemType != nsIDocShellTreeItem::typeContent) {
+      nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
+      if (container) {
+        container->GetSameTypeParent(getter_AddRefs(sameTypeParent));
+      }
+      if (!sameTypeParent) {
         containerView = nsnull;
       }
     }
   }
 
   // Create a view
   nsIView* view = mViewManager->CreateView(tbounds, containerView);
   if (!view)