Bug 130078. Reverting fix because of regressions. We'll have to come back to this again :-(.
This commit is contained in:
@@ -2331,29 +2331,45 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
tbounds.y = 0;
|
||||
|
||||
// Create a child window of the parent that is our "root view/window"
|
||||
// if aParentWidget has a view, we'll hook our view manager up to its view tree
|
||||
nsIView* containerView = nsView::GetViewFor(aParentWidget);
|
||||
|
||||
if (containerView) {
|
||||
// see if the containerView has already been hooked into a foreign view manager hierarchy
|
||||
// if it has, then we have to hook into the hierarchy too otherwise bad things will happen.
|
||||
nsIViewManager* containerVM = containerView->GetViewManager();
|
||||
nsIView* pView = containerView;
|
||||
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
|
||||
// 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) {
|
||||
containerView = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a view
|
||||
nsIView* view = mViewManager->CreateView(tbounds, containerView);
|
||||
if (!view)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (containerView) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> container(do_QueryReferent(mContainer));
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentContainer;
|
||||
PRInt32 itemType;
|
||||
PRInt32 parentItemType;
|
||||
if (container
|
||||
&& NS_SUCCEEDED(container->GetItemType(&itemType))
|
||||
&& itemType == nsIDocShellTreeItem::typeContent
|
||||
&& NS_SUCCEEDED(container->GetParent(getter_AddRefs(parentContainer)))
|
||||
&& parentContainer
|
||||
&& NS_SUCCEEDED(parentContainer->GetItemType(&parentItemType))
|
||||
&& parentItemType != nsIDocShellTreeItem::typeContent) {
|
||||
view->SetUseDefaultBackgroundColor(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
// establish a parent/child widget relationship
|
||||
|
||||
Reference in New Issue
Block a user