mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Implementing nsHTMLObjectElement::GetContentDocument, patch by adu@sparc.spb.su bug 36240 r=peterl sr=jst
This commit is contained in:
parent
1d1a9ed4e4
commit
edc2bd61e5
@ -41,6 +41,10 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
||||
class nsHTMLObjectElement : public nsGenericHTMLContainerElement,
|
||||
public nsIDOMHTMLObjectElement
|
||||
@ -183,8 +187,32 @@ NS_IMETHODIMP
|
||||
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentDocument);
|
||||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
if (!tmp) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
||||
class nsHTMLObjectElement : public nsGenericHTMLContainerElement,
|
||||
public nsIDOMHTMLObjectElement
|
||||
@ -183,8 +187,32 @@ NS_IMETHODIMP
|
||||
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentDocument);
|
||||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
if (!tmp) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user