Bug 239201. Anonymous views (views without frames) should inherit their visibility from their parent. Then visibility:hidden IFRAMEs will hide their widgets. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2004-05-31 20:01:58 +00:00
parent a426212db9
commit 50d0ec0813
3 changed files with 18 additions and 2 deletions

View File

@ -729,7 +729,10 @@ nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
nsRect viewBounds(0, 0, 0, 0); // size will be fixed during reflow
nsIViewManager* viewMan = outerView->GetViewManager();
rv = innerView->Init(viewMan, viewBounds, outerView);
// Create the inner view hidden if the outer view is already hidden
// (it won't get hidden properly otherwise)
rv = innerView->Init(viewMan, viewBounds, outerView,
outerView->GetVisibility());
viewMan->InsertChild(outerView, innerView, nsnull, PR_TRUE);
nsWidgetInitData initData;

View File

@ -729,7 +729,10 @@ nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
nsRect viewBounds(0, 0, 0, 0); // size will be fixed during reflow
nsIViewManager* viewMan = outerView->GetViewManager();
rv = innerView->Init(viewMan, viewBounds, outerView);
// Create the inner view hidden if the outer view is already hidden
// (it won't get hidden properly otherwise)
rv = innerView->Init(viewMan, viewBounds, outerView,
outerView->GetVisibility());
viewMan->InsertChild(outerView, innerView, nsnull, PR_TRUE);
nsWidgetInitData initData;

View File

@ -2859,6 +2859,16 @@ NS_IMETHODIMP nsViewManager::SetViewVisibility(nsIView *aView, nsViewVisibility
}
}
}
// Any child views not associated with frames might not get their visibility
// updated, so propagate our visibility to them. This is important because
// hidden views should have all hidden children.
for (nsView* childView = view->GetFirstChild(); childView;
childView = childView->GetNextSibling()) {
if (!childView->GetClientData()) {
childView->SetVisibility(aVisible);
}
}
}
return NS_OK;
}