mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 682420 - Rename nsINode::GetOwnerDoc to nsINode::OwnerDoc, part 2, r=jst
--HG-- extra : rebase_source : 53dc2ec386f6e4147587e6be3c53d297ad71d57a
This commit is contained in:
parent
a86b1a4d43
commit
e5b7e8ee46
@ -465,10 +465,8 @@ nsAccessNode::GetLanguage(nsAString& aLanguage)
|
||||
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
|
||||
|
||||
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
|
||||
nsIDocument *doc = mContent->OwnerDoc();
|
||||
if (doc) {
|
||||
doc->GetHeaderData(nsGkAtoms::headerContentLanguage, aLanguage);
|
||||
}
|
||||
mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
|
||||
aLanguage);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -386,11 +386,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
|
||||
if (!aContent)
|
||||
return nsnull;
|
||||
|
||||
nsIDocument *document = aContent->OwnerDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsIPresShell *presShell = document->GetShell();
|
||||
nsIPresShell *presShell = aContent->OwnerDoc()->GetShell();
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
|
@ -207,11 +207,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = aContent->OwnerDoc();
|
||||
if (!doc)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
nsCOMPtr<nsIPresShell> presShell = aContent->OwnerDoc()->GetShell();
|
||||
if (!presShell)
|
||||
return 0;
|
||||
|
||||
@ -439,11 +435,7 @@ nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
|
||||
if (!aNode)
|
||||
return nsnull;
|
||||
|
||||
nsIDocument *doc = aNode->OwnerDoc();
|
||||
NS_ASSERTION(doc, "No document for node passed in");
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
|
||||
nsIDocShellTreeItem *docShellTreeItem = nsnull;
|
||||
if (container)
|
||||
CallQueryInterface(container, &docShellTreeItem);
|
||||
@ -603,11 +595,8 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
return nsnull;
|
||||
|
||||
// Returns number of items in style declaration
|
||||
nsIDocument* document = content->OwnerDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(document->GetWindow());
|
||||
nsCOMPtr<nsIDOMWindow> window =
|
||||
do_QueryInterface(content->OwnerDoc()->GetWindow());
|
||||
if (!window)
|
||||
return nsnull;
|
||||
|
||||
|
@ -254,8 +254,7 @@ public:
|
||||
*/
|
||||
static nsIPresShell *GetPresShellFor(nsINode *aNode)
|
||||
{
|
||||
nsIDocument *document = aNode->OwnerDoc();
|
||||
return document ? document->GetShell() : nsnull;
|
||||
return aNode->OwnerDoc()->GetShell();
|
||||
}
|
||||
static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
|
||||
{
|
||||
|
@ -463,11 +463,7 @@ nsXULMenuitemAccessible::KeyboardShortcut() const
|
||||
if (keyElmId.IsEmpty())
|
||||
return KeyBinding();
|
||||
|
||||
nsIDocument* document = mContent->OwnerDoc();
|
||||
if (!document)
|
||||
return KeyBinding();
|
||||
|
||||
nsIContent* keyElm = document->GetElementById(keyElmId);
|
||||
nsIContent* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
|
||||
if (!keyElm)
|
||||
return KeyBinding();
|
||||
|
||||
|
@ -204,11 +204,7 @@ nsXULSliderAccessible::GetSliderNode()
|
||||
return nsnull;
|
||||
|
||||
if (!mSliderNode) {
|
||||
nsIDocument* document = mContent->OwnerDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(document));
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(mContent->OwnerDoc()));
|
||||
if (!xblDoc)
|
||||
return nsnull;
|
||||
|
||||
|
@ -261,7 +261,7 @@ nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
|
||||
nsIURI* anchorURI = nsnull;
|
||||
NS_NewURI(&anchorURI, href,
|
||||
document ? document->GetDocumentCharacterSet().get() : nsnull,
|
||||
document->GetDocumentCharacterSet().get(),
|
||||
baseURI);
|
||||
|
||||
return anchorURI;
|
||||
|
@ -174,12 +174,8 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
// We need the referer URI for nsIWebBrowserPersist::saveURI
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
doc = content->OwnerDoc();
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIURI *docURI = doc->GetDocumentURI();
|
||||
nsIURI *docURI = content->OwnerDoc()->GetDocumentURI();
|
||||
if (!docURI)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -278,9 +278,7 @@ public:
|
||||
*/
|
||||
inline bool IsInHTMLDocument() const
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
return doc && // XXX clean up after bug 335998 lands
|
||||
doc->IsHTML();
|
||||
return OwnerDoc()->IsHTML();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -847,9 +847,8 @@ nsContentList::Match(Element *aElement)
|
||||
if (toReturn)
|
||||
return toReturn;
|
||||
|
||||
nsIDocument* doc = aElement->OwnerDoc();
|
||||
bool matchHTML = aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
doc && doc->IsHTML();
|
||||
aElement->OwnerDoc()->IsHTML();
|
||||
|
||||
if (unknown) {
|
||||
return matchHTML ? ni->QualifiedNameEquals(mHTMLMatchAtom) :
|
||||
|
@ -3248,9 +3248,6 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
||||
nsINode* aTargetForSubtreeModified)
|
||||
{
|
||||
nsIDocument* doc = aNode->OwnerDoc();
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// global object will be null for documents that don't have windows.
|
||||
nsPIDOMWindow* window = doc->GetInnerWindow();
|
||||
@ -3494,8 +3491,6 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
||||
// If we don't have a document here, we can't get the right security context
|
||||
// for compiling event handlers... so just bail out.
|
||||
nsCOMPtr<nsIDocument> document = aContextNode->OwnerDoc();
|
||||
NS_ENSURE_TRUE(document, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bool isHTML = document->IsHTML();
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
|
||||
@ -4736,15 +4731,9 @@ nsContentUtils::GetContextForEventHandlers(nsINode* aNode,
|
||||
nsresult* aRv)
|
||||
{
|
||||
*aRv = NS_OK;
|
||||
nsIDocument* ownerDoc = aNode->OwnerDoc();
|
||||
if (!ownerDoc) {
|
||||
*aRv = NS_ERROR_UNEXPECTED;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
bool hasHadScriptObject = true;
|
||||
nsIScriptGlobalObject* sgo =
|
||||
ownerDoc->GetScriptHandlingObject(hasHadScriptObject);
|
||||
aNode->OwnerDoc()->GetScriptHandlingObject(hasHadScriptObject);
|
||||
// It is bad if the document doesn't have event handling context,
|
||||
// but it used to have one.
|
||||
if (!sgo && hasHadScriptObject) {
|
||||
@ -5354,7 +5343,6 @@ AllocClassMatchingInfo(nsINode* aRootNode,
|
||||
}
|
||||
|
||||
info->mCaseTreatment =
|
||||
aRootNode->OwnerDoc() &&
|
||||
aRootNode->OwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks ?
|
||||
eIgnoreCase : eCaseMatters;
|
||||
return info;
|
||||
|
@ -181,9 +181,7 @@ nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument)
|
||||
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
NS_ASSERTION(doc != aDocument, "bad call to nsDOMAttribute::SetOwnerDocument");
|
||||
if (doc) {
|
||||
doc->DeleteAllPropertiesFor(this);
|
||||
}
|
||||
doc->DeleteAllPropertiesFor(this);
|
||||
|
||||
nsCOMPtr<nsINodeInfo> newNodeInfo;
|
||||
newNodeInfo = aDocument->NodeInfoManager()->
|
||||
@ -275,10 +273,8 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::GetSpecified(bool* aSpecified)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSpecified);
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eSpecified);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eSpecified);
|
||||
|
||||
*aSpecified = true;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -287,11 +283,7 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eOwnerElement);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
|
||||
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (content) {
|
||||
@ -306,10 +298,7 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeName(nsAString& aNodeName)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNodeName);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeName);
|
||||
|
||||
return GetName(aNodeName);
|
||||
}
|
||||
@ -317,10 +306,7 @@ nsDOMAttribute::GetNodeName(nsAString& aNodeName)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeValue(nsAString& aNodeValue)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNodeValue);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
||||
|
||||
return GetValue(aNodeValue);
|
||||
}
|
||||
@ -328,10 +314,7 @@ nsDOMAttribute::GetNodeValue(nsAString& aNodeValue)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::SetNodeValue(const nsAString& aNodeValue)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNodeValue);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
||||
|
||||
return SetValue(aNodeValue);
|
||||
}
|
||||
@ -340,11 +323,7 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNodeType);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNodeType);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeType);
|
||||
|
||||
*aNodeType = (PRUint16)nsIDOMNode::ATTRIBUTE_NODE;
|
||||
return NS_OK;
|
||||
@ -354,11 +333,7 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentNode);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eParentNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eParentNode);
|
||||
|
||||
*aParentNode = nsnull;
|
||||
return NS_OK;
|
||||
@ -374,10 +349,7 @@ nsDOMAttribute::GetParentElement(nsIDOMElement** aParentElement)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eChildNodes);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eChildNodes);
|
||||
|
||||
return nsINode::GetChildNodes(aChildNodes);
|
||||
}
|
||||
@ -385,10 +357,7 @@ nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::HasChildNodes(bool* aHasChildNodes)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eHasChildNodes);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasChildNodes);
|
||||
|
||||
*aHasChildNodes = mFirstChild != nsnull;
|
||||
|
||||
@ -399,11 +368,7 @@ NS_IMETHODIMP
|
||||
nsDOMAttribute::HasAttributes(bool* aHasAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHasAttributes);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eHasAttributes);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eHasAttributes);
|
||||
|
||||
*aHasAttributes = false;
|
||||
|
||||
@ -415,10 +380,7 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
{
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eFirstChild);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eFirstChild);
|
||||
|
||||
if (mFirstChild) {
|
||||
CallQueryInterface(mFirstChild, aFirstChild);
|
||||
@ -430,10 +392,8 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eLastChild);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eLastChild);
|
||||
|
||||
return GetFirstChild(aLastChild);
|
||||
}
|
||||
|
||||
@ -442,10 +402,7 @@ nsDOMAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::ePreviousSibling);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::ePreviousSibling);
|
||||
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
@ -456,10 +413,7 @@ nsDOMAttribute::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNextSibling);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNextSibling);
|
||||
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
@ -470,10 +424,7 @@ nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eAttributes);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eAttributes);
|
||||
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
@ -482,10 +433,7 @@ nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eInsertBefore);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eInsertBefore);
|
||||
|
||||
return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn);
|
||||
}
|
||||
@ -493,10 +441,7 @@ nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDO
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eReplaceChild);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceChild);
|
||||
|
||||
return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn);
|
||||
}
|
||||
@ -504,10 +449,7 @@ nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDO
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eRemoveChild);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveChild);
|
||||
|
||||
return nsINode::RemoveChild(aOldChild, aReturn);
|
||||
}
|
||||
@ -515,10 +457,7 @@ nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eAppendChild);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eAppendChild);
|
||||
|
||||
return InsertBefore(aNewChild, nsnull, aReturn);
|
||||
}
|
||||
@ -543,10 +482,7 @@ nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::CloneNode(bool aDeep, nsIDOMNode** aResult)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eCloneNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eCloneNode);
|
||||
|
||||
return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult);
|
||||
}
|
||||
@ -554,10 +490,7 @@ nsDOMAttribute::CloneNode(bool aDeep, nsIDOMNode** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eOwnerDocument);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerDocument);
|
||||
|
||||
return nsINode::GetOwnerDocument(aOwnerDocument);
|
||||
}
|
||||
@ -585,10 +518,7 @@ nsDOMAttribute::GetLocalName(nsAString& aLocalName)
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::Normalize()
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eNormalize);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eNormalize);
|
||||
|
||||
// Nothing to do here
|
||||
return NS_OK;
|
||||
@ -599,10 +529,8 @@ nsDOMAttribute::IsSupported(const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eIsSupported);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSupported);
|
||||
|
||||
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
|
||||
aFeature, aVersion, aReturn);
|
||||
}
|
||||
@ -631,40 +559,31 @@ nsDOMAttribute::CompareDocumentPosition(nsIDOMNode *other,
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther, bool* aResult)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eIsEqualNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsEqualNode);
|
||||
|
||||
return nsINode::IsEqualNode(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetTextContent(nsAString &aTextContent)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eTextContent);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
||||
|
||||
return GetNodeValue(aTextContent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::SetTextContent(const nsAString& aTextContent)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eTextContent);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
||||
|
||||
return SetNodeValue(aTextContent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::IsSameNode(nsIDOMNode *other, bool *aResult)
|
||||
{
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eIsSameNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSameNode);
|
||||
|
||||
*aResult = other == this;
|
||||
return NS_OK;
|
||||
|
@ -400,8 +400,7 @@ nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
|
||||
// This could fire in OOM situations
|
||||
// Only assert this in HTML documents for now as XUL does all sorts of weird
|
||||
// crap.
|
||||
NS_ASSERTION(!aElement->OwnerDoc() ||
|
||||
!aElement->OwnerDoc()->IsHTML() ||
|
||||
NS_ASSERTION(!aElement->OwnerDoc()->IsHTML() ||
|
||||
mIdContentList.IndexOf(aElement) >= 0,
|
||||
"Removing id entry that doesn't exist");
|
||||
|
||||
@ -1129,9 +1128,6 @@ nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
|
||||
}
|
||||
|
||||
nsIDocument* doc = aRequestingNode->OwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
|
||||
NS_ENSURE_TRUE(req, NS_ERROR_OUT_OF_MEMORY);
|
||||
@ -4816,12 +4812,10 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument *ownerDoc = imported->OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, ownerDoc,
|
||||
nsIDOMUserDataHandler::NODE_IMPORTED,
|
||||
true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, ownerDoc,
|
||||
nsIDOMUserDataHandler::NODE_IMPORTED,
|
||||
true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
newNode.swap(*aResult);
|
||||
|
||||
|
@ -340,7 +340,7 @@ nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
|
||||
{
|
||||
NS_ENSURE_TRUE(aOwner, nsnull);
|
||||
nsIDocument* doc = aOwner->OwnerDoc();
|
||||
NS_ENSURE_TRUE(doc && !doc->GetDisplayDocument() &&
|
||||
NS_ENSURE_TRUE(!doc->GetDisplayDocument() &&
|
||||
((!doc->IsLoadedAsData() && aOwner->GetCurrentDoc()) ||
|
||||
doc->IsStaticDocument()),
|
||||
nsnull);
|
||||
@ -363,7 +363,7 @@ nsFrameLoader::LoadFrame()
|
||||
}
|
||||
|
||||
nsIDocument* doc = mOwnerContent->OwnerDoc();
|
||||
if (!doc || doc->IsStaticDocument()) {
|
||||
if (doc->IsStaticDocument()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -412,9 +412,6 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
|
||||
NS_ENSURE_STATE(!mDestroyCalled && mOwnerContent);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = mOwnerContent->OwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = CheckURILoad(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1275,11 +1272,8 @@ nsFrameLoader::Destroy()
|
||||
bool dynamicSubframeRemoval = false;
|
||||
if (mOwnerContent) {
|
||||
doc = mOwnerContent->OwnerDoc();
|
||||
|
||||
if (doc) {
|
||||
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
|
||||
doc->SetSubDocumentFor(mOwnerContent, nsnull);
|
||||
}
|
||||
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
|
||||
doc->SetSubDocumentFor(mOwnerContent, nsnull);
|
||||
|
||||
SetOwnerContent(nsnull);
|
||||
}
|
||||
@ -1383,7 +1377,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
// XXXbz this is such a total hack.... We really need to have a
|
||||
// better setup for doing this.
|
||||
nsIDocument* doc = mOwnerContent->OwnerDoc();
|
||||
if (!doc || !(doc->IsStaticDocument() || mOwnerContent->IsInDoc())) {
|
||||
if (!(doc->IsStaticDocument() || mOwnerContent->IsInDoc())) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
|
||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||
}
|
||||
|
||||
nsIDocument* ownerDoc = tmp->OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
||||
}
|
||||
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
|
||||
|
@ -217,12 +217,8 @@ void*
|
||||
nsINode::GetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
|
||||
nsresult *aStatus) const
|
||||
{
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
if (!doc)
|
||||
return nsnull;
|
||||
|
||||
return doc->PropertyTable(aCategory)->GetProperty(this, aPropertyName,
|
||||
aStatus);
|
||||
return OwnerDoc()->PropertyTable(aCategory)->GetProperty(this, aPropertyName,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -230,13 +226,12 @@ nsINode::SetProperty(PRUint16 aCategory, nsIAtom *aPropertyName, void *aValue,
|
||||
NSPropertyDtorFunc aDtor, bool aTransfer,
|
||||
void **aOldValue)
|
||||
{
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = doc->PropertyTable(aCategory)->SetProperty(this,
|
||||
aPropertyName, aValue, aDtor,
|
||||
nsnull, aTransfer, aOldValue);
|
||||
nsresult rv = OwnerDoc()->PropertyTable(aCategory)->SetProperty(this,
|
||||
aPropertyName,
|
||||
aValue, aDtor,
|
||||
nsnull,
|
||||
aTransfer,
|
||||
aOldValue);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetFlags(NODE_HAS_PROPERTIES);
|
||||
}
|
||||
@ -247,21 +242,16 @@ nsINode::SetProperty(PRUint16 aCategory, nsIAtom *aPropertyName, void *aValue,
|
||||
void
|
||||
nsINode::DeleteProperty(PRUint16 aCategory, nsIAtom *aPropertyName)
|
||||
{
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
if (doc)
|
||||
doc->PropertyTable(aCategory)->DeleteProperty(this, aPropertyName);
|
||||
OwnerDoc()->PropertyTable(aCategory)->DeleteProperty(this, aPropertyName);
|
||||
}
|
||||
|
||||
void*
|
||||
nsINode::UnsetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
|
||||
nsresult *aStatus)
|
||||
{
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
if (!doc)
|
||||
return nsnull;
|
||||
|
||||
return doc->PropertyTable(aCategory)->UnsetProperty(this, aPropertyName,
|
||||
aStatus);
|
||||
return OwnerDoc()->PropertyTable(aCategory)->UnsetProperty(this,
|
||||
aPropertyName,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
nsINode::nsSlots*
|
||||
@ -1345,12 +1335,10 @@ nsIContent::GetFlattenedTreeParent() const
|
||||
nsIContent *parent = GetParent();
|
||||
if (parent && parent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
nsIDocument *doc = parent->OwnerDoc();
|
||||
if (doc) {
|
||||
nsIContent* insertionElement =
|
||||
doc->BindingManager()->GetNestedInsertionPoint(parent, this);
|
||||
if (insertionElement) {
|
||||
parent = insertionElement;
|
||||
}
|
||||
nsIContent* insertionElement =
|
||||
doc->BindingManager()->GetNestedInsertionPoint(parent, this);
|
||||
if (insertionElement) {
|
||||
parent = insertionElement;
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
@ -1463,13 +1451,6 @@ already_AddRefed<nsIURI>
|
||||
nsIContent::GetBaseURI() const
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (!doc) {
|
||||
// We won't be able to do security checks, etc. So don't go any
|
||||
// further. That said, this really shouldn't happen...
|
||||
NS_ERROR("Element without owner document");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Start with document base
|
||||
nsCOMPtr<nsIURI> base = doc->GetDocBaseURI();
|
||||
|
||||
@ -1486,18 +1467,15 @@ nsIContent::GetBaseURI() const
|
||||
if (elem->IsSVG()) {
|
||||
nsIContent* bindingParent = elem->GetBindingParent();
|
||||
if (bindingParent) {
|
||||
nsIDocument* bindingDoc = bindingParent->OwnerDoc();
|
||||
if (bindingDoc) {
|
||||
nsXBLBinding* binding =
|
||||
bindingDoc->BindingManager()->GetBinding(bindingParent);
|
||||
if (binding) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
// If this is an anonymous XBL element use the binding
|
||||
// document for the base URI.
|
||||
// XXX Will fail with xml:base
|
||||
base = binding->PrototypeBinding()->DocURI();
|
||||
break;
|
||||
}
|
||||
nsXBLBinding* binding =
|
||||
bindingParent->OwnerDoc()->BindingManager()->GetBinding(bindingParent);
|
||||
if (binding) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
// If this is an anonymous XBL element use the binding
|
||||
// document for the base URI.
|
||||
// XXX Will fail with xml:base
|
||||
base = binding->PrototypeBinding()->DocURI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2640,10 +2618,7 @@ nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute,
|
||||
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eSetAttributeNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
|
||||
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> map;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(map));
|
||||
@ -2669,10 +2644,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
|
||||
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
|
||||
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> map;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(map));
|
||||
@ -2771,10 +2743,7 @@ nsGenericElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
|
||||
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> map;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(map));
|
||||
@ -2798,10 +2767,7 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
|
||||
NS_ENSURE_ARG_POINTER(aNewAttr);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
|
||||
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> map;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(map));
|
||||
@ -3034,37 +3000,34 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
// that also need to be told that they are moving.
|
||||
nsresult rv;
|
||||
if (hadForceXBL) {
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
nsBindingManager* bmgr = ownerDoc->BindingManager();
|
||||
nsBindingManager* bmgr = OwnerDoc()->BindingManager();
|
||||
|
||||
// First check if we have a binding...
|
||||
nsXBLBinding* contBinding =
|
||||
GetFirstBindingWithContent(bmgr, this);
|
||||
if (contBinding) {
|
||||
nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
|
||||
bool allowScripts = contBinding->AllowScripts();
|
||||
for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(aDocument, this, this, allowScripts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// ...then check if we have content in insertion points that are
|
||||
// direct children of the <content>
|
||||
rv = BindNodesInInsertPoints(contBinding, this, aDocument);
|
||||
// First check if we have a binding...
|
||||
nsXBLBinding* contBinding =
|
||||
GetFirstBindingWithContent(bmgr, this);
|
||||
if (contBinding) {
|
||||
nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
|
||||
bool allowScripts = contBinding->AllowScripts();
|
||||
for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(aDocument, this, this, allowScripts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// ...and finally check if we're in a binding where we have content in
|
||||
// insertion points.
|
||||
if (aBindingParent) {
|
||||
nsXBLBinding* binding = bmgr->GetBinding(aBindingParent);
|
||||
if (binding) {
|
||||
rv = BindNodesInInsertPoints(binding, this, aDocument);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
// ...then check if we have content in insertion points that are
|
||||
// direct children of the <content>
|
||||
rv = BindNodesInInsertPoints(contBinding, this, aDocument);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// ...and finally check if we're in a binding where we have content in
|
||||
// insertion points.
|
||||
if (aBindingParent) {
|
||||
nsXBLBinding* binding = bmgr->GetBinding(aBindingParent);
|
||||
if (binding) {
|
||||
rv = BindNodesInInsertPoints(binding, this, aDocument);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3192,18 +3155,14 @@ nsGenericElement::GetChildren(PRUint32 aFilter)
|
||||
nsINodeList *childList = nsnull;
|
||||
|
||||
nsIDocument* document = OwnerDoc();
|
||||
if (document) {
|
||||
if (!(aFilter & eAllButXBL)) {
|
||||
childList = document->BindingManager()->GetXBLChildNodesFor(this);
|
||||
if (!childList) {
|
||||
childList = GetChildNodesList();
|
||||
}
|
||||
|
||||
} else {
|
||||
childList = document->BindingManager()->GetContentListFor(this);
|
||||
if (!(aFilter & eAllButXBL)) {
|
||||
childList = document->BindingManager()->GetXBLChildNodesFor(this);
|
||||
if (!childList) {
|
||||
childList = GetChildNodesList();
|
||||
}
|
||||
|
||||
} else {
|
||||
childList = GetChildNodesList();
|
||||
childList = document->BindingManager()->GetContentListFor(this);
|
||||
}
|
||||
|
||||
if (childList) {
|
||||
@ -3351,16 +3310,13 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
// check for an anonymous parent
|
||||
// XXX XBL2/sXBL issue
|
||||
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
nsIContent* insertionParent = ownerDoc->BindingManager()->
|
||||
GetInsertionParent(this);
|
||||
NS_ASSERTION(!(aVisitor.mEventTargetAtParent && insertionParent &&
|
||||
aVisitor.mEventTargetAtParent != insertionParent),
|
||||
"Retargeting and having insertion parent!");
|
||||
if (insertionParent) {
|
||||
parent = insertionParent;
|
||||
}
|
||||
nsIContent* insertionParent = OwnerDoc()->BindingManager()->
|
||||
GetInsertionParent(this);
|
||||
NS_ASSERTION(!(aVisitor.mEventTargetAtParent && insertionParent &&
|
||||
aVisitor.mEventTargetAtParent != insertionParent),
|
||||
"Retargeting and having insertion parent!");
|
||||
if (insertionParent) {
|
||||
parent = insertionParent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3823,10 +3779,8 @@ void
|
||||
nsGenericElement::DestroyContent()
|
||||
{
|
||||
nsIDocument *document = OwnerDoc();
|
||||
if (document) {
|
||||
document->BindingManager()->RemovedFromDocument(this, document);
|
||||
document->ClearBoxObjectFor(this);
|
||||
}
|
||||
document->BindingManager()->RemovedFromDocument(this, document);
|
||||
document->ClearBoxObjectFor(this);
|
||||
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
@ -4245,10 +4199,8 @@ nsINode::IsEqualNode(nsIDOMNode* aOther, bool* aReturn)
|
||||
nsresult
|
||||
nsINode::IsSameNode(nsIDOMNode* aOther, bool* aReturn)
|
||||
{
|
||||
nsIDocument* owner = OwnerDoc();
|
||||
if (owner) {
|
||||
owner->WarnOnceAbout(nsIDocument::eIsSameNode);
|
||||
}
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSameNode);
|
||||
|
||||
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
|
||||
*aReturn = other == this;
|
||||
return NS_OK;
|
||||
@ -4347,10 +4299,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
|
||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||
}
|
||||
|
||||
nsIDocument* ownerDoc = tmp->OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
||||
}
|
||||
tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
|
||||
|
||||
if (tmp->HasProperties() && tmp->IsXUL()) {
|
||||
nsISupports* property =
|
||||
@ -4423,14 +4372,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsGenericElement,
|
||||
nsresult
|
||||
nsGenericElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
nsIDocument *document = OwnerDoc();
|
||||
if (document) {
|
||||
return document->BindingManager()->GetBindingImplementation(this, aIID,
|
||||
return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
|
||||
aInstancePtr);
|
||||
}
|
||||
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -4451,7 +4394,7 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
|
||||
bool aDefer)
|
||||
{
|
||||
nsIDocument *ownerDoc = OwnerDoc();
|
||||
if (!ownerDoc || ownerDoc->IsLoadedAsData()) {
|
||||
if (ownerDoc->IsLoadedAsData()) {
|
||||
// Make this a no-op rather than throwing an error to avoid
|
||||
// the error causing problems setting the attribute.
|
||||
return NS_OK;
|
||||
@ -4664,13 +4607,10 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
nsRefPtr<nsXBLBinding> binding =
|
||||
ownerDoc->BindingManager()->GetBinding(this);
|
||||
if (binding) {
|
||||
binding->AttributeChanged(aName, aNamespaceID, false, aNotify);
|
||||
}
|
||||
nsRefPtr<nsXBLBinding> binding =
|
||||
OwnerDoc()->BindingManager()->GetBinding(this);
|
||||
if (binding) {
|
||||
binding->AttributeChanged(aName, aNamespaceID, false, aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4894,13 +4834,10 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
nsRefPtr<nsXBLBinding> binding =
|
||||
ownerDoc->BindingManager()->GetBinding(this);
|
||||
if (binding) {
|
||||
binding->AttributeChanged(aName, aNameSpaceID, true, aNotify);
|
||||
}
|
||||
nsRefPtr<nsXBLBinding> binding =
|
||||
OwnerDoc()->BindingManager()->GetBinding(this);
|
||||
if (binding) {
|
||||
binding->AttributeChanged(aName, aNameSpaceID, true, aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5058,56 +4995,55 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
|
||||
|
||||
// XXX sXBL/XBL2 issue! Owner or current document?
|
||||
nsIDocument *document = OwnerDoc();
|
||||
if (document) {
|
||||
// Note: not listing nsIAnonymousContentCreator-created content...
|
||||
|
||||
nsBindingManager* bindingManager = document->BindingManager();
|
||||
nsCOMPtr<nsIDOMNodeList> anonymousChildren;
|
||||
bindingManager->GetAnonymousNodesFor(nonConstThis,
|
||||
getter_AddRefs(anonymousChildren));
|
||||
// Note: not listing nsIAnonymousContentCreator-created content...
|
||||
|
||||
if (anonymousChildren) {
|
||||
PRUint32 length;
|
||||
anonymousChildren->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("anonymous-children<\n", out);
|
||||
nsBindingManager* bindingManager = document->BindingManager();
|
||||
nsCOMPtr<nsIDOMNodeList> anonymousChildren;
|
||||
bindingManager->GetAnonymousNodesFor(nonConstThis,
|
||||
getter_AddRefs(anonymousChildren));
|
||||
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
anonymousChildren->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
child->List(out, aIndent + 1);
|
||||
}
|
||||
if (anonymousChildren) {
|
||||
PRUint32 length;
|
||||
anonymousChildren->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("anonymous-children<\n", out);
|
||||
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs(">\n", out);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
anonymousChildren->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
child->List(out, aIndent + 1);
|
||||
}
|
||||
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs(">\n", out);
|
||||
}
|
||||
}
|
||||
|
||||
if (bindingManager->HasContentListFor(nonConstThis)) {
|
||||
nsCOMPtr<nsIDOMNodeList> contentList;
|
||||
bindingManager->GetContentListFor(nonConstThis,
|
||||
getter_AddRefs(contentList));
|
||||
if (bindingManager->HasContentListFor(nonConstThis)) {
|
||||
nsCOMPtr<nsIDOMNodeList> contentList;
|
||||
bindingManager->GetContentListFor(nonConstThis,
|
||||
getter_AddRefs(contentList));
|
||||
|
||||
NS_ASSERTION(contentList != nsnull, "oops, binding manager lied");
|
||||
|
||||
PRUint32 length;
|
||||
contentList->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("content-list<\n", out);
|
||||
NS_ASSERTION(contentList != nsnull, "oops, binding manager lied");
|
||||
|
||||
PRUint32 length;
|
||||
contentList->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("content-list<\n", out);
|
||||
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
contentList->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
child->List(out, aIndent + 1);
|
||||
}
|
||||
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs(">\n", out);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
contentList->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
child->List(out, aIndent + 1);
|
||||
}
|
||||
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs(">\n", out);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5399,8 +5335,6 @@ ParseSelectorList(nsINode* aNode,
|
||||
NS_ENSURE_ARG(aNode);
|
||||
|
||||
nsIDocument* doc = aNode->OwnerDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsCSSParser parser(doc->CSSLoader());
|
||||
|
||||
nsCSSSelectorList* selectorList;
|
||||
|
@ -903,16 +903,10 @@ protected:
|
||||
}
|
||||
|
||||
void RegisterFreezableElement() {
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
doc->RegisterFreezableElement(this);
|
||||
}
|
||||
OwnerDoc()->RegisterFreezableElement(this);
|
||||
}
|
||||
void UnregisterFreezableElement() {
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
doc->UnregisterFreezableElement(this);
|
||||
}
|
||||
OwnerDoc()->UnregisterFreezableElement(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,9 +268,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
// Strong reference to the document so that deleting properties can't
|
||||
// delete the document.
|
||||
nsCOMPtr<nsIDocument> document = aNode->OwnerDoc();
|
||||
if (document) {
|
||||
document->DeleteAllPropertiesFor(aNode);
|
||||
}
|
||||
document->DeleteAllPropertiesFor(aNode);
|
||||
}
|
||||
|
||||
// I wonder whether it's faster to do the HasFlag check first....
|
||||
@ -302,12 +300,9 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
if (aNode->IsElement()) {
|
||||
nsIDocument* ownerDoc = aNode->OwnerDoc();
|
||||
Element* elem = aNode->AsElement();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->ClearBoxObjectFor(elem);
|
||||
}
|
||||
ownerDoc->ClearBoxObjectFor(elem);
|
||||
|
||||
NS_ASSERTION(aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) ||
|
||||
!ownerDoc ||
|
||||
!ownerDoc->BindingManager() ||
|
||||
!ownerDoc->BindingManager()->GetBinding(elem),
|
||||
"Non-forced node has binding on destruction");
|
||||
@ -315,7 +310,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
// if NODE_FORCE_XBL_BINDINGS is set, the node might still have a binding
|
||||
// attached
|
||||
if (aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) &&
|
||||
ownerDoc && ownerDoc->BindingManager()) {
|
||||
ownerDoc->BindingManager()) {
|
||||
ownerDoc->BindingManager()->RemovedFromDocument(elem, ownerDoc);
|
||||
}
|
||||
}
|
||||
@ -416,10 +411,6 @@ nsNodeUtils::TraverseUserData(nsINode* aNode,
|
||||
nsCycleCollectionTraversalCallback &aCb)
|
||||
{
|
||||
nsIDocument* ownerDoc = aNode->OwnerDoc();
|
||||
if (!ownerDoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
ownerDoc->PropertyTable(DOM_USER_DATA)->Enumerate(aNode, NoteUserData, &aCb);
|
||||
ownerDoc->PropertyTable(DOM_USER_DATA_HANDLER)->Enumerate(aNode, NoteUserData, &aCb);
|
||||
}
|
||||
@ -438,9 +429,8 @@ nsNodeUtils::CloneNodeImpl(nsINode *aNode, bool aDeep,
|
||||
getter_AddRefs(newNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument *ownerDoc = aNode->OwnerDoc();
|
||||
if (ownerDoc && aCallUserDataHandlers) {
|
||||
rv = CallUserDataHandlers(nodesWithProperties, ownerDoc,
|
||||
if (aCallUserDataHandlers) {
|
||||
rv = CallUserDataHandlers(nodesWithProperties, aNode->OwnerDoc(),
|
||||
nsIDOMUserDataHandler::NODE_CLONED, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -493,8 +483,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
if (!newDoc->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
|
||||
!hasHadScriptHandlingObject) {
|
||||
nsIDocument* currentDoc = aNode->OwnerDoc();
|
||||
NS_ENSURE_STATE(currentDoc &&
|
||||
(nsContentUtils::IsChromeDoc(currentDoc) ||
|
||||
NS_ENSURE_STATE((nsContentUtils::IsChromeDoc(currentDoc) ||
|
||||
(!currentDoc->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
|
||||
!hasHadScriptHandlingObject)));
|
||||
}
|
||||
@ -535,7 +524,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
else if (nodeInfoManager) {
|
||||
nsIDocument* oldDoc = aNode->OwnerDoc();
|
||||
bool wasRegistered = false;
|
||||
if (oldDoc && aNode->IsElement()) {
|
||||
if (aNode->IsElement()) {
|
||||
Element* element = aNode->AsElement();
|
||||
oldDoc->ClearBoxObjectFor(element);
|
||||
wasRegistered = oldDoc->UnregisterFreezableElement(element);
|
||||
@ -717,8 +706,6 @@ nsNodeUtils::UnlinkUserData(nsINode *aNode)
|
||||
// Strong reference to the document so that deleting properties can't
|
||||
// delete the document.
|
||||
nsCOMPtr<nsIDocument> document = aNode->OwnerDoc();
|
||||
if (document) {
|
||||
document->PropertyTable(DOM_USER_DATA)->DeleteAllPropertiesFor(aNode);
|
||||
document->PropertyTable(DOM_USER_DATA_HANDLER)->DeleteAllPropertiesFor(aNode);
|
||||
}
|
||||
document->PropertyTable(DOM_USER_DATA)->DeleteAllPropertiesFor(aNode);
|
||||
document->PropertyTable(DOM_USER_DATA_HANDLER)->DeleteAllPropertiesFor(aNode);
|
||||
}
|
||||
|
@ -604,10 +604,6 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
nsIDocument* doc = thisContent->OwnerDoc();
|
||||
if (!doc) {
|
||||
Fallback(false);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
PRInt16 shouldProcess = nsIContentPolicy::ACCEPT;
|
||||
rv =
|
||||
@ -946,7 +942,7 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
nsIDocument* doc = thisContent->OwnerDoc();
|
||||
if (!doc || doc->IsStaticDocument() || doc->IsBeingUsedAsImage()) {
|
||||
if (doc->IsStaticDocument() || doc->IsBeingUsedAsImage()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1200,7 +1196,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
nsIDocument* doc = thisContent->OwnerDoc();
|
||||
if (!doc || doc->IsBeingUsedAsImage()) {
|
||||
if (doc->IsBeingUsedAsImage()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1295,9 +1295,7 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment)
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(mStartParent->OwnerDoc());
|
||||
if (!doc) return NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDocument> doc = mStartParent->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> commonAncestor;
|
||||
rv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor));
|
||||
|
@ -312,9 +312,9 @@ nsStyledElementNotElementCSSInlineStyle::ParseStyleAttribute(const nsAString& aV
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
|
||||
if (doc && (aForceInDataDoc ||
|
||||
!doc->IsLoadedAsData() ||
|
||||
doc->IsStaticDocument())) {
|
||||
if (aForceInDataDoc ||
|
||||
!doc->IsLoadedAsData() ||
|
||||
doc->IsStaticDocument()) {
|
||||
bool isCSS = true; // assume CSS until proven otherwise
|
||||
|
||||
if (!IsInNativeAnonymousSubtree()) { // native anonymous content
|
||||
|
@ -619,8 +619,7 @@ protected:
|
||||
nsIPresShell *GetPresShell() {
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
if (content) {
|
||||
nsIDocument* ownerDoc = content->OwnerDoc();
|
||||
return ownerDoc ? ownerDoc->GetShell() : nsnull;
|
||||
return content->OwnerDoc()->GetShell();
|
||||
}
|
||||
if (mDocShell) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
|
@ -610,8 +610,7 @@ protected:
|
||||
nsIPresShell *GetPresShell() {
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
if (content) {
|
||||
nsIDocument* ownerDoc = content->OwnerDoc();
|
||||
return ownerDoc ? ownerDoc->GetShell() : nsnull;
|
||||
return content->OwnerDoc()->GetShell();
|
||||
}
|
||||
if (mDocShell) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
|
@ -196,9 +196,7 @@ nsEventListenerManager::GetInnerWindowForTarget()
|
||||
if (node) {
|
||||
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
|
||||
// if that's the XBL document?
|
||||
nsIDocument* document = node->OwnerDoc();
|
||||
if (document)
|
||||
return document->GetInnerWindow();
|
||||
return node->OwnerDoc()->GetInnerWindow();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mTarget);
|
||||
@ -467,9 +465,7 @@ nsEventListenerManager::AddScriptEventListener(nsIAtom *aName,
|
||||
// Try to get context from doc
|
||||
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
|
||||
// if that's the XBL document?
|
||||
doc = node->OwnerDoc();
|
||||
if (doc)
|
||||
global = doc->GetScriptGlobalObject();
|
||||
global = node->OwnerDoc()->GetScriptGlobalObject();
|
||||
} else {
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mTarget));
|
||||
if (win) {
|
||||
|
@ -70,14 +70,12 @@ NS_IMETHODIMP nsPLDOMEvent::Run()
|
||||
target->DispatchEvent(mEvent, &defaultActionEnabled);
|
||||
} else {
|
||||
nsIDocument* doc = mEventNode->OwnerDoc();
|
||||
if (doc) {
|
||||
if (mDispatchChromeOnly) {
|
||||
nsContentUtils::DispatchChromeEvent(doc, mEventNode, mEventType,
|
||||
mBubbles, false);
|
||||
} else {
|
||||
nsContentUtils::DispatchTrustedEvent(doc, mEventNode, mEventType,
|
||||
mBubbles, false);
|
||||
}
|
||||
if (mDispatchChromeOnly) {
|
||||
nsContentUtils::DispatchChromeEvent(doc, mEventNode, mEventType,
|
||||
mBubbles, false);
|
||||
} else {
|
||||
nsContentUtils::DispatchTrustedEvent(doc, mEventNode, mEventType,
|
||||
mBubbles, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,9 +200,6 @@ public:
|
||||
}
|
||||
|
||||
nsIDocument* document = mElement->OwnerDoc();
|
||||
if (!document) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPIDOMWindow* window = document->GetWindow();
|
||||
if (!window) {
|
||||
@ -678,9 +675,6 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
|
||||
aInnerHTML.Truncate();
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_OK; // We rely on the document for doing HTML conversion
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -749,7 +743,6 @@ nsresult
|
||||
nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -835,7 +828,6 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
|
||||
}
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
// Needed when insertAdjacentHTML is used in combination with contenteditable
|
||||
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
|
||||
@ -1272,8 +1264,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
// bail if it does. See similar code in nsHTMLBodyElement and
|
||||
// nsHTMLFramesetElement
|
||||
*aDefer = false;
|
||||
if (document &&
|
||||
(win = document->GetInnerWindow()) && win->IsInnerWindow()) {
|
||||
if ((win = document->GetInnerWindow()) && win->IsInnerWindow()) {
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(win));
|
||||
|
||||
return piTarget->GetListenerManager(true);
|
||||
@ -1378,12 +1369,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
void
|
||||
nsGenericHTMLElement::GetBaseTarget(nsAString& aBaseTarget) const
|
||||
{
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->GetBaseTarget(aBaseTarget);
|
||||
} else {
|
||||
aBaseTarget.Truncate();
|
||||
}
|
||||
OwnerDoc()->GetBaseTarget(aBaseTarget);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -3427,7 +3413,6 @@ nsresult nsGenericHTMLElement::MozRequestFullScreen()
|
||||
}
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(doc));
|
||||
NS_ENSURE_STATE(domDocument);
|
||||
bool fullScreenEnabled;
|
||||
|
@ -292,7 +292,7 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
|
||||
|
||||
while (mHead != mTail) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryReferent(mEntries[mTail].mElement);
|
||||
if (content && content->OwnerDoc()) {
|
||||
if (content) {
|
||||
nsCOMPtr<Link> link = do_QueryInterface(content);
|
||||
nsCOMPtr<nsIURI> hrefURI(link ? link->GetURI() : nsnull);
|
||||
if (hrefURI)
|
||||
|
@ -447,7 +447,7 @@ nsHTMLImageElement::IsHTMLFocusable(bool aWithMouse,
|
||||
// XXXbz which document should this be using? sXBL/XBL2 issue! I
|
||||
// think that OwnerDoc() is right, since we don't want to
|
||||
// assume stuff about the document we're bound to.
|
||||
if (OwnerDoc() && OwnerDoc()->FindImageMap(usemap)) {
|
||||
if (OwnerDoc()->FindImageMap(usemap)) {
|
||||
if (aTabIndex) {
|
||||
// Use tab index on individual map areas
|
||||
*aTabIndex = (sTabFocusModel & eTabFocus_linksMask)? 0 : -1;
|
||||
|
@ -241,11 +241,9 @@ public:
|
||||
AsyncClickHandler(nsHTMLInputElement* aInput)
|
||||
: mInput(aInput) {
|
||||
|
||||
nsIDocument* doc = aInput->OwnerDoc();
|
||||
if (doc) {
|
||||
nsPIDOMWindow* win = doc->GetWindow();
|
||||
if (win)
|
||||
mPopupControlState = win->GetPopupControlState();
|
||||
nsPIDOMWindow* win = aInput->OwnerDoc()->GetWindow();
|
||||
if (win) {
|
||||
mPopupControlState = win->GetPopupControlState();
|
||||
}
|
||||
};
|
||||
|
||||
@ -263,8 +261,6 @@ AsyncClickHandler::Run()
|
||||
|
||||
// Get parent nsPIDOMWindow object.
|
||||
nsCOMPtr<nsIDocument> doc = mInput->OwnerDoc();
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPIDOMWindow* win = doc->GetWindow();
|
||||
if (!win) {
|
||||
@ -3738,9 +3734,6 @@ nsHTMLInputElement::HasPatternMismatch() const
|
||||
}
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !nsContentUtils::IsPatternMatching(value, pattern, doc);
|
||||
}
|
||||
|
@ -1911,9 +1911,6 @@ nsresult nsHTMLMediaElement::NewURIFromString(const nsAutoString& aURISpec, nsIU
|
||||
*aURI = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = OwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI,
|
||||
@ -2377,7 +2374,7 @@ void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged()
|
||||
// Don't pause if we have no ownerDoc. Something native must have created
|
||||
// us and be expecting us to work without a document.
|
||||
bool pauseForInactiveDocument =
|
||||
ownerDoc && (!ownerDoc->IsActive() || !ownerDoc->IsVisible());
|
||||
!ownerDoc->IsActive() || !ownerDoc->IsVisible();
|
||||
|
||||
if (pauseForInactiveDocument != mPausedForInactiveDocument) {
|
||||
mPausedForInactiveDocument = pauseForInactiveDocument;
|
||||
@ -2410,7 +2407,7 @@ void nsHTMLMediaElement::AddRemoveSelfReference()
|
||||
// See the comment at the top of this file for the explanation of this
|
||||
// boolean expression.
|
||||
bool needSelfReference = !mShuttingDown &&
|
||||
(!ownerDoc || ownerDoc->IsActive()) &&
|
||||
ownerDoc->IsActive() &&
|
||||
(mDelayingLoadEvent ||
|
||||
(!mPaused && mDecoder && !mDecoder->IsEnded()) ||
|
||||
(mDecoder && mDecoder->IsSeeking()) ||
|
||||
@ -2565,8 +2562,7 @@ void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) {
|
||||
|
||||
already_AddRefed<nsILoadGroup> nsHTMLMediaElement::GetDocumentLoadGroup()
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
return doc ? doc->GetDocumentLoadGroup() : nsnull;
|
||||
return OwnerDoc()->GetDocumentLoadGroup();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2627,10 +2623,7 @@ void nsHTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel)
|
||||
NS_LITERAL_CSTRING(""), false);
|
||||
|
||||
// Set the Referer header
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
aChannel->SetReferrer(doc->GetDocumentURI());
|
||||
}
|
||||
aChannel->SetReferrer(OwnerDoc()->GetDocumentURI());
|
||||
}
|
||||
|
||||
void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic)
|
||||
|
@ -208,9 +208,6 @@ nsHTMLMenuElement::CanLoadIcon(nsIContent* aContent, const nsAString& aIcon)
|
||||
}
|
||||
|
||||
nsIDocument* doc = aContent->OwnerDoc();
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -235,10 +235,9 @@ nsHTMLSharedElement::GetHref(nsAString& aValue)
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(uri), href, doc, doc->GetDocumentURI());
|
||||
}
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(uri), href, doc, doc->GetDocumentURI());
|
||||
|
||||
if (!uri) {
|
||||
aValue = href;
|
||||
return NS_OK;
|
||||
|
@ -612,10 +612,7 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget)
|
||||
case 1:
|
||||
return;
|
||||
}
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->GetBaseTarget(aTarget);
|
||||
}
|
||||
OwnerDoc()->GetBaseTarget(aTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,12 +310,9 @@ nsSVGAnimationElement::BindToTree(nsIDocument* aDocument,
|
||||
void
|
||||
nsSVGAnimationElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsIDocument *doc = OwnerDoc();
|
||||
if (doc) {
|
||||
nsSMILAnimationController *controller = doc->GetAnimationController();
|
||||
if (controller) {
|
||||
controller->UnregisterAnimationElement(this);
|
||||
}
|
||||
nsSMILAnimationController *controller = OwnerDoc()->GetAnimationController();
|
||||
if (controller) {
|
||||
controller->UnregisterAnimationElement(this);
|
||||
}
|
||||
|
||||
mHrefTarget.Unlink();
|
||||
|
@ -813,29 +813,26 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
// in nsHTMLCSSStyleSheet::RulesMatching(), where we determine whether to
|
||||
// apply the SMILOverrideStyle.)
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
NS_ASSERTION(doc, "SVG element without doc");
|
||||
if (doc) {
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
nsPresContext* context = shell ? shell->GetPresContext() : nsnull;
|
||||
if (context && context->IsProcessingRestyles() &&
|
||||
!context->IsProcessingAnimationStyleChange()) {
|
||||
// Any style changes right now could trigger CSS Transitions. We don't
|
||||
// want that to happen from SMIL-animated value of mapped attrs, so
|
||||
// ignore animated value for now, and request an animation restyle to
|
||||
// get our animated value noticed.
|
||||
shell->RestyleForAnimation(this, eRestyle_Self);
|
||||
} else {
|
||||
// Ok, this is an animation restyle -- go ahead and update/walk the
|
||||
// animated content style rule.
|
||||
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
|
||||
if (!animContentStyleRule) {
|
||||
UpdateAnimatedContentStyleRule();
|
||||
animContentStyleRule = GetAnimatedContentStyleRule();
|
||||
}
|
||||
if (animContentStyleRule) {
|
||||
animContentStyleRule->RuleMatched();
|
||||
aRuleWalker->Forward(animContentStyleRule);
|
||||
}
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
nsPresContext* context = shell ? shell->GetPresContext() : nsnull;
|
||||
if (context && context->IsProcessingRestyles() &&
|
||||
!context->IsProcessingAnimationStyleChange()) {
|
||||
// Any style changes right now could trigger CSS Transitions. We don't
|
||||
// want that to happen from SMIL-animated value of mapped attrs, so
|
||||
// ignore animated value for now, and request an animation restyle to
|
||||
// get our animated value noticed.
|
||||
shell->RestyleForAnimation(this, eRestyle_Self);
|
||||
} else {
|
||||
// Ok, this is an animation restyle -- go ahead and update/walk the
|
||||
// animated content style rule.
|
||||
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
|
||||
if (!animContentStyleRule) {
|
||||
UpdateAnimatedContentStyleRule();
|
||||
animContentStyleRule = GetAnimatedContentStyleRule();
|
||||
}
|
||||
if (animContentStyleRule) {
|
||||
animContentStyleRule->RuleMatched();
|
||||
aRuleWalker->Forward(animContentStyleRule);
|
||||
}
|
||||
}
|
||||
#endif // MOZ_SMIL
|
||||
@ -1130,11 +1127,6 @@ nsSVGElement::UpdateContentStyleRule()
|
||||
}
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (!doc) {
|
||||
NS_ERROR("SVG element without owner document");
|
||||
return;
|
||||
}
|
||||
|
||||
MappedAttrParser mappedAttrParser(doc->CSSLoader(), doc->GetDocumentURI(),
|
||||
GetBaseURI(), NodePrincipal());
|
||||
|
||||
|
@ -5438,14 +5438,12 @@ nsSVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify)
|
||||
|
||||
// Make sure we don't get in a recursive death-spiral
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIURI> hrefAsURI;
|
||||
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
|
||||
bool isEqual;
|
||||
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
|
||||
// Image URI matches our URI exactly! Bail out.
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIURI> hrefAsURI;
|
||||
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
|
||||
bool isEqual;
|
||||
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
|
||||
// Image URI matches our URI exactly! Bail out.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,13 +118,9 @@ nsSVGStylableElement::DidAnimateClass()
|
||||
}
|
||||
mClassAnimAttr->ParseAtomArray(src);
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
NS_ASSERTION(doc, "If we're animating we should have an owner");
|
||||
if (doc) {
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (shell) {
|
||||
shell->RestyleForAnimation(this, eRestyle_Self);
|
||||
}
|
||||
nsIPresShell* shell = OwnerDoc()->GetShell();
|
||||
if (shell) {
|
||||
shell->RestyleForAnimation(this, eRestyle_Self);
|
||||
}
|
||||
|
||||
nsSVGStylableElementBase::DidAnimateClass();
|
||||
|
@ -933,7 +933,6 @@ nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL)
|
||||
// currentdoc too? What's the one that should be passed to
|
||||
// ChangeDocument?
|
||||
nsCOMPtr<nsIDocument> doc = aContent->OwnerDoc();
|
||||
NS_ASSERTION(doc, "No owner document?");
|
||||
|
||||
// Finally remove the binding...
|
||||
// XXXbz this doesn't remove the implementation! Should fix! Until
|
||||
@ -1252,8 +1251,6 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
|
||||
// Create an XPC wrapper for the script object and hand it back.
|
||||
|
||||
nsIDocument* doc = aContent->OwnerDoc();
|
||||
if (!doc)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
|
||||
if (!global)
|
||||
|
@ -179,9 +179,6 @@ XBLResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
|
||||
// This mirrors code in nsXBLProtoImpl::InstallImplementation
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
if (!doc) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject* global = doc->GetScriptGlobalObject();
|
||||
if (!global) {
|
||||
@ -554,11 +551,6 @@ RealizeDefaultContent(nsISupports* aKey,
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
nsIDocument *document = insParent->OwnerDoc();
|
||||
if (!document) {
|
||||
data->mRv = NS_ERROR_FAILURE;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> clonedNode;
|
||||
nsCOMArray<nsINode> nodesWithProperties;
|
||||
nsNodeUtils::Clone(defContent, true, document->NodeInfoManager(),
|
||||
@ -642,10 +634,6 @@ nsXBLBinding::GenerateAnonymousContent()
|
||||
|
||||
if (hasContent || hasInsertionPoints) {
|
||||
nsIDocument* doc = mBoundElement->OwnerDoc();
|
||||
|
||||
// XXX doc will be null if we're in the midst of paint suppression.
|
||||
if (! doc)
|
||||
return;
|
||||
|
||||
nsBindingManager *bindingManager = doc->BindingManager();
|
||||
|
||||
|
@ -82,8 +82,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
|
||||
// If the way this gets the script context changes, fix
|
||||
// nsXBLProtoImplAnonymousMethod::Execute
|
||||
nsIDocument* document = aBoundElement->OwnerDoc();
|
||||
if (!document) return NS_OK;
|
||||
|
||||
|
||||
nsIScriptGlobalObject *global = document->GetScopeObject();
|
||||
if (!global) return NS_OK;
|
||||
|
||||
@ -141,7 +140,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
|
||||
nsIDocument *ownerDoc = aBoundElement->OwnerDoc();
|
||||
nsIScriptGlobalObject *sgo;
|
||||
|
||||
if (!ownerDoc || !(sgo = ownerDoc->GetScopeObject())) {
|
||||
if (!(sgo = ownerDoc->GetScopeObject())) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
|
||||
nsIDocument *ownerDoc = aBoundElement->OwnerDoc();
|
||||
nsIScriptGlobalObject *sgo;
|
||||
|
||||
if (!ownerDoc || !(sgo = ownerDoc->GetScopeObject())) {
|
||||
if (!(sgo = ownerDoc->GetScopeObject())) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -280,9 +280,6 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
|
||||
// Get the script context the same way
|
||||
// nsXBLProtoImpl::InstallImplementation does.
|
||||
nsIDocument* document = aBoundElement->OwnerDoc();
|
||||
if (!document) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject* global = document->GetScriptGlobalObject();
|
||||
if (!global) {
|
||||
|
@ -160,7 +160,7 @@ nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
|
||||
nsIDocument *ownerDoc = aBoundElement->OwnerDoc();
|
||||
nsIScriptGlobalObject *sgo;
|
||||
|
||||
if (!ownerDoc || !(sgo = ownerDoc->GetScopeObject())) {
|
||||
if (!(sgo = ownerDoc->GetScopeObject())) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -293,8 +293,6 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget,
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
boundDocument = content->OwnerDoc();
|
||||
if (!boundDocument)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
boundGlobal = boundDocument->GetScopeObject();
|
||||
|
@ -549,10 +549,6 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
|
||||
nsCOMPtr<nsIDocument> document = aContent->OwnerDoc();
|
||||
|
||||
// XXX document may be null if we're in the midst of paint suppression
|
||||
if (!document)
|
||||
return NS_OK;
|
||||
|
||||
nsCAutoString urlspec;
|
||||
if (nsContentUtils::GetWrapperSafeScriptFilename(document, aURL, urlspec)) {
|
||||
// Block an attempt to load a binding that has special wrapper
|
||||
@ -659,10 +655,6 @@ nsXBLService::FlushStyleBindings(nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document = aContent->OwnerDoc();
|
||||
|
||||
// XXX doc will be null if we're in the midst of paint suppression.
|
||||
if (! document)
|
||||
return NS_OK;
|
||||
|
||||
nsBindingManager *bindingManager = document->BindingManager();
|
||||
|
||||
nsXBLBinding *binding = bindingManager->GetBinding(aContent);
|
||||
@ -687,14 +679,8 @@ nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
|
||||
nsIAtom** aResult)
|
||||
{
|
||||
nsIDocument* document = aContent->OwnerDoc();
|
||||
if (document) {
|
||||
*aResult = document->BindingManager()->ResolveTag(aContent, aNameSpaceID);
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
else {
|
||||
*aNameSpaceID = aContent->GetNameSpaceID();
|
||||
NS_ADDREF(*aResult = aContent->Tag());
|
||||
}
|
||||
*aResult = document->BindingManager()->ResolveTag(aContent, aNameSpaceID);
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -180,14 +180,10 @@ nsXMLStylesheetPI::GetStyleSheetURL(bool* aIsInline)
|
||||
nsIURI *baseURL;
|
||||
nsCAutoString charset;
|
||||
nsIDocument *document = OwnerDoc();
|
||||
if (document) {
|
||||
baseURL = mOverriddenBaseURI ?
|
||||
mOverriddenBaseURI.get() :
|
||||
document->GetDocBaseURI();
|
||||
charset = document->GetDocumentCharacterSet();
|
||||
} else {
|
||||
baseURL = mOverriddenBaseURI;
|
||||
}
|
||||
baseURL = mOverriddenBaseURI ?
|
||||
mOverriddenBaseURI.get() :
|
||||
document->GetDocBaseURI();
|
||||
charset = document->GetDocumentCharacterSet();
|
||||
|
||||
nsCOMPtr<nsIURI> aURI;
|
||||
NS_NewURI(getter_AddRefs(aURI), href, charset.get(), baseURL);
|
||||
|
@ -88,13 +88,6 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> sourceDoc = node->OwnerDoc();
|
||||
if (!sourceDoc) {
|
||||
NS_ERROR("no source document found");
|
||||
// XXXbz passing nsnull as the first arg to Reset is illegal
|
||||
aNewDoc->Reset(nsnull, nsnull);
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPrincipal* sourcePrincipal = sourceDoc->NodePrincipal();
|
||||
|
||||
// Copy the channel and loadgroup from the source document.
|
||||
|
@ -574,8 +574,7 @@ txXPathNodeUtils::getDocument(const txXPathNode& aNode)
|
||||
txXPathNode*
|
||||
txXPathNodeUtils::getOwnerDocument(const txXPathNode& aNode)
|
||||
{
|
||||
nsIDocument* document = aNode.mNode->OwnerDoc();
|
||||
return document ? new txXPathNode(document) : nsnull;
|
||||
return new txXPathNode(aNode.mNode->OwnerDoc());
|
||||
}
|
||||
|
||||
#ifndef HAVE_64BIT_OS
|
||||
|
@ -721,7 +721,6 @@ TX_CompileStylesheet(nsINode* aNode, txMozillaXSLTProcessor* aProcessor,
|
||||
{
|
||||
// If we move GetBaseURI to nsINode this can be simplified.
|
||||
nsCOMPtr<nsIDocument> doc = aNode->OwnerDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
|
||||
|
@ -118,12 +118,7 @@ txMozillaXMLOutput::txMozillaXMLOutput(txOutputFormat* aFormat,
|
||||
|
||||
mCurrentNode = do_QueryInterface(aFragment);
|
||||
mDocument = mCurrentNode->OwnerDoc();
|
||||
if (mDocument) {
|
||||
mNodeInfoManager = mDocument->NodeInfoManager();
|
||||
}
|
||||
else {
|
||||
mCurrentNode = nsnull;
|
||||
}
|
||||
mNodeInfoManager = mDocument->NodeInfoManager();
|
||||
}
|
||||
|
||||
txMozillaXMLOutput::~txMozillaXMLOutput()
|
||||
|
@ -515,8 +515,6 @@ nsXULElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer)
|
||||
// here, override BindToTree for those classes and munge event
|
||||
// listeners there?
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (!doc)
|
||||
return nsnull; // XXX
|
||||
|
||||
nsPIDOMWindow *window;
|
||||
Element *root = doc->GetRootElement();
|
||||
@ -1855,9 +1853,7 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult)
|
||||
*aResult = nsnull;
|
||||
|
||||
// XXX sXBL/XBL2 issue! Owner or current document?
|
||||
nsIDocument* nsDoc = OwnerDoc();
|
||||
|
||||
return nsDoc ? nsDoc->GetBoxObjectFor(this, aResult) : NS_ERROR_FAILURE;
|
||||
return OwnerDoc()->GetBoxObjectFor(this, aResult);
|
||||
}
|
||||
|
||||
// Methods for setting/getting attributes from nsIDOMXULElement
|
||||
|
@ -4441,7 +4441,6 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild,
|
||||
|
||||
if (!posStr.IsEmpty()) {
|
||||
nsIDocument *document = aParent->OwnerDoc();
|
||||
if (!document) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIContent *content = nsnull;
|
||||
|
||||
|
@ -390,8 +390,6 @@ ForEachPing(nsIContent *content, ForEachPingCallback callback, void *closure)
|
||||
return;
|
||||
|
||||
nsIDocument *doc = content->OwnerDoc();
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
// value contains relative URIs split on spaces (U+0020)
|
||||
const PRUnichar *start = value.BeginReading();
|
||||
@ -551,8 +549,6 @@ SendPing(void *closure, nsIContent *content, nsIURI *uri, nsIIOService *ios)
|
||||
}
|
||||
|
||||
nsIDocument *doc = content->OwnerDoc();
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
ios->NewChannelFromURI(uri, getter_AddRefs(chan));
|
||||
|
@ -7257,16 +7257,6 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
||||
// See http://bugzilla.mozilla.org/show_bug.cgi?id=227417
|
||||
nsIDocument* doc = node->OwnerDoc();
|
||||
|
||||
if (!doc) {
|
||||
// No document reachable from nativeObj, use the global object
|
||||
// that was passed to this method.
|
||||
|
||||
*parentObj = globalObj;
|
||||
|
||||
return node->IsInNativeAnonymousSubtree() ?
|
||||
NS_SUCCESS_CHROME_ACCESS_ONLY : NS_OK;
|
||||
}
|
||||
|
||||
// If we have a document, make sure one of these is true
|
||||
// (1) it has a script handling object,
|
||||
// (2) has had one, or has been marked to have had one,
|
||||
@ -7619,10 +7609,6 @@ nsElementSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
if (!doc) {
|
||||
// Nothing else to do here
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsXBLBinding> binding = doc->BindingManager()->GetBinding(content);
|
||||
if (!binding) {
|
||||
@ -8160,7 +8146,6 @@ nsDOMStringMapSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
nsDOMStringMap* dataset = static_cast<nsDOMStringMap*>(nativeObj);
|
||||
|
||||
nsIDocument* document = dataset->GetElement()->OwnerDoc();
|
||||
NS_ENSURE_TRUE(document, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo =
|
||||
do_GetInterface(document->GetScopeObject());
|
||||
|
@ -618,18 +618,15 @@ TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
|
||||
if (content) {
|
||||
nsIDocument* document = content->OwnerDoc();
|
||||
if (document) {
|
||||
nsIPresShell* shell = document->GetShell();
|
||||
if (shell) {
|
||||
nsIViewManager* vm = shell->GetViewManager();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
*aValue = reinterpret_cast<WindowsHandle>(
|
||||
widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
|
||||
return true;
|
||||
}
|
||||
nsIPresShell* shell = content->OwnerDoc()->GetShell();
|
||||
if (shell) {
|
||||
nsIViewManager* vm = shell->GetViewManager();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
*aValue = reinterpret_cast<WindowsHandle>(
|
||||
widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2053,9 +2053,6 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
|
||||
}
|
||||
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject* sgo = doc->GetScriptGlobalObject();
|
||||
if (!sgo) {
|
||||
|
@ -969,15 +969,12 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
|
||||
nsIContent* content = aForFrame->GetContent();
|
||||
// The root element content can't be null. We wouldn't know what
|
||||
// frame to create for aFrame.
|
||||
// Use |GetOwnerDoc| so it works during destruction.
|
||||
// Use |OwnerDoc| so it works during destruction.
|
||||
if (!content) {
|
||||
return aForFrame;
|
||||
}
|
||||
|
||||
nsIDocument* document = content->OwnerDoc();
|
||||
if (!document) {
|
||||
return aForFrame;
|
||||
}
|
||||
|
||||
dom::Element* bodyContent = document->GetBodyElement();
|
||||
// We need to null check the body node (bug 118829) since
|
||||
@ -1059,8 +1056,6 @@ FindElementBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
|
||||
|
||||
// We should only look at the <html> background if we're in an HTML document
|
||||
nsIDocument* document = content->OwnerDoc();
|
||||
if (!document)
|
||||
return true;
|
||||
|
||||
dom::Element* bodyContent = document->GetBodyElement();
|
||||
if (bodyContent != content)
|
||||
|
@ -59,9 +59,6 @@ ChildIterator::Init(nsIContent* aContent,
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIDocument* doc = aContent->OwnerDoc();
|
||||
NS_ASSERTION(doc, "element not in the document");
|
||||
if (! doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If this node has XBL children, then use them. Otherwise, just use
|
||||
// the vanilla content APIs.
|
||||
|
@ -259,13 +259,11 @@ inDOMUtils::GetBindingURLs(nsIDOMElement *aElement, nsIArray **_retval)
|
||||
NS_ASSERTION(content, "elements must implement nsIContent");
|
||||
|
||||
nsIDocument *ownerDoc = content->OwnerDoc();
|
||||
if (ownerDoc) {
|
||||
nsXBLBinding *binding = ownerDoc->BindingManager()->GetBinding(content);
|
||||
nsXBLBinding *binding = ownerDoc->BindingManager()->GetBinding(content);
|
||||
|
||||
while (binding) {
|
||||
urls->AppendElement(binding->PrototypeBinding()->BindingURI(), false);
|
||||
binding = binding->GetBaseBinding();
|
||||
}
|
||||
while (binding) {
|
||||
urls->AppendElement(binding->PrototypeBinding()->BindingURI(), false);
|
||||
binding = binding->GetBaseBinding();
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval = urls);
|
||||
|
@ -1257,10 +1257,7 @@ nsCSSStyleSheet::FindOwningWindowInnerID() const
|
||||
if (windowID == 0 && mOwningNode) {
|
||||
nsCOMPtr<nsIContent> node = do_QueryInterface(mOwningNode);
|
||||
if (node) {
|
||||
nsIDocument* doc = node->OwnerDoc();
|
||||
if (doc) {
|
||||
windowID = doc->InnerWindowID();
|
||||
}
|
||||
windowID = node->OwnerDoc()->InnerWindowID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,12 +176,6 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(CSSParsingEnvironment& aC
|
||||
NS_ASSERTION(mElement, "Something is severely broken -- there should be an Element here!");
|
||||
|
||||
nsIDocument* doc = mElement->OwnerDoc();
|
||||
if (!doc) {
|
||||
// document has been destroyed
|
||||
aCSSParseEnv.mPrincipal = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
aCSSParseEnv.mSheetURI = doc->GetDocumentURI();
|
||||
aCSSParseEnv.mBaseURI = mElement->GetBaseURI();
|
||||
aCSSParseEnv.mPrincipal = mElement->NodePrincipal();
|
||||
|
@ -101,12 +101,7 @@ private:
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxFrameEvent::Run()
|
||||
{
|
||||
nsIDocument* doc = mContent->OwnerDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIPresShell *pres_shell = doc->GetShell();
|
||||
nsIPresShell *pres_shell = mContent->OwnerDoc()->GetShell();
|
||||
if (!pres_shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -167,15 +167,13 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
|
||||
|
||||
mPopupType = ePopupTypePanel;
|
||||
nsIDocument* doc = aContent->OwnerDoc();
|
||||
if (doc) {
|
||||
PRInt32 namespaceID;
|
||||
nsCOMPtr<nsIAtom> tag = doc->BindingManager()->ResolveTag(aContent, &namespaceID);
|
||||
if (namespaceID == kNameSpaceID_XUL) {
|
||||
if (tag == nsGkAtoms::menupopup || tag == nsGkAtoms::popup)
|
||||
mPopupType = ePopupTypeMenu;
|
||||
else if (tag == nsGkAtoms::tooltip)
|
||||
mPopupType = ePopupTypeTooltip;
|
||||
}
|
||||
PRInt32 namespaceID;
|
||||
nsCOMPtr<nsIAtom> tag = doc->BindingManager()->ResolveTag(aContent, &namespaceID);
|
||||
if (namespaceID == kNameSpaceID_XUL) {
|
||||
if (tag == nsGkAtoms::menupopup || tag == nsGkAtoms::popup)
|
||||
mPopupType = ePopupTypeMenu;
|
||||
else if (tag == nsGkAtoms::tooltip)
|
||||
mPopupType = ePopupTypeTooltip;
|
||||
}
|
||||
|
||||
if (mPopupType == ePopupTypePanel &&
|
||||
|
@ -703,13 +703,8 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
nsIContent* content = childBox->GetContent();
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
nsIAtom* atom;
|
||||
if (doc) {
|
||||
PRInt32 dummy;
|
||||
atom = doc->BindingManager()->ResolveTag(content, &dummy);
|
||||
} else {
|
||||
atom = content->Tag();
|
||||
}
|
||||
PRInt32 dummy;
|
||||
nsIAtom* atom = doc->BindingManager()->ResolveTag(content, &dummy);
|
||||
|
||||
// skip over any splitters
|
||||
if (atom != nsGkAtoms::splitter) {
|
||||
|
@ -503,7 +503,6 @@ nsHtml5Parser::ParseHtml5Fragment(const nsAString& aSourceBuffer,
|
||||
NS_ENSURE_TRUE(aSourceBuffer.Length() <= PR_INT32_MAX,
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
nsIDocument* doc = aTargetNode->OwnerDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsIURI* uri = doc->GetDocumentURI();
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_NOT_AVAILABLE);
|
||||
|
@ -308,7 +308,6 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
|
||||
if (!mContent) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocument> document = mContent->OwnerDoc();
|
||||
if (!document) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = document->GetDocumentLoadGroup();
|
||||
if (!loadGroup) return NS_ERROR_FAILURE;
|
||||
|
@ -204,10 +204,6 @@ nsresult nsMenuItemX::DispatchDOMEvent(const nsString &eventName, bool *preventD
|
||||
|
||||
// get owner document for content
|
||||
nsCOMPtr<nsIDocument> parentDoc = mContent->OwnerDoc();
|
||||
if (!parentDoc) {
|
||||
NS_WARNING("Failed to get owner nsIDocument for menu item content");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// get interface for creating DOM events from content owner document
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(parentDoc);
|
||||
|
@ -124,11 +124,9 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
|
||||
#endif
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
nsIDocument* doc = aFrame->GetContent()->OwnerDoc();
|
||||
if (doc) {
|
||||
nsPIDOMWindow* window = doc->GetWindow();
|
||||
if (window && !window->ShouldShowFocusRing())
|
||||
flags &= ~NS_EVENT_STATE_FOCUS;
|
||||
}
|
||||
nsPIDOMWindow* window = doc->GetWindow();
|
||||
if (window && !window->ShouldShowFocusRing())
|
||||
flags &= ~NS_EVENT_STATE_FOCUS;
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
|
Loading…
Reference in New Issue
Block a user