Bug 1134561 - Use of the namespace when checking the tag name if HTMLPictureElement and HTMLSourceElement. r=jst, a=lsblakk
authorRobert Longson <longsonr@gmail.com>
Wed, 11 Mar 2015 15:14:42 -0400
changeset 250353 97c57043b3fc
parent 250352 71e45360880e
child 250354 b8c7154fab60
push id4555
push userryanvm@gmail.com
push date2015-03-11 19:14 +0000
treeherdermozilla-beta@7949e470a547 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, lsblakk
bugs1134561
milestone37.0
Bug 1134561 - Use of the namespace when checking the tag name if HTMLPictureElement and HTMLSourceElement. r=jst, a=lsblakk
dom/html/HTMLPictureElement.cpp
dom/html/HTMLSourceElement.cpp
--- a/dom/html/HTMLPictureElement.cpp
+++ b/dom/html/HTMLPictureElement.cpp
@@ -39,19 +39,19 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLPictureE
                             nsIDOMHTMLPictureElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
 
 void
 HTMLPictureElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
 {
   // Find all img siblings after this <source> to notify them of its demise
-  nsCOMPtr<nsINode> child = GetChildAt(aIndex);
+  nsCOMPtr<nsIContent> child = GetChildAt(aIndex);
   nsCOMPtr<nsIContent> nextSibling;
-  if (child && child->Tag() == nsGkAtoms::source) {
+  if (child && child->IsHTML(nsGkAtoms::source)) {
     nextSibling = child->GetNextSibling();
   }
 
   nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
 
   if (nextSibling && nextSibling->GetParentNode() == this) {
     do {
       HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
--- a/dom/html/HTMLSourceElement.cpp
+++ b/dom/html/HTMLSourceElement.cpp
@@ -56,28 +56,28 @@ HTMLSourceElement::MatchesCurrentMedia()
 }
 
 nsresult
 HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
                                 const nsAttrValue* aValue, bool aNotify)
 {
   // If we are associated with a <picture> with a valid <img>, notify it of
   // responsive parameter changes
-  nsINode *parent = nsINode::GetParentNode();
+  Element *parent = nsINode::GetParentElement();
   if (aNameSpaceID == kNameSpaceID_None &&
       (aName == nsGkAtoms::srcset ||
        aName == nsGkAtoms::sizes ||
        aName == nsGkAtoms::media ||
        aName == nsGkAtoms::type) &&
-      parent && parent->Tag() == nsGkAtoms::picture) {
+      parent && parent->IsHTML(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();
+    nsCOMPtr<nsIContent> sibling = AsContent();
     while ( (sibling = sibling->GetNextSibling()) ) {
-      if (sibling->Tag() == nsGkAtoms::img) {
+      if (sibling->IsHTML(nsGkAtoms::img)) {
         HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
         if (aName == nsGkAtoms::srcset) {
           img->PictureSourceSrcsetChanged(AsContent(), strVal, aNotify);
         } else if (aName == nsGkAtoms::sizes) {
           img->PictureSourceSizesChanged(AsContent(), strVal, aNotify);
         } else if (aName == nsGkAtoms::media ||
                    aName == nsGkAtoms::type) {
           img->PictureSourceMediaOrTypeChanged(AsContent(), aNotify);
@@ -123,21 +123,21 @@ HTMLSourceElement::BindToTree(nsIDocumen
                                                  aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   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->IsHTML(nsGkAtoms::picture)) {
     // Find any img siblings after this <source> and notify them
-    nsCOMPtr<nsINode> sibling = AsContent();
+    nsCOMPtr<nsIContent> sibling = AsContent();
     while ( (sibling = sibling->GetNextSibling()) ) {
-      if (sibling->Tag() == nsGkAtoms::img) {
+      if (sibling->IsHTML(nsGkAtoms::img)) {
         HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
         img->PictureSourceAdded(AsContent());
       }
     }
   }
 
   return NS_OK;
 }