Bug 631160 - embedded accessible may expose wrong text, r=davidb, r=marcoz, a=blocking GECKO20b11_2011020209_RELBRANCH
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 03 Feb 2011 19:02:26 +0100
branchGECKO20b11_2011020209_RELBRANCH
changeset 61868 7893f45c72c5dd307ed6747c7d351375586bcad9
parent 61867 bb8247382c3e27be839e83eec90e946eb9209f48
child 61871 be22ea0c325f2c173dcdc5eeffbe2fdec85ecce1
push idunknown
push userunknown
push dateunknown
reviewersdavidb, marcoz, blocking
bugs631160
milestone2.0b11
Bug 631160 - embedded accessible may expose wrong text, r=davidb, r=marcoz, a=blocking
accessible/src/base/nsAccessible.cpp
accessible/tests/mochitest/text/test_hypertext.html
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -2651,19 +2651,20 @@ nsAccessible::AppendTextTo(nsAString& aT
     return;
 
   nsIFrame *frame = GetFrame();
   if (!frame)
     return;
 
   if (frame->GetType() == nsAccessibilityAtoms::brFrame) {
     aText += kForcedNewLineChar;
-  } else if (nsAccUtils::MustPrune(this)) {
-    // Expose imaginary embedded object character if the accessible hans't
-    // children.
+  } else if (nsAccUtils::MustPrune(GetParent())) {
+    // Expose the embedded object accessible as imaginary embedded object
+    // character if its parent hypertext accessible doesn't expose children to
+    // AT.
     aText += kImaginaryEmbeddedObjectChar;
   } else {
     aText += kEmbeddedObjectChar;
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNode public methods
--- a/accessible/tests/mochitest/text/test_hypertext.html
+++ b/accessible/tests/mochitest/text/test_hypertext.html
@@ -17,34 +17,33 @@
   <script type="application/javascript">
     function doTest()
     {
       //////////////////////////////////////////////////////////////////////////
       // hypertext
       //////////////////////////////////////////////////////////////////////////
 
       // ! - embedded object char
-      // @ - imaginary object char, space is used
-      // __h__e__l__l__o__ __!__ __s__e__e__ __@__
+      // __h__e__l__l__o__ __!__ __s__e__e__ __!__
       //  0  1  2  3  4  5  6  7  8  9 10 11 12 13
 
-      var IDs = [ "hypertext" ];
+      var IDs = [ "hypertext", "hypertext2" ];
 
       ////////////////////////////////////////////////////////////////////////
       // characterCount
 
       testCharacterCount(IDs, 13);
 
       ////////////////////////////////////////////////////////////////////////
       // getText
 
       testText(IDs, 0, 1, "h");
       testText(IDs, 5, 7, " " + kEmbedChar);
-      testText(IDs, 10, 13, "e  ");
-      testText(IDs, 0, 13, "hello " + kEmbedChar + " see  ");
+      testText(IDs, 10, 13, "e " + kEmbedChar);
+      testText(IDs, 0, 13, "hello " + kEmbedChar + " see " + kEmbedChar);
 
       //////////////////////////////////////////////////////////////////////////
       // list
       //////////////////////////////////////////////////////////////////////////
 
       IDs = [ "list" ];
       testCharacterCount(IDs, 1);
       testText(IDs, 0, 1, kEmbedChar);
@@ -66,12 +65,13 @@
      title="Fix getText"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=630001">Mozilla Bug 630001, part3</a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <div id="hypertext">hello <a>friend</a> see <img></div>
+  <div id="hypertext2">hello <a>friend</a> see <input></div>
   <ol id="list"><li id="listitem">foo</li></ol>
 
 </body>
 </html>