cvs update -j1.43 -j1.42 mozilla/accessible/src/base/nsAccessibilityService.cpp

backout overflow
This commit is contained in:
timeless%mac.com 2002-04-05 06:42:15 +00:00
Родитель 544e7509cb
Коммит bd7550e353
1 изменённых файлов: 37 добавлений и 42 удалений

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

@ -130,28 +130,17 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW
return NS_OK;
}
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
nsIPresShell **aOwnerShell,
nsIContent **aOwnerContent)
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
{
*aOwnerShell = nsnull;
*aOwnerContent = nsnull;
nsCOMPtr<nsIPresContext> presContext;
aPresShell->GetPresContext(getter_AddRefs(presContext));
if (!presContext)
return;
nsCOMPtr<nsIDocument> doc;
aPresShell->GetDocument(getter_AddRefs(doc));
if (!doc)
return;
nsCOMPtr<nsISupports> pcContainer;
presContext->GetContainer(getter_AddRefs(pcContainer));
if (!pcContainer)
return;
nsCOMPtr<nsISupports> docShellSupports(do_QueryInterface(pcContainer));
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(pcContainer));
if (!treeItem)
@ -177,11 +166,17 @@ void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
if (!parentDoc)
return;
parentDoc->FindContentForSubDocument(doc, aOwnerContent);
nsCOMPtr<nsIContent> rootContent;
parentDoc->GetRootContent(getter_AddRefs(rootContent));
if (*aOwnerContent) {
nsCOMPtr<nsIContent> tempContent;
parentPresShell->FindContentForShell(docShellSupports, getter_AddRefs(tempContent));
if (tempContent) {
*aOwnerContent = tempContent;
*aOwnerShell = parentPresShell;
NS_ADDREF(*aOwnerShell);
NS_ADDREF(*aOwnerContent);
}
}
@ -255,46 +250,46 @@ nsAccessibilityService::CreateIFrameAccessible(nsIDOMNode* aDOMNode, nsIAccessib
NS_WARNING("No outer pres shell in CreateHTMLIFrameAccessible!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIPresContext> outerPresContext;
outerPresShell->GetPresContext(getter_AddRefs(outerPresContext));
if (!outerPresContext) {
NS_WARNING("No outer pres context in CreateHTMLIFrameAccessible!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocument> doc;
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
nsCOMPtr<nsIDocument> sub_doc;
doc->GetSubDocumentFor(content, getter_AddRefs(sub_doc));
if (sub_doc) {
nsCOMPtr<nsIPresShell> innerPresShell;
sub_doc->GetShellAt(0, getter_AddRefs(innerPresShell));
if (innerPresShell) {
nsCOMPtr<nsIWeakReference> innerWeakShell =
do_GetWeakReference(innerPresShell);
nsCOMPtr<nsIAccessible> innerRootAccessible =
new nsHTMLIFrameRootAccessible(aDOMNode, innerWeakShell);
if (innerRootAccessible) {
nsHTMLIFrameAccessible* outerRootAccessible =
new nsHTMLIFrameAccessible(aDOMNode, innerRootAccessible,
outerWeakShell, sub_doc);
if (outerRootAccessible) {
*_retval = outerRootAccessible;
NS_ADDREF(*_retval);
return NS_OK;
if (outerPresShell) {
nsCOMPtr<nsISupports> supps;
outerPresShell->GetSubShellFor(content, getter_AddRefs(supps));
if (supps) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
if (docShell) {
nsCOMPtr<nsIPresShell> innerPresShell;
docShell->GetPresShell(getter_AddRefs(innerPresShell));
if (innerPresShell) {
nsCOMPtr<nsIWeakReference> innerWeakShell(do_GetWeakReference(innerPresShell));
nsCOMPtr<nsIDocument> innerDoc;
innerPresShell->GetDocument(getter_AddRefs(innerDoc));
if (innerDoc) {
nsCOMPtr<nsIAccessible> innerRootAccessible(new nsHTMLIFrameRootAccessible(aDOMNode, innerWeakShell));
if (innerRootAccessible) {
nsHTMLIFrameAccessible* outerRootAccessible = new nsHTMLIFrameAccessible(aDOMNode, innerRootAccessible, outerWeakShell, innerDoc);
if (outerRootAccessible) {
*_retval = NS_STATIC_CAST(nsIAccessible*, outerRootAccessible);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
}
}
}
}
}
}
}
}
return NS_ERROR_FAILURE;
}