Bug 1134280 - Get rid of Tag() - patch 2.8 - dom/html - Fix all the occurrences, m=smaug, r=surkov

This commit is contained in:
Andrea Marchesini
2015-03-03 11:09:00 +00:00
parent 40ecc85b89
commit 0cd435c47f
12 changed files with 49 additions and 61 deletions

View File

@@ -86,12 +86,12 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aName == nsGkAtoms::sizes ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type) &&
parent && parent->Tag() == nsGkAtoms::picture) {
parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
nsString strVal = aValue ? aValue->GetStringValue() : EmptyString();
// Find all img siblings after this <source> and notify them of the change
nsCOMPtr<nsINode> sibling = AsContent();
while ( (sibling = sibling->GetNextSibling()) ) {
if (sibling->Tag() == nsGkAtoms::img) {
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
if (aName == nsGkAtoms::srcset) {
img->PictureSourceSrcsetChanged(AsContent(), strVal, aNotify);
@@ -147,11 +147,11 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument,
if (aParent && aParent->IsNodeOfType(nsINode::eMEDIA)) {
HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
media->NotifyAddedSource();
} else if (aParent && aParent->Tag() == nsGkAtoms::picture) {
} else if (aParent && aParent->IsHTMLElement(nsGkAtoms::picture)) {
// Find any img siblings after this <source> and notify them
nsCOMPtr<nsINode> sibling = AsContent();
while ( (sibling = sibling->GetNextSibling()) ) {
if (sibling->Tag() == nsGkAtoms::img) {
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
img->PictureSourceAdded(AsContent());
}