Bug 1475068 - If accessible's parent has text interface, use it in pivot move by text. r=surkov

This commit is contained in:
Eitan Isaacson 2018-07-11 13:36:02 -07:00
Родитель 117e86643a
Коммит 16dbdcb14b
4 изменённых файлов: 23 добавлений и 3 удалений

Просмотреть файл

@ -825,13 +825,17 @@ nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
if (temp == root) if (temp == root)
break; break;
// Unlike traditional pre-order traversal we revisit the parent
// nodes when we go up the tree. This is because our starting point
// may be a subtree or a leaf. If it's parent matches, it should
// take precedent over a sibling.
if (temp != aAccessible && temp->IsHyperText()) if (temp != aAccessible && temp->IsHyperText())
return temp->AsHyperText(); return temp->AsHyperText();
sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();
if (sibling) if (sibling)
break; break;
sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();
} while ((temp = temp->Parent())); } while ((temp = temp->Parent()));
if (!sibling) if (!sibling)

Просмотреть файл

@ -104,7 +104,7 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
var accMatches = position == aIdOrNameOrAcc; var accMatches = position == aIdOrNameOrAcc;
SimpleTest.ok(idMatches || nameMatches || accMatches, "id or name matches", SimpleTest.ok(idMatches || nameMatches || accMatches, "id or name matches",
"expecting " + aIdOrNameOrAcc + ", got '" + "expecting " + prettyName(aIdOrNameOrAcc) + ", got '" +
prettyName(position)); prettyName(position));
SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput, SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput,

Просмотреть файл

@ -24,6 +24,7 @@
</table> </table>
<div id="section-3">Endless fun!</div> <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-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>
<div id="end-block">End!</div> <div id="end-block">End!</div>
</body> </body>
</html> </html>

Просмотреть файл

@ -213,6 +213,21 @@
getAccessible(doc.getElementById("start-block")))); getAccessible(doc.getElementById("start-block"))));
gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, null, false)); gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, null, false));
gQueue.push(new setVCPosInvoker(docAcc, null, null,
getAccessible(doc.getElementById("paragraph-3")).firstChild));
gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7],
getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText)));
gQueue.push(new setVCPosInvoker(docAcc, null, null,
getAccessible(doc.getElementById("s1-link-1")).nextSibling));
gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [4, 6],
getAccessible(doc.getElementById("section-1"), nsIAccessibleText)));
gQueue.push(new setVCPosInvoker(docAcc, null, null,
getAccessible(doc.getElementById("paragraph-4")).firstChild.nextSibling));
gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [6, 10],
getAccessible(doc.getElementById("paragraph-4"), nsIAccessibleText)));
gQueue.invoke(); gQueue.invoke();
} }