Bug 1338725 part 1. Change the matcher functions used for nsContentList to take an Element argument, not nsIContent. r=baku
This commit is contained in:
@@ -1105,31 +1105,31 @@ nsHTMLDocument::Applets()
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLDocument::MatchLinks(nsIContent *aContent, int32_t aNamespaceID,
|
||||
nsHTMLDocument::MatchLinks(Element* aElement, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
nsIDocument* doc = aContent->GetUncomposedDoc();
|
||||
nsIDocument* doc = aElement->GetUncomposedDoc();
|
||||
|
||||
if (doc) {
|
||||
NS_ASSERTION(aContent->IsInUncomposedDoc(),
|
||||
NS_ASSERTION(aElement->IsInUncomposedDoc(),
|
||||
"This method should never be called on content nodes that "
|
||||
"are not in a document!");
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLDocument> htmldoc =
|
||||
do_QueryInterface(aContent->GetUncomposedDoc());
|
||||
do_QueryInterface(aElement->GetUncomposedDoc());
|
||||
NS_ASSERTION(htmldoc,
|
||||
"Huh, how did this happen? This should only be used with "
|
||||
"HTML documents!");
|
||||
}
|
||||
#endif
|
||||
|
||||
mozilla::dom::NodeInfo *ni = aContent->NodeInfo();
|
||||
mozilla::dom::NodeInfo *ni = aElement->NodeInfo();
|
||||
|
||||
nsIAtom *localName = ni->NameAtom();
|
||||
if (ni->NamespaceID() == kNameSpaceID_XHTML &&
|
||||
(localName == nsGkAtoms::a || localName == nsGkAtoms::area)) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::href);
|
||||
return aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,24 +1153,24 @@ nsHTMLDocument::Links()
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLDocument::MatchAnchors(nsIContent *aContent, int32_t aNamespaceID,
|
||||
nsHTMLDocument::MatchAnchors(Element* aElement, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
NS_ASSERTION(aContent->IsInUncomposedDoc(),
|
||||
NS_ASSERTION(aElement->IsInUncomposedDoc(),
|
||||
"This method should never be called on content nodes that "
|
||||
"are not in a document!");
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLDocument> htmldoc =
|
||||
do_QueryInterface(aContent->GetUncomposedDoc());
|
||||
do_QueryInterface(aElement->GetUncomposedDoc());
|
||||
NS_ASSERTION(htmldoc,
|
||||
"Huh, how did this happen? This should only be used with "
|
||||
"HTML documents!");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::a, kNameSpaceID_XHTML)) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name);
|
||||
if (aElement->IsHTMLElement(nsGkAtoms::a)) {
|
||||
return aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::name);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1947,14 +1947,14 @@ nsHTMLDocument::Writeln(JSContext* cx, const Sequence<nsString>& aText,
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsHTMLDocument::MatchNameAttribute(Element* aElement, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "Must have content node to work with!");
|
||||
NS_PRECONDITION(aElement, "Must have element to work with!");
|
||||
nsString* elementName = static_cast<nsString*>(aData);
|
||||
return
|
||||
aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&
|
||||
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
*elementName, eCaseMatters);
|
||||
}
|
||||
|
||||
@@ -2274,10 +2274,10 @@ nsHTMLDocument::GetForms()
|
||||
return mForms;
|
||||
}
|
||||
|
||||
static bool MatchFormControls(nsIContent* aContent, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
static bool MatchFormControls(Element* aElement, int32_t aNamespaceID,
|
||||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
return aContent->IsNodeOfType(nsIContent::eHTML_FORM_CONTROL);
|
||||
return aElement->IsNodeOfType(nsIContent::eHTML_FORM_CONTROL);
|
||||
}
|
||||
|
||||
nsContentList*
|
||||
|
||||
Reference in New Issue
Block a user