timeless%mac.com 2006-05-17 02:33:59 +00:00
Родитель 136e2ed764
Коммит 8ed4ae4bd0
1 изменённых файлов: 20 добавлений и 19 удалений

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
@ -253,12 +253,22 @@ inLayoutUtils::GetSubDocumentFor(nsIDOMNode* aNode)
nsCOMPtr<nsIDocument> doc;
content->GetDocument(*getter_AddRefs(doc));
if (doc) {
nsCOMPtr<nsIDocument> sub_doc;
doc->GetSubDocumentFor(content, getter_AddRefs(sub_doc));
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(sub_doc));
return domdoc;
nsCOMPtr<nsIPresShell> shell;
doc->GetShellAt(0, getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsISupports> supports;
shell->GetSubShellFor(content, getter_AddRefs(supports));
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(supports);
if (docShell) {
nsCOMPtr<nsIContentViewer> contentViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (contentViewer) {
nsCOMPtr<nsIDOMDocument> domdoc;
contentViewer->GetDOMDocument(getter_AddRefs(domdoc));
return domdoc;
}
}
}
}
}
@ -269,7 +279,6 @@ nsIDOMNode*
inLayoutUtils::GetContainerFor(nsIDOMDocument* aDoc)
{
nsCOMPtr<nsIDOMNode> container;
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDoc));
// get the doc shell for this document and look for the parent doc shell
nsCOMPtr<nsIDOMWindowInternal> win = inLayoutUtils::GetWindowFor(aDoc);
@ -288,17 +297,9 @@ inLayoutUtils::GetContainerFor(nsIDOMDocument* aDoc)
nsCOMPtr<nsIPresShell> presShell;
parentDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIDocument> parent_doc;
presShell->GetDocument(getter_AddRefs(parent_doc));
nsCOMPtr<nsIDOMNode> node;
if (parent_doc) {
nsCOMPtr<nsIContent> content;
parent_doc->FindContentForSubDocument(doc, getter_AddRefs(content));
node = do_QueryInterface(content);
}
nsCOMPtr<nsIContent> content;
presShell->FindContentForShell(docShell, getter_AddRefs(content));
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
return node;
}