Bug 1511955 - Don't traverse into children without hypertext interfaces. r=Jamie FIREFOX_NIGHTLY_65_END
authorEitan Isaacson <eitan@monotonous.org>
Mon, 10 Dec 2018 03:30:21 +0000
changeset 508918 3386ff76878d83496bb822d09115c77472808b53
parent 508917 1b641c848a60987464e438095f426baa66702086
child 508919 89eaae012b3087393772a5c6993bd5b31f6e2632
child 509668 21b1ea9bf569a2dbefda0f136844d1dffe1d5409
child 509670 8c2f5fd8bef2b4cd0ca3b49d20739704df703e7b
child 509698 47c1944a51b5e614dbca9b4baff45f81b8e85bae
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1511955
milestone65.0a1
first release with
nightly linux32
3386ff76878d / 65.0a1 / 20181210095504 / files
nightly linux64
3386ff76878d / 65.0a1 / 20181210095504 / files
nightly mac
3386ff76878d / 65.0a1 / 20181210095504 / files
nightly win32
3386ff76878d / 65.0a1 / 20181210095504 / files
nightly win64
3386ff76878d / 65.0a1 / 20181210095504 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511955 - Don't traverse into children without hypertext interfaces. r=Jamie This prevents an infinite loop where we go into a child only to find the nearest hypertext accessible being its parent. Differential Revision: https://phabricator.services.mozilla.com/D13998
accessible/base/nsAccessiblePivot.cpp
accessible/tests/mochitest/pivot/doc_virtualcursor_text.html
accessible/tests/mochitest/pivot/test_virtualcursor_text.html
--- a/accessible/base/nsAccessiblePivot.cpp
+++ b/accessible/base/nsAccessiblePivot.cpp
@@ -381,25 +381,25 @@ nsAccessiblePivot::MoveNextByText(TextBo
     tempStart = potentialStart > tempStart ? potentialStart : currentEnd;
 
     // The offset range we've obtained might have embedded characters in it,
     // limit the range to the start of the first occurrence of an embedded
     // character.
     Accessible* childAtOffset = nullptr;
     for (int32_t i = tempStart; i < tempEnd; i++) {
       childAtOffset = text->GetChildAtOffset(i);
-      if (childAtOffset && !childAtOffset->IsText()) {
+      if (childAtOffset && childAtOffset->IsHyperText()) {
         tempEnd = i;
         break;
       }
     }
     // If there's an embedded character at the very start of the range, we
     // instead want to traverse into it. So restart the movement with
     // the child as the starting point.
-    if (childAtOffset && !childAtOffset->IsText() &&
+    if (childAtOffset && childAtOffset->IsHyperText() &&
         tempStart == static_cast<int32_t>(childAtOffset->StartOffset())) {
       tempPosition = childAtOffset;
       tempStart = tempEnd = -1;
       continue;
     }
 
     *aResult = true;
 
--- a/accessible/tests/mochitest/pivot/doc_virtualcursor_text.html
+++ b/accessible/tests/mochitest/pivot/doc_virtualcursor_text.html
@@ -20,11 +20,14 @@
     <tr>
       <td id="cell-3">and wizards</td>
       <td id="cell-4">really exist.</td>
     </tr>
   </table>
   <div id="section-3">Endless fun!</div>
   <p id="paragraph-3">Objects<a id="p3-link-1" href="#">adjacent</a>to <a id="p3-link-2" href="#">each</a><a id="p3-link-3" href="#">other</a> should be separate.</p>
   <p id="paragraph-4">Hello <strong>real</strong><a href="#"> world</p>
+  <a href="#" id="image-desc-link">
+    <img src="../moz.png" alt="">Hello
+  </a>
   <div id="end-block">End!</div>
 </body>
 </html>
--- a/accessible/tests/mochitest/pivot/test_virtualcursor_text.html
+++ b/accessible/tests/mochitest/pivot/test_virtualcursor_text.html
@@ -231,16 +231,23 @@
       gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [20, 28],
                   getAccessible(doc.getElementById("section-1"), nsIAccessibleText)));
 
       gQueue.push(new setVCPosInvoker(docAcc, null, null,
                                       getAccessible(doc.getElementById("section-1")).lastChild));
       gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [20, 28],
                   getAccessible(doc.getElementById("section-1"), nsIAccessibleText)));
 
+      gQueue.push(new setVCPosInvoker(docAcc, null, null,
+                                      getAccessible(doc.getElementById("image-desc-link"))));
+      gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [0, 1],
+                  getAccessible(doc.getElementById("image-desc-link"), nsIAccessibleText)));
+      gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [1, 2],
+                  getAccessible(doc.getElementById("image-desc-link"), nsIAccessibleText)));
+
       gQueue.invoke();
     }
 
     SimpleTest.waitForExplicitFinish();
     addLoadEvent(function() {
       /* We open a new browser because we need to test with a top-level content
          document. */
       openBrowserWindow(