Bug 868789 - Name computation for SVG is wrong, r=tbsaude
authorTakeshi Kurosawa taken.spc@gmail.com>
Thu, 05 Dec 2013 11:45:58 -0500
changeset 173652 fea4b49abfa21c4191b7ae6c7842bf9fb725db3b
parent 173651 a439f81ded5c3b97e40b22552773184facd12ff9
child 173653 1b268ec6b81ece0ddaff59091f145397dc0dc551
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [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
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>