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

@@ -585,7 +585,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
UpdateFormOwner();
}
bool addedToPicture = aParent && aParent->IsHTML(nsGkAtoms::picture) &&
bool addedToPicture = aParent && aParent->IsHTMLElement(nsGkAtoms::picture) &&
HTMLPictureElement::IsPictureEnabled();
if (addedToPicture) {
QueueImageLoadTask();
@@ -630,7 +630,7 @@ HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
}
if (aNullParent && GetParent() &&
GetParent()->IsHTML(nsGkAtoms::picture) &&
GetParent()->IsHTMLElement(nsGkAtoms::picture) &&
HTMLPictureElement::IsPictureEnabled()) {
// Being removed from picture re-triggers selection, even if we
// weren't using a <source> peer
@@ -888,7 +888,7 @@ HTMLImageElement::HaveSrcsetOrInPicture()
}
Element *parent = nsINode::GetParentElement();
return (parent && parent->IsHTML(nsGkAtoms::picture));
return (parent && parent->IsHTMLElement(nsGkAtoms::picture));
}
bool
@@ -1046,7 +1046,7 @@ HTMLImageElement::UpdateResponsiveSource()
Element *parent = pictureEnabled ? nsINode::GetParentElement() : nullptr;
nsINode *candidateSource = nullptr;
if (parent && parent->IsHTML(nsGkAtoms::picture)) {
if (parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
// Walk source nodes previous to ourselves
candidateSource = parent->GetFirstChild();
} else {
@@ -1075,8 +1075,7 @@ HTMLImageElement::UpdateResponsiveSource()
mResponsiveSelector = nullptr;
}
break;
} else if (candidateSource->IsElement() &&
candidateSource->AsElement()->IsHTML(nsGkAtoms::source) &&
} else if (candidateSource->IsHTMLElement(nsGkAtoms::source) &&
TryCreateResponsiveSelector(candidateSource->AsContent())) {
// This led to a valid source, stop
break;
@@ -1109,10 +1108,10 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode,
bool pictureEnabled = HTMLPictureElement::IsPictureEnabled();
// Skip if this is not a <source> with matching media query
bool isSourceTag = aSourceNode->IsHTML(nsGkAtoms::source);
bool isSourceTag = aSourceNode->IsHTMLElement(nsGkAtoms::source);
if (isSourceTag) {
DebugOnly<Element *> parent(nsINode::GetParentElement());
MOZ_ASSERT(parent && parent->IsHTML(nsGkAtoms::picture));
MOZ_ASSERT(parent && parent->IsHTMLElement(nsGkAtoms::picture));
MOZ_ASSERT(IsPreviousSibling(aSourceNode, this));
MOZ_ASSERT(pictureEnabled);
@@ -1127,7 +1126,7 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode,
!SupportedPictureSourceType(type)) {
return false;
}
} else if (aSourceNode->IsHTML(nsGkAtoms::img)) {
} else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
// Otherwise this is the <img> tag itself
MOZ_ASSERT(aSourceNode == this);
}