Fixing some places when talking to the webshell object to start talking through the new docshell interfaces.

This commit is contained in:
tbogard%aol.net 1999-12-18 02:09:29 +00:00
Родитель 3a0585e79d
Коммит 780e191953
14 изменённых файлов: 256 добавлений и 272 удалений

Просмотреть файл

@ -60,6 +60,9 @@
#include "nsIContentViewerFile.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShell.h"
#include "nsIServiceManager.h"
@ -566,16 +569,19 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
nsIView *view;
nsresult rv;
PRInt32 count,i;
nsCOMPtr<nsIWebShell> childWebShell;
nsCOMPtr<nsIContentViewer> viewer;
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(aParent));
aParent->GetChildCount(count);
parentAsNode->GetChildCount(&count);
if(count> 0) {
for(i=0;i<count;i++) {
aParent->ChildAt(i, *(getter_AddRefs(childWebShell)));
childWebShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
nsCOMPtr<nsIDocShellTreeItem> child;
parentAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
childAsShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));
if (viewerFile) {
nsCOMPtr<nsIWebShell> childWebShell(do_QueryInterface(child));
NS_ENSURE_SUCCESS(viewerFile->PrintContent(childWebShell,aDContext), NS_ERROR_FAILURE);
}
}
@ -1271,22 +1277,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetDefaultCharacterSet(const PRUnichar* aDefau
{
mDefaultCharacterSet = aDefaultCharacterSet; // this does a copy of aDefaultCharacterSet
// now set the default char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1321,22 +1327,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetForceCharacterSet(const PRUnichar* aForceCh
{
mForceCharacterSet = aForceCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1380,22 +1386,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSetSource(PRInt32 aHintCharact
{
mHintCharsetSource = (nsCharsetSource)aHintCharacterSetSource;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1413,22 +1419,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSet(const PRUnichar* aHintChar
{
mHintCharset = aHintCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIWebShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIContent.h"
#include "nsITextContent.h"
#include "nsIPresContext.h"
@ -1568,13 +1569,13 @@ nsXMLContentSink::StartLayout()
NS_RELEASE(url);
}
PRBool topLevelFrameset = PR_FALSE;
if (mWebShell) {
nsIWebShell* rootWebShell;
mWebShell->GetRootWebShell(rootWebShell);
if (mWebShell == rootWebShell) {
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mWebShell));
if (docShellAsItem) {
nsCOMPtr<nsIDocShellTreeItem> root;
docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if(docShellAsItem.get() == root.get()) {
topLevelFrameset = PR_TRUE;
}
NS_IF_RELEASE(rootWebShell);
}
if ((nsnull != ref) || topLevelFrameset) {

Просмотреть файл

@ -60,6 +60,9 @@
#include "nsIContentViewerFile.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShell.h"
#include "nsIServiceManager.h"
@ -566,16 +569,19 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
nsIView *view;
nsresult rv;
PRInt32 count,i;
nsCOMPtr<nsIWebShell> childWebShell;
nsCOMPtr<nsIContentViewer> viewer;
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(aParent));
aParent->GetChildCount(count);
parentAsNode->GetChildCount(&count);
if(count> 0) {
for(i=0;i<count;i++) {
aParent->ChildAt(i, *(getter_AddRefs(childWebShell)));
childWebShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
nsCOMPtr<nsIDocShellTreeItem> child;
parentAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
childAsShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));
if (viewerFile) {
nsCOMPtr<nsIWebShell> childWebShell(do_QueryInterface(child));
NS_ENSURE_SUCCESS(viewerFile->PrintContent(childWebShell,aDContext), NS_ERROR_FAILURE);
}
}
@ -1271,22 +1277,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetDefaultCharacterSet(const PRUnichar* aDefau
{
mDefaultCharacterSet = aDefaultCharacterSet; // this does a copy of aDefaultCharacterSet
// now set the default char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1321,22 +1327,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetForceCharacterSet(const PRUnichar* aForceCh
{
mForceCharacterSet = aForceCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1380,22 +1386,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSetSource(PRInt32 aHintCharact
{
mHintCharsetSource = (nsCharsetSource)aHintCharacterSetSource;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1413,22 +1419,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSet(const PRUnichar* aHintChar
{
mHintCharset = aHintCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);

Просмотреть файл

@ -86,7 +86,7 @@
#include "nsIClipboard.h"
#include "nsITransferable.h"
#include "nsIFormatConverter.h"
#include "nsIWebShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIBrowserWindow.h"
#include "nsIURI.h"
#include "nsIEventQueue.h"
@ -130,7 +130,6 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIScrollableFrameIID, NS_ISCROLLABLE_FRAME_IID);
// Largest chunk size we recycle
@ -774,13 +773,12 @@ PresShell::Init(nsIDocument* aDocument,
nsCOMPtr<nsISupports> container;
result = aPresContext->GetContainer(getter_AddRefs(container));
if (NS_SUCCEEDED(result) && container) {
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(container,&result);
if (NS_SUCCEEDED(result) && webShell){
nsWebShellType webShellType;
result = webShell->GetWebShellType(webShellType);
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
if (NS_SUCCEEDED(result) && docShell){
PRInt32 docShellType;
result = docShell->GetItemType(&docShellType);
if (NS_SUCCEEDED(result)){
if (nsWebShellContent == webShellType){
if (nsIDocShellTreeItem::typeContent == docShellType){
mDocument->SetDisplaySelection(PR_TRUE);
}
}
@ -2613,16 +2611,6 @@ PresShell::HandleEvent(nsIView *aView,
if (nsnull != frame) {
PushCurrentEventFrame();
nsIWebShell* webShell = nsnull;
nsISupports* container;
mPresContext->GetContainer(&container);
if (nsnull != container) {
if (NS_OK != container->QueryInterface(kIWebShellIID, (void**)&webShell)) {
NS_ASSERTION(webShell, "No webshell to grab during event dispatch");
}
NS_RELEASE(container);
}
nsIEventStateManager *manager;
nsIContent* focusContent = nsnull;
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
@ -2674,7 +2662,6 @@ PresShell::HandleEvent(nsIView *aView,
NS_IF_RELEASE(focusContent);
}
PopCurrentEventFrame();
NS_IF_RELEASE(webShell);
}
else {
rv = NS_OK;

Просмотреть файл

@ -60,6 +60,9 @@
#include "nsIContentViewerFile.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShell.h"
#include "nsIServiceManager.h"
@ -566,16 +569,19 @@ DocumentViewerImpl::PrintContent(nsIWebShell *aParent,nsIDeviceContext *aDConte
nsIView *view;
nsresult rv;
PRInt32 count,i;
nsCOMPtr<nsIWebShell> childWebShell;
nsCOMPtr<nsIContentViewer> viewer;
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(aParent));
aParent->GetChildCount(count);
parentAsNode->GetChildCount(&count);
if(count> 0) {
for(i=0;i<count;i++) {
aParent->ChildAt(i, *(getter_AddRefs(childWebShell)));
childWebShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
nsCOMPtr<nsIDocShellTreeItem> child;
parentAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
childAsShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));
if (viewerFile) {
nsCOMPtr<nsIWebShell> childWebShell(do_QueryInterface(child));
NS_ENSURE_SUCCESS(viewerFile->PrintContent(childWebShell,aDContext), NS_ERROR_FAILURE);
}
}
@ -1271,22 +1277,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetDefaultCharacterSet(const PRUnichar* aDefau
{
mDefaultCharacterSet = aDefaultCharacterSet; // this does a copy of aDefaultCharacterSet
// now set the default char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1321,22 +1327,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetForceCharacterSet(const PRUnichar* aForceCh
{
mForceCharacterSet = aForceCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1380,22 +1386,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSetSource(PRInt32 aHintCharact
{
mHintCharsetSource = (nsCharsetSource)aHintCharacterSetSource;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
@ -1413,22 +1419,22 @@ NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSet(const PRUnichar* aHintChar
{
mHintCharset = aHintCharacterSet;
// now set the force char set on all children of mContainer
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(mContainer);
if (webShell)
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));
if (docShellNode)
{
nsCOMPtr<nsIWebShell> childWebShell;
PRInt32 i;
PRInt32 n;
webShell->GetChildCount(n);
docShellNode->GetChildCount(&n);
for (i=0; i < n; i++)
{
webShell->ChildAt(i, *(getter_AddRefs(childWebShell)));
NS_WARN_IF_FALSE(childWebShell, "null child in docshell");
if (childWebShell)
nsCOMPtr<nsIDocShellTreeItem> child;
docShellNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
NS_ASSERTION(childAsShell, "null child in docshell");
if (childAsShell)
{
nsCOMPtr<nsIContentViewer> childCV;
childWebShell->GetContentViewer(getter_AddRefs(childCV));
childAsShell->GetContentViewer(getter_AddRefs(childCV));
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
// Class IDs
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
@ -834,15 +835,16 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
if ((NS_OK == rv) && (nsnull != cont))
{
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
if (NS_OK == rv)
if (docShellItem)
{
nsCOMPtr<nsIWebShell> rootWebShell;
nsCOMPtr<nsIDocShellTreeItem> root;
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
docShellItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (nsnull != rootWebShell)
nsCOMPtr<nsIWebShell> rootWebShell(do_QueryInterface(root));
if (rootWebShell)
{
nsCOMPtr<nsIWebShellContainer> rootContainer;

Просмотреть файл

@ -24,6 +24,9 @@
#include "nsHTMLContainerFrame.h"
#include "nsIHTMLContent.h"
#include "nsIWebShell.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIBaseWindow.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
@ -687,7 +690,8 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
GetParentContent(content);
mWebShell = do_CreateInstance(kWebShellCID);
NS_ENSURE_TRUE(mWebShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mWebShell));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
// pass along marginwidth, marginheight, scrolling so sub document can use it
mWebShell->SetMarginWidth(GetMarginWidth(aPresContext, content));
@ -697,7 +701,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
mWebShell->SetScrolling(GetScrolling(content, mode));
nsString frameName;
if (GetName(content, frameName)) {
mWebShell->SetName(frameName.GetUnicode());
docShellAsItem->SetName(frameName.GetUnicode());
}
// If our container is a web-shell, inform it that it has a new
@ -706,10 +710,9 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
nsISupports* container;
aPresContext->GetContainer(&container);
if (nsnull != container) {
nsIWebShell* outerShell = nsnull;
container->QueryInterface(kIWebShellIID, (void**) &outerShell);
if (nsnull != outerShell) {
outerShell->AddChild(mWebShell);
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(container));
if (parentAsNode) {
parentAsNode->AddChild(docShellAsItem);
// connect the container...
nsIWebShellContainer* outerContainer = nsnull;
@ -720,8 +723,9 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
}
#ifdef INCLUDE_XUL
nsWebShellType parentType;
outerShell->GetWebShellType(parentType);
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsNode));
PRInt32 parentType;
parentAsItem->GetItemType(&parentType);
nsIAtom* typeAtom = NS_NewAtom("type");
nsAutoString value, valuePiece;
PRBool isContent;
@ -740,20 +744,19 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
}
if (isContent) {
// The web shell's type is content.
mWebShell->SetWebShellType(nsWebShellContent);
nsCOMPtr<nsIWebShellContainer> shellAsContainer;
shellAsContainer = do_QueryInterface(mWebShell);
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent);
nsCOMPtr<nsIWebShellContainer> shellAsContainer(do_QueryInterface(mWebShell));
shellAsContainer->ContentShellAdded(mWebShell, content);
} else {
// Inherit our type from our parent webshell. If it is
// chrome, we'll be chrome. If it is content, we'll be
// content.
mWebShell->SetWebShellType(parentType);
docShellAsItem->SetItemType(parentType);
}
// Make sure all shells have links back to the content element in the
// nearest enclosing chrome shell.
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
if (parentType == nsWebShellChrome) {
// Our parent shell is a chrome shell. It is therefore our nearest
@ -764,20 +767,18 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
else {
// Our parent shell is a content shell. Get the chrome info from
// it and use that for our shell as well.
outerShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
}
mWebShell->SetChromeEventHandler(chromeEventHandler);
#endif // INCLUDE_XUL
nsIPref* outerPrefs = nsnull; // connect the prefs
outerShell->GetPrefs(outerPrefs);
if (nsnull != outerPrefs) {
mWebShell->SetPrefs(outerPrefs);
NS_RELEASE(outerPrefs);
nsCOMPtr<nsIPref> parentPrefs; // connect the prefs
parentShell->GetPrefs(getter_AddRefs(parentPrefs));
if (parentPrefs) {
mWebShell->SetPrefs(parentPrefs);
}
NS_RELEASE(outerShell);
}
NS_RELEASE(container);
}

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsLayoutAtoms.h"
#include "nsIDocShellTreeItem.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -1733,50 +1734,40 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg)
if (nsnull != mContext)
{
nsISupports *cont;
nsCOMPtr<nsISupports> cont;
rv = mContext->GetContainer(&cont);
rv = mContext->GetContainer(getter_AddRefs(cont));
if ((NS_OK == rv) && (nsnull != cont))
{
nsIWebShell *ws;
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
if (NS_OK == rv)
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
if (docShellItem)
{
nsIWebShell *rootWebShell;
nsCOMPtr<nsIDocShellTreeItem> root;
ws->GetRootWebShell(rootWebShell);
docShellItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (nsnull != rootWebShell)
nsCOMPtr<nsIWebShell> rootWebShell(do_QueryInterface(root));
if (rootWebShell)
{
nsIWebShellContainer *rootContainer;
nsCOMPtr<nsIWebShellContainer> rootContainer;
rv = rootWebShell->GetContainer(rootContainer);
rv = rootWebShell->GetContainer(*getter_AddRefs(rootContainer));
if (nsnull != rootContainer)
{
nsIBrowserWindow *browserWindow;
nsCOMPtr<nsIBrowserWindow> browserWindow(do_QueryInterface(rootContainer));
if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow))
if (rootContainer)
{
nsAutoString msg = nsAutoString(aStatusMsg);
rv = browserWindow->SetStatus(msg.GetUnicode());
NS_RELEASE(browserWindow);
}
NS_RELEASE(rootContainer);
}
NS_RELEASE(rootWebShell);
}
NS_RELEASE(ws);
}
NS_RELEASE(cont);
}
}

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsLayoutAtoms.h"
#include "nsIDocShellTreeItem.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -1733,50 +1734,40 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg)
if (nsnull != mContext)
{
nsISupports *cont;
nsCOMPtr<nsISupports> cont;
rv = mContext->GetContainer(&cont);
rv = mContext->GetContainer(getter_AddRefs(cont));
if ((NS_OK == rv) && (nsnull != cont))
{
nsIWebShell *ws;
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
if (NS_OK == rv)
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
if (docShellItem)
{
nsIWebShell *rootWebShell;
nsCOMPtr<nsIDocShellTreeItem> root;
ws->GetRootWebShell(rootWebShell);
docShellItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (nsnull != rootWebShell)
nsCOMPtr<nsIWebShell> rootWebShell(do_QueryInterface(root));
if (rootWebShell)
{
nsIWebShellContainer *rootContainer;
nsCOMPtr<nsIWebShellContainer> rootContainer;
rv = rootWebShell->GetContainer(rootContainer);
rv = rootWebShell->GetContainer(*getter_AddRefs(rootContainer));
if (nsnull != rootContainer)
{
nsIBrowserWindow *browserWindow;
nsCOMPtr<nsIBrowserWindow> browserWindow(do_QueryInterface(rootContainer));
if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow))
if (rootContainer)
{
nsAutoString msg = nsAutoString(aStatusMsg);
rv = browserWindow->SetStatus(msg.GetUnicode());
NS_RELEASE(browserWindow);
}
NS_RELEASE(rootContainer);
}
NS_RELEASE(rootWebShell);
}
NS_RELEASE(ws);
}
NS_RELEASE(cont);
}
}

Просмотреть файл

@ -86,7 +86,7 @@
#include "nsIClipboard.h"
#include "nsITransferable.h"
#include "nsIFormatConverter.h"
#include "nsIWebShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIBrowserWindow.h"
#include "nsIURI.h"
#include "nsIEventQueue.h"
@ -130,7 +130,6 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIScrollableFrameIID, NS_ISCROLLABLE_FRAME_IID);
// Largest chunk size we recycle
@ -774,13 +773,12 @@ PresShell::Init(nsIDocument* aDocument,
nsCOMPtr<nsISupports> container;
result = aPresContext->GetContainer(getter_AddRefs(container));
if (NS_SUCCEEDED(result) && container) {
nsCOMPtr<nsIWebShell> webShell;
webShell = do_QueryInterface(container,&result);
if (NS_SUCCEEDED(result) && webShell){
nsWebShellType webShellType;
result = webShell->GetWebShellType(webShellType);
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
if (NS_SUCCEEDED(result) && docShell){
PRInt32 docShellType;
result = docShell->GetItemType(&docShellType);
if (NS_SUCCEEDED(result)){
if (nsWebShellContent == webShellType){
if (nsIDocShellTreeItem::typeContent == docShellType){
mDocument->SetDisplaySelection(PR_TRUE);
}
}
@ -2613,16 +2611,6 @@ PresShell::HandleEvent(nsIView *aView,
if (nsnull != frame) {
PushCurrentEventFrame();
nsIWebShell* webShell = nsnull;
nsISupports* container;
mPresContext->GetContainer(&container);
if (nsnull != container) {
if (NS_OK != container->QueryInterface(kIWebShellIID, (void**)&webShell)) {
NS_ASSERTION(webShell, "No webshell to grab during event dispatch");
}
NS_RELEASE(container);
}
nsIEventStateManager *manager;
nsIContent* focusContent = nsnull;
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
@ -2674,7 +2662,6 @@ PresShell::HandleEvent(nsIView *aView,
NS_IF_RELEASE(focusContent);
}
PopCurrentEventFrame();
NS_IF_RELEASE(webShell);
}
else {
rv = NS_OK;

Просмотреть файл

@ -24,6 +24,9 @@
#include "nsHTMLContainerFrame.h"
#include "nsIHTMLContent.h"
#include "nsIWebShell.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIBaseWindow.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
@ -687,7 +690,8 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
GetParentContent(content);
mWebShell = do_CreateInstance(kWebShellCID);
NS_ENSURE_TRUE(mWebShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mWebShell));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
// pass along marginwidth, marginheight, scrolling so sub document can use it
mWebShell->SetMarginWidth(GetMarginWidth(aPresContext, content));
@ -697,7 +701,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
mWebShell->SetScrolling(GetScrolling(content, mode));
nsString frameName;
if (GetName(content, frameName)) {
mWebShell->SetName(frameName.GetUnicode());
docShellAsItem->SetName(frameName.GetUnicode());
}
// If our container is a web-shell, inform it that it has a new
@ -706,10 +710,9 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
nsISupports* container;
aPresContext->GetContainer(&container);
if (nsnull != container) {
nsIWebShell* outerShell = nsnull;
container->QueryInterface(kIWebShellIID, (void**) &outerShell);
if (nsnull != outerShell) {
outerShell->AddChild(mWebShell);
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(container));
if (parentAsNode) {
parentAsNode->AddChild(docShellAsItem);
// connect the container...
nsIWebShellContainer* outerContainer = nsnull;
@ -720,8 +723,9 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
}
#ifdef INCLUDE_XUL
nsWebShellType parentType;
outerShell->GetWebShellType(parentType);
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsNode));
PRInt32 parentType;
parentAsItem->GetItemType(&parentType);
nsIAtom* typeAtom = NS_NewAtom("type");
nsAutoString value, valuePiece;
PRBool isContent;
@ -740,20 +744,19 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
}
if (isContent) {
// The web shell's type is content.
mWebShell->SetWebShellType(nsWebShellContent);
nsCOMPtr<nsIWebShellContainer> shellAsContainer;
shellAsContainer = do_QueryInterface(mWebShell);
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent);
nsCOMPtr<nsIWebShellContainer> shellAsContainer(do_QueryInterface(mWebShell));
shellAsContainer->ContentShellAdded(mWebShell, content);
} else {
// Inherit our type from our parent webshell. If it is
// chrome, we'll be chrome. If it is content, we'll be
// content.
mWebShell->SetWebShellType(parentType);
docShellAsItem->SetItemType(parentType);
}
// Make sure all shells have links back to the content element in the
// nearest enclosing chrome shell.
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
if (parentType == nsWebShellChrome) {
// Our parent shell is a chrome shell. It is therefore our nearest
@ -764,20 +767,18 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext* aPresContext,
else {
// Our parent shell is a content shell. Get the chrome info from
// it and use that for our shell as well.
outerShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
}
mWebShell->SetChromeEventHandler(chromeEventHandler);
#endif // INCLUDE_XUL
nsIPref* outerPrefs = nsnull; // connect the prefs
outerShell->GetPrefs(outerPrefs);
if (nsnull != outerPrefs) {
mWebShell->SetPrefs(outerPrefs);
NS_RELEASE(outerPrefs);
nsCOMPtr<nsIPref> parentPrefs; // connect the prefs
parentShell->GetPrefs(getter_AddRefs(parentPrefs));
if (parentPrefs) {
mWebShell->SetPrefs(parentPrefs);
}
NS_RELEASE(outerShell);
}
NS_RELEASE(container);
}

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIWebShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIContent.h"
#include "nsITextContent.h"
#include "nsIPresContext.h"
@ -1568,13 +1569,13 @@ nsXMLContentSink::StartLayout()
NS_RELEASE(url);
}
PRBool topLevelFrameset = PR_FALSE;
if (mWebShell) {
nsIWebShell* rootWebShell;
mWebShell->GetRootWebShell(rootWebShell);
if (mWebShell == rootWebShell) {
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mWebShell));
if (docShellAsItem) {
nsCOMPtr<nsIDocShellTreeItem> root;
docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if(docShellAsItem.get() == root.get()) {
topLevelFrameset = PR_TRUE;
}
NS_IF_RELEASE(rootWebShell);
}
if ((nsnull != ref) || topLevelFrameset) {

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
// Class IDs
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
@ -834,15 +835,16 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
if ((NS_OK == rv) && (nsnull != cont))
{
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
if (NS_OK == rv)
if (docShellItem)
{
nsCOMPtr<nsIWebShell> rootWebShell;
nsCOMPtr<nsIDocShellTreeItem> root;
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
docShellItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (nsnull != rootWebShell)
nsCOMPtr<nsIWebShell> rootWebShell(do_QueryInterface(root));
if (rootWebShell)
{
nsCOMPtr<nsIWebShellContainer> rootContainer;

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestor.h"
#include "nsIDocShellTreeItem.h"
// Class IDs
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
@ -834,15 +835,16 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
if ((NS_OK == rv) && (nsnull != cont))
{
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
if (NS_OK == rv)
if (docShellItem)
{
nsCOMPtr<nsIWebShell> rootWebShell;
nsCOMPtr<nsIDocShellTreeItem> root;
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
docShellItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (nsnull != rootWebShell)
nsCOMPtr<nsIWebShell> rootWebShell(do_QueryInterface(root));
if (rootWebShell)
{
nsCOMPtr<nsIWebShellContainer> rootContainer;