Bug 1134280 - Get rid of Tag() - patch 1 - Is{HTML,XUL,MathML,SVG}Element and IsAnyOf{HTML,XUL,MathML,SVG}Elements, r=smaug

This commit is contained in:
Andrea Marchesini
2015-03-03 11:08:59 +00:00
parent 6af4c4603d
commit 6b10d5e43e
190 changed files with 786 additions and 666 deletions

View File

@@ -316,8 +316,9 @@ IsOffsetParent(nsIFrame* aFrame)
// with display: table-cell with no actual table
nsIContent* content = aFrame->GetContent();
return content->IsHTML(nsGkAtoms::table) || content->IsHTML(nsGkAtoms::td)
|| content->IsHTML(nsGkAtoms::th);
return content->IsAnyOfHTMLElements(nsGkAtoms::table,
nsGkAtoms::td,
nsGkAtoms::th);
}
return false;
}
@@ -345,7 +346,8 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
Element* docElement = GetComposedDoc()->GetRootElement();
nsIContent* content = frame->GetContent();
if (content && (content->IsHTML(nsGkAtoms::body) || content == docElement)) {
if (content && (content->IsHTMLElement(nsGkAtoms::body) ||
content == docElement)) {
parent = frame;
}
else {
@@ -377,7 +379,7 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
// Break if the ancestor frame type makes it suitable as offset parent
// and this element is *not* positioned or if we found the body element.
if (isOffsetParent || content->IsHTML(nsGkAtoms::body)) {
if (isOffsetParent || content->IsHTMLElement(nsGkAtoms::body)) {
offsetParent = content;
break;
}
@@ -437,7 +439,7 @@ nsGenericHTMLElement::Spellcheck()
// Has the state has been explicitly set?
nsIContent* node;
for (node = this; node; node = node->GetParent()) {
if (node->IsHTML()) {
if (node->IsHTMLElement()) {
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr};
switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
@@ -589,7 +591,7 @@ HTMLFormElement*
nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
{
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
IsHTML(nsGkAtoms::img),
IsHTMLElement(nsGkAtoms::img),
"FindAncestorForm should not be called if @form is set!");
// Make sure we don't end up finding a form that's anonymous from
@@ -599,7 +601,7 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
nsIContent* content = this;
while (content != bindingParent && content) {
// If the current ancestor is a form, return it as our form
if (content->IsHTML(nsGkAtoms::form)) {
if (content->IsHTMLElement(nsGkAtoms::form)) {
#ifdef DEBUG
if (!nsContentUtils::IsInSameAnonymousTree(this, content)) {
// It's possible that we started unbinding at |content| or
@@ -655,7 +657,8 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
GetEventTargetContent(aVisitor.mEvent);
return !target || !target->IsHTML(nsGkAtoms::area) || IsHTML(nsGkAtoms::area);
return !target || !target->IsHTMLElement(nsGkAtoms::area) ||
IsHTMLElement(nsGkAtoms::area);
}
nsresult
@@ -2403,7 +2406,7 @@ nsGenericHTMLFormElement::FormIdUpdated(Element* aOldElement,
nsGenericHTMLFormElement* element =
static_cast<nsGenericHTMLFormElement*>(aData);
NS_ASSERTION(element->IsHTML(), "aData should be an HTML element");
NS_ASSERTION(element->IsHTMLElement(), "aData should be an HTML element");
element->UpdateFormOwner(false, aNewElement);
@@ -2459,7 +2462,7 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
"element should be equals to the current element "
"associated with the id in @form!");
if (element && element->IsHTML(nsGkAtoms::form)) {
if (element && element->IsHTMLElement(nsGkAtoms::form)) {
mForm = static_cast<HTMLFormElement*>(element);
}
}
@@ -2763,7 +2766,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
{
// TODO Bug 698498: Should this handle the case where GetBody returns a
// frameset?
if (!IsHTML(nsGkAtoms::body)) {
if (!IsHTMLElement(nsGkAtoms::body)) {
return false;
}