blob: df0edc536543601646a51324d6868e7018dcbf67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<textarea id="textarea" cols=30 rows=20>This textarea contains several lines of text. It demonstrates
how updating a single InlineTextBox is a lot more efficient than updating the whole TextArea.</textarea>
<p id="description"></p>
<div id="console"></div>
<script>
description("Demonstrates that when typing in a textarea, not all of the InlineTextBoxes need to be updated for every character pressed.");
if (window.accessibilityController) {
function findAllDescendantsWithRole(axObject, role) {
if (axObject.role == role)
return [axObject];
var result = [];
for (var i = 0; i < axObject.childrenCount; i++)
result = result.concat(findAllDescendantsWithRole(axObject.childAtIndex(i), role));
return result;
}
var axTextarea = accessibilityController.accessibleElementById('textarea');
var inlineTextBoxesBefore = findAllDescendantsWithRole(axTextarea, 'AXRole: AXInlineTextBox');
var firstInlineTextBoxBefore = inlineTextBoxesBefore[0];
var lastInlineTextBoxBefore = inlineTextBoxesBefore[inlineTextBoxesBefore.length - 1];
document.getElementById("textarea").focus();
document.getElementById("textarea").setSelectionRange(45, 45);
// Insert a character in the first paragraph.
document.execCommand("InsertText", false, 'x');
// The inline text boxes in the first paragraph change, but the
// inline text boxes in the last paragraph are reused.
var inlineTextBoxesAfter = findAllDescendantsWithRole(axTextarea, 'AXRole: AXInlineTextBox');
var firstInlineTextBoxAfter = inlineTextBoxesAfter[0];
var lastInlineTextBoxAfter = inlineTextBoxesAfter[inlineTextBoxesAfter.length - 1];
shouldBe("firstInlineTextBoxBefore.isEqual(firstInlineTextBoxAfter)", "false");
shouldBe("lastInlineTextBoxBefore.isEqual(lastInlineTextBoxAfter)", "true");
}
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
|