Part 10 of fix for bug 560273 (Stop using DOM tearoffs from quickstubs) - use nsNodeSelectorTearoff for nsDocument. r=jst.
--HG-- extra : rebase_source : 46ef0b39acee4c05de40a575826f11281101f5d0
This commit is contained in:
Родитель
06183463c5
Коммит
1851ee4b33
|
@ -1537,7 +1537,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
|||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsISupportsWeakReference)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNodeSelector)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
|
@ -1545,6 +1544,8 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
|||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNodeSelector,
|
||||
new nsNodeSelectorTearoff(this))
|
||||
if (aIID.Equals(NS_GET_IID(nsIDOMXPathEvaluator)) ||
|
||||
aIID.Equals(NS_GET_IID(nsIXPathEvaluatorInternal))) {
|
||||
if (!mXPathEvaluatorTearoff) {
|
||||
|
@ -7395,20 +7396,6 @@ nsDocument::SetScriptTypeID(PRUint32 aScriptType)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::QuerySelector(const nsAString& aSelector,
|
||||
nsIDOMElement **aReturn)
|
||||
{
|
||||
return nsGenericElement::doQuerySelector(this, aSelector, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::QuerySelectorAll(const nsAString& aSelector,
|
||||
nsIDOMNodeList **aReturn)
|
||||
{
|
||||
return nsGenericElement::doQuerySelectorAll(this, aSelector, aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::CloneDocHelper(nsDocument* clone) const
|
||||
{
|
||||
|
|
|
@ -494,7 +494,6 @@ class nsDocument : public nsIDocument,
|
|||
public nsIDOMNSEventTarget,
|
||||
public nsIScriptObjectPrincipal,
|
||||
public nsIRadioGroupContainer,
|
||||
public nsIDOMNodeSelector,
|
||||
public nsIApplicationCacheContainer,
|
||||
public nsStubMutationObserver
|
||||
{
|
||||
|
@ -812,9 +811,6 @@ public:
|
|||
// nsIDOMNSEventTarget
|
||||
NS_DECL_NSIDOMNSEVENTTARGET
|
||||
|
||||
// nsIDOMNodeSelector
|
||||
NS_DECL_NSIDOMNODESELECTOR
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
|
|
|
@ -1967,11 +1967,11 @@ nsDOMEventRTTearoff::AddEventListener(const nsAString& aType,
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsNodeSelectorTearoff, mContent)
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsNodeSelectorTearoff, mNode)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeSelectorTearoff)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeSelector)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mContent)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSelectorTearoff)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSelectorTearoff)
|
||||
|
@ -1980,14 +1980,16 @@ NS_IMETHODIMP
|
|||
nsNodeSelectorTearoff::QuerySelector(const nsAString& aSelector,
|
||||
nsIDOMElement **aReturn)
|
||||
{
|
||||
return nsGenericElement::doQuerySelector(mContent, aSelector, aReturn);
|
||||
nsresult rv;
|
||||
nsIContent* result = nsGenericElement::doQuerySelector(mNode, aSelector, &rv);
|
||||
return result ? CallQueryInterface(result, aReturn) : rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
|
||||
nsIDOMNodeList **aReturn)
|
||||
{
|
||||
return nsGenericElement::doQuerySelectorAll(mContent, aSelector, aReturn);
|
||||
return nsGenericElement::doQuerySelectorAll(mNode, aSelector, aReturn);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -5485,29 +5487,24 @@ FindFirstMatchingElement(nsIContent* aMatchingElement,
|
|||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsIContent*
|
||||
nsGenericElement::doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
|
||||
nsIDOMElement **aReturn)
|
||||
nsresult *aResult)
|
||||
{
|
||||
NS_PRECONDITION(aReturn, "Null out param?");
|
||||
NS_PRECONDITION(aResult, "Null out param?");
|
||||
|
||||
nsAutoPtr<nsCSSSelectorList> selectorList;
|
||||
nsPresContext* presContext;
|
||||
nsresult rv = ParseSelectorList(aRoot, aSelector,
|
||||
getter_Transfers(selectorList),
|
||||
&presContext);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*aResult = ParseSelectorList(aRoot, aSelector,
|
||||
getter_Transfers(selectorList),
|
||||
&presContext);
|
||||
NS_ENSURE_SUCCESS(*aResult, nsnull);
|
||||
|
||||
nsIContent* foundElement = nsnull;
|
||||
TryMatchingElementsInSubtree(aRoot, nsnull, presContext, selectorList,
|
||||
FindFirstMatchingElement, &foundElement);
|
||||
|
||||
if (foundElement) {
|
||||
return CallQueryInterface(foundElement, aReturn);
|
||||
}
|
||||
|
||||
*aReturn = nsnull;
|
||||
return NS_OK;
|
||||
return foundElement;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
|
|
|
@ -303,7 +303,7 @@ public:
|
|||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsNodeSelectorTearoff)
|
||||
|
||||
nsNodeSelectorTearoff(nsIContent *aContent) : mContent(aContent)
|
||||
nsNodeSelectorTearoff(nsINode *aNode) : mNode(aNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ private:
|
|||
~nsNodeSelectorTearoff() {}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
};
|
||||
|
||||
// Forward declare to allow being a friend
|
||||
|
@ -639,8 +639,8 @@ public:
|
|||
/**
|
||||
* Helper methods for implementing querySelector/querySelectorAll
|
||||
*/
|
||||
static nsresult doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
|
||||
nsIDOMElement **aReturn);
|
||||
static nsIContent* doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
|
||||
nsresult *aResult NS_OUTPARAM);
|
||||
static nsresult doQuerySelectorAll(nsINode* aRoot,
|
||||
const nsAString& aSelector,
|
||||
nsIDOMNodeList **aReturn);
|
||||
|
|
Загрузка…
Ссылка в новой задаче