Bug 868789 - Name computation for SVG is wrong, r=tbsaude DONBUILT (fixing username)
authorTakeshi Kurosawa <taken.spc@gmail.com>
Thu, 05 Dec 2013 12:06:01 -0500
changeset 174630 85c5264ddc0bf59bcaa58b03d308c829c7abe77d
parent 174629 38798122d6b4d58d5d34aec2c8c6d8864f3c945f
child 174631 8a355b5e2d7eb02231178b8a18c1e145b91874b9
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaude
bugs868789
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 868789 - Name computation for SVG is wrong, r=tbsaude DONBUILT (fixing username)
accessible/src/generic/Accessible.cpp
accessible/tests/mochitest/name/test_svg.html
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -226,17 +226,17 @@ Accessible::Name(nsString& aName)
       aName.CompressWhitespace();
       return eNameFromTooltip;
     }
   } else if (mContent->IsSVG()) {
     // If user agents need to choose among multiple ‘desc’ or ‘title’ elements
     // for processing, the user agent shall choose the first one.
     for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
          childElm = childElm->GetNextSibling()) {
-      if (childElm->IsSVG(nsGkAtoms::title)) {
+      if (childElm->IsSVG(nsGkAtoms::desc)) {
         nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
         return eNameFromTooltip;
       }
     }
   }
 
   if (nameFlag != eNoNameOnPurpose)
     aName.SetIsVoid(true);
@@ -289,17 +289,17 @@ Accessible::Description(nsString& aDescr
       // Keep the Name() method logic.
       if (mContent->IsHTML()) {
         mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
       } else if (mContent->IsXUL()) {
         mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
       } else if (mContent->IsSVG()) {
         for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
              childElm = childElm->GetNextSibling()) {
-          if (childElm->IsSVG(nsGkAtoms::title)) {
+          if (childElm->IsSVG(nsGkAtoms::desc)) {
             nsTextEquivUtils::AppendTextEquivFromContent(this, childElm,
                                                          &aDescription);
             break;
           }
         }
       }
 
       if (!aDescription.IsEmpty()) {
@@ -2484,17 +2484,17 @@ Accessible::NativeName(nsString& aName)
   if (mContent->IsXUL())
     return GetXULName(aName);
 
   if (mContent->IsSVG()) {
     // If user agents need to choose among multiple ‘desc’ or ‘title’ elements
     // for processing, the user agent shall choose the first one.
     for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
          childElm = childElm->GetNextSibling()) {
-      if (childElm->IsSVG(nsGkAtoms::desc)) {
+      if (childElm->IsSVG(nsGkAtoms::title)) {
         nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
         return eNameOK;
       }
     }
   }
 
   return eNameOK;
 }
--- a/accessible/tests/mochitest/name/test_svg.html
+++ b/accessible/tests/mochitest/name/test_svg.html
@@ -39,17 +39,17 @@
     Mozilla Bug 459357
   </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg1">
-    <title>A description</title>
-    <desc>A name</desc>
+    <title>A name</title>
+    <desc>A description</title>
   </svg>
 
   <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg2">
-    <title>A tooltip</title>
+    <desc>A tooltip</desc>
   </svg>
 </body>
 </html>