зеркало из https://github.com/mozilla/pjs.git
Add an nsIDocument* GetOwnerDocument() to nsGenericElement, deCOMify
nsINodeInfo a tad. Bug 211634, r=jkeiser, sr=jst
This commit is contained in:
Родитель
9915e0fd45
Коммит
76799ff743
|
@ -282,7 +282,7 @@ public:
|
|||
/*
|
||||
* Retrieve a pointer to the document that owns this node info.
|
||||
*/
|
||||
NS_IMETHOD GetDocument(nsIDocument** aDocument) const = 0;
|
||||
virtual nsIDocument* GetDocument() const = 0;
|
||||
|
||||
/*
|
||||
* Retrieve a pointer to the principal for the document of this node info.
|
||||
|
@ -360,7 +360,7 @@ public:
|
|||
* Retrieve a pointer to the document that owns this node info
|
||||
* manager.
|
||||
*/
|
||||
NS_IMETHOD GetDocument(nsIDocument** aDocument) = 0;
|
||||
virtual nsIDocument* GetDocument() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the principal of the document associated with this.
|
||||
|
|
|
@ -787,7 +787,7 @@ nsContentUtils::ReparentContentWrapper(nsIContent *aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> old_doc(aOldDocument);
|
||||
nsIDocument* old_doc = aOldDocument;
|
||||
|
||||
if (!old_doc) {
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
@ -795,7 +795,7 @@ nsContentUtils::ReparentContentWrapper(nsIContent *aContent,
|
|||
aContent->GetNodeInfo(getter_AddRefs(ni));
|
||||
|
||||
if (ni) {
|
||||
ni->GetDocument(getter_AddRefs(old_doc));
|
||||
old_doc = ni->GetDocument();
|
||||
}
|
||||
|
||||
if (!old_doc) {
|
||||
|
|
|
@ -1145,13 +1145,7 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwnerDocument);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
|
||||
if (!doc) {
|
||||
// If we're not part of the document we can check if our nodeinfo
|
||||
// can get at the document
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
nsIDocument* doc = GetOwnerDocument();
|
||||
|
||||
if (doc) {
|
||||
return CallQueryInterface(doc, aOwnerDocument);
|
||||
|
@ -1776,9 +1770,7 @@ nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
|||
if (aDocument) {
|
||||
// check the document on the nodeinfo to see whether we need a
|
||||
// new nodeinfo
|
||||
nsCOMPtr<nsIDocument> nodeinfoDoc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(nodeinfoDoc));
|
||||
if (aDocument != nodeinfoDoc) {
|
||||
if (aDocument != mNodeInfo->GetDocument()) {
|
||||
// get a new nodeinfo
|
||||
nsCOMPtr<nsIAtom> name = mNodeInfo->GetNameAtom();
|
||||
nsCOMPtr<nsIAtom> prefix = mNodeInfo->GetPrefixAtom();
|
||||
|
@ -2246,11 +2238,7 @@ nsGenericElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
NS_IMETHODIMP
|
||||
nsGenericElement::GetBaseURL(nsIURI** aBaseURL) const
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = mDocument;
|
||||
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
nsIDocument* doc = GetOwnerDocument();
|
||||
|
||||
// Our base URL depends on whether we have an xml:base attribute, as
|
||||
// well as on whether any of our ancestors do.
|
||||
|
@ -2893,10 +2881,6 @@ nsGenericElement::doReplaceChild(nsIDOMNode* aNewChild,
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
|
||||
GetDocument(getter_AddRefs(document));
|
||||
|
||||
/*
|
||||
* Make sure the new child is not "this" node or one of this nodes
|
||||
* ancestors. Doing this check here should be safe even if newContent
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
|
@ -697,6 +698,11 @@ protected:
|
|||
sEventListenerManagersHash.ops);
|
||||
}
|
||||
|
||||
nsIDocument* GetOwnerDocument() const
|
||||
{
|
||||
return mDocument ? mDocument : mNodeInfo->GetDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* The document for this content
|
||||
*/
|
||||
|
|
|
@ -237,6 +237,13 @@ nsImageLoadingContent::GetImageBlocked(PRBool* aBlocked)
|
|||
*aBlocked = mImageIsBlocked;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::GetImageURI(nsIURI** aURI)
|
||||
{
|
||||
NS_NOTREACHED("Subclasses need to implement this");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::AddObserver(imgIDecoderObserver* aObserver)
|
||||
|
@ -565,10 +572,11 @@ nsImageLoadingContent::GetOurDocument(nsIDocument** aDocument)
|
|||
|
||||
rv = thisContent->GetDocument(aDocument);
|
||||
if (!*aDocument) { // nodeinfo time
|
||||
// XXXbz GetOwnerDocument
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
rv = thisContent->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
if (nodeInfo) {
|
||||
rv = nodeInfo->GetDocument(aDocument);
|
||||
NS_IF_ADDREF(*aDocument = nodeInfo->GetDocument());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,10 +288,10 @@ nsNodeInfo::PrefixChanged(nsIAtom *aPrefix, nsINodeInfo** aResult)
|
|||
aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeInfo::GetDocument(nsIDocument** aDocument) const
|
||||
nsIDocument*
|
||||
nsNodeInfo::GetDocument() const
|
||||
{
|
||||
return mOwnerManager->GetDocument(aDocument);
|
||||
return mOwnerManager->GetDocument();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -70,7 +70,8 @@ public:
|
|||
|
||||
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo** aResult);
|
||||
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo** aResult);
|
||||
NS_IMETHOD GetDocument(nsIDocument** aDocument) const;
|
||||
|
||||
virtual nsIDocument* GetDocument() const;
|
||||
NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aPrincipal) const;
|
||||
|
||||
// nsNodeInfo
|
||||
|
|
|
@ -315,12 +315,10 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aQualifiedName,
|
|||
return GetNodeInfo(nameAtom, prefixAtom, nsid, aNodeInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeInfoManager::GetDocument(nsIDocument** aDocument)
|
||||
nsIDocument*
|
||||
nsNodeInfoManager::GetDocument() const
|
||||
{
|
||||
NS_IF_ADDREF(*aDocument = mDocument);
|
||||
|
||||
return NS_OK;
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
NS_IMETHOD GetNodeInfo(const nsAString& aQualifiedName,
|
||||
const nsAString& aNamespaceURI,
|
||||
nsINodeInfo** aNodeInfo);
|
||||
NS_IMETHOD GetDocument(nsIDocument** aDocument);
|
||||
virtual nsIDocument* GetDocument() const;
|
||||
NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aPrincipal);
|
||||
NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal);
|
||||
NS_IMETHOD GetNodeInfoArray(nsISupportsArray** aArray);
|
||||
|
|
|
@ -2672,10 +2672,11 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
|
|||
targetContent->GetDocument(getter_AddRefs(document));
|
||||
|
||||
if (!document) {
|
||||
// XXXbz GetOwnerDocument
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
targetContent->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
if (nodeInfo) {
|
||||
nodeInfo->GetDocument(getter_AddRefs(document));
|
||||
document = nodeInfo->GetDocument();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -850,8 +850,7 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
|
|||
{
|
||||
aInnerHTML.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDocument> doc = GetOwnerDocument();
|
||||
if (!doc) {
|
||||
return NS_OK; // We rely on the document for doing HTML conversion
|
||||
}
|
||||
|
@ -902,8 +901,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
|
|||
|
||||
nsCOMPtr<nsIDOMDocumentFragment> df;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDocument> doc = GetOwnerDocument();
|
||||
|
||||
nsCOMPtr<nsIScriptContext> scx;
|
||||
PRBool scripts_enabled = PR_FALSE;
|
||||
|
@ -2336,11 +2334,7 @@ nsGenericHTMLElement::GetInlineStyleRule(nsIStyleRule** aStyleRule)
|
|||
nsresult
|
||||
nsGenericHTMLElement::GetBaseURL(nsIURI** aBaseURL) const
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
nsIDocument* doc = GetOwnerDocument();
|
||||
|
||||
if (mAttributes &&
|
||||
mAttributes->HasAttribute(nsHTMLAtoms::_baseHref, kNameSpaceID_None)) {
|
||||
|
@ -3077,10 +3071,7 @@ nsGenericHTMLElement::AttrToURI(nsIAtom* aAttrName, nsAString& aAbsoluteURI)
|
|||
nsCOMPtr<nsIURI> baseURI;
|
||||
GetBaseURL(getter_AddRefs(baseURI));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
nsIDocument* doc = GetOwnerDocument();
|
||||
|
||||
nsCOMPtr<nsIURI> attrURI;
|
||||
rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI),
|
||||
|
@ -3124,11 +3115,7 @@ nsGenericHTMLElement::ParseStyleAttribute(const nsAString& aValue, nsHTMLValue&
|
|||
nsresult result = NS_OK;
|
||||
NS_ASSERTION(mNodeInfo, "If we don't have a nodeinfo, we are very screwed");
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = mDocument;
|
||||
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
nsIDocument* doc = GetOwnerDocument();
|
||||
|
||||
if (doc) {
|
||||
PRBool isCSS = PR_TRUE; // assume CSS until proven otherwise
|
||||
|
|
|
@ -384,10 +384,9 @@ nsHTMLAnchorElement::GetProtocol(nsAString& aProtocol)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
return GetProtocolFromHrefString(href, aProtocol, doc);
|
||||
// XXX this should really use GetHrefURI and not do so much string stuff
|
||||
return GetProtocolFromHrefString(href, aProtocol,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -344,10 +344,9 @@ nsHTMLAreaElement::GetProtocol(nsAString& aProtocol)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
return GetProtocolFromHrefString(href, aProtocol, doc);
|
||||
// XXX this should really use GetHrefURI and not do so much string stuff
|
||||
return GetProtocolFromHrefString(href, aProtocol,
|
||||
nsGenericHTMLLeafElement::GetOwnerDocument());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -485,11 +485,8 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
(aAttribute == nsHTMLAtoms::link) ||
|
||||
(aAttribute == nsHTMLAtoms::alink) ||
|
||||
(aAttribute == nsHTMLAtoms::vlink)) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,11 +183,8 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::color) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,11 +234,8 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::bordercolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLLeafElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,11 +350,8 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::bordercolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -512,14 +509,8 @@ nsHTMLFrameSetElement::ParseRowColSpec(nsString& aSpec,
|
|||
|
||||
// Treat 0* as 1* in quirks mode (bug 40383)
|
||||
nsCompatibility mode = eCompatibility_FullStandards;
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument;
|
||||
if (mDocument) {
|
||||
htmlDocument = do_QueryInterface(mDocument);
|
||||
} else {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
htmlDocument = do_QueryInterface(doc);
|
||||
}
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument =
|
||||
do_QueryInterface(nsGenericHTMLContainerElement::GetOwnerDocument());
|
||||
if (htmlDocument) {
|
||||
htmlDocument->GetCompatibilityMode(mode);
|
||||
}
|
||||
|
|
|
@ -393,11 +393,8 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::bgcolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1029,11 +1029,8 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
else if (aAttribute == nsHTMLAtoms::bgcolor ||
|
||||
aAttribute == nsHTMLAtoms::bordercolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,11 +555,8 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::bgcolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,11 +311,8 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::bgcolor) {
|
||||
nsCOMPtr<nsIDocument> doc(mDocument);
|
||||
if (!doc) {
|
||||
mNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
if (aResult.ParseColor(aValue, doc)) {
|
||||
if (aResult.ParseColor(aValue,
|
||||
nsGenericHTMLContainerElement::GetOwnerDocument())) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,11 +163,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
result = nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
// XXXbz GetOwnerDocument
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
|
||||
mContent->GetBaseURL(aBaseURI);
|
||||
|
||||
|
|
|
@ -1620,8 +1620,7 @@ MathMLElementFactoryImpl::CreateInstanceByTag(nsINodeInfo* aNodeInfo,
|
|||
static const char kMathMLStyleSheetURI[] = "resource:///res/mathml.css";
|
||||
|
||||
// this bit of code is to load mathml.css on demand
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aNodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = aNodeInfo->GetDocument();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIHTMLContentContainer> htmlContainer(do_QueryInterface(doc));
|
||||
if (htmlContainer) {
|
||||
|
|
|
@ -883,8 +883,7 @@ nsXULElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
|||
if (mDocument) {
|
||||
return CallQueryInterface(mDocument, aOwnerDocument);
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
NodeInfo()->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = NodeInfo()->GetDocument();
|
||||
if (doc) {
|
||||
return CallQueryInterface(doc, aOwnerDocument);
|
||||
}
|
||||
|
|
|
@ -155,13 +155,15 @@ NS_IMETHODIMP nsImgManager::ShouldLoad(PRInt32 aContentType,
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(aContext);
|
||||
NS_ASSERTION(content, "no content available");
|
||||
if (content) {
|
||||
// XXXbz GetOwnerDocument
|
||||
rv = content->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || !doc) {
|
||||
rv = content->GetNodeInfo(getter_AddRefs(nodeinfo));
|
||||
if (NS_FAILED(rv) || !nodeinfo) return rv;
|
||||
|
||||
rv = nodeinfo->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || !doc) return rv;
|
||||
doc = nodeinfo->GetDocument();
|
||||
// XXX what should this code do if there is really no document?
|
||||
if (!doc) return NS_OK;
|
||||
}
|
||||
|
||||
rv = doc->GetBaseURL(getter_AddRefs(baseURI));
|
||||
|
|
|
@ -1702,8 +1702,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mContent->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
NS_ASSERTION(nodeInfo, "Image content without a nodeinfo?");
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
nsCAutoString charset;
|
||||
if (doc) {
|
||||
doc->GetDocumentCharacterSet(charset);
|
||||
|
|
|
@ -452,8 +452,7 @@ void RectArea::ParseCoords(const nsAString& aSpec)
|
|||
mArea->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
NS_ASSERTION(nodeInfo, "Element with no nodeinfo");
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
nsCAutoString urlSpec;
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
|
|
@ -1702,8 +1702,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mContent->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
NS_ASSERTION(nodeInfo, "Image content without a nodeinfo?");
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
nsCAutoString charset;
|
||||
if (doc) {
|
||||
doc->GetDocumentCharacterSet(charset);
|
||||
|
|
|
@ -452,8 +452,7 @@ void RectArea::ParseCoords(const nsAString& aSpec)
|
|||
mArea->GetNodeInfo(getter_AddRefs(nodeInfo));
|
||||
NS_ASSERTION(nodeInfo, "Element with no nodeinfo");
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
nsCAutoString urlSpec;
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
|
|
@ -163,11 +163,8 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
|
|||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
result = nodeInfo->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
// XXXbz GetOwnerDocument
|
||||
nsIDocument* doc = nodeInfo->GetDocument();
|
||||
|
||||
mContent->GetBaseURL(aBaseURI);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче