| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 | 8 |
| 9 <!-- Note: the xxxxxx... should wrap onto another line on all platforms. --> | 9 <!-- Note: the xxxxxx... should wrap onto another line on all platforms. --> |
| 10 <p id="paragraph" style="width: 8em; word-wrap: break-word;"> | 10 <p id="paragraph" style="width: 8em; word-wrap: break-word;"> |
| 11 Ace ten twenty-one thirty-five. xxxxxxxxxxxxxxxxxxx | 11 Ace ten twenty-one thirty-five. xxxxxxxxxxxxxxxxxxx |
| 12 </p> | 12 </p> |
| 13 | 13 |
| 14 <p id="description"></p> | 14 <p id="description"></p> |
| 15 | 15 |
| 16 <div id="console"></div> | 16 <div id="console"></div> |
| 17 | 17 |
| 18 <script> | 18 <script> |
| 19 | 19 |
| 20 description("Tests that we can compute word boundaries for any character ind
ex from the accessibility tree."); | 20 description("Tests that we can compute word boundaries for any character ind
ex from the accessibility tree."); |
| 21 | 21 |
| 22 // Note: all that matters is that characters within actual words are mapped
correctly. | 22 // Note: all that matters is that characters within actual words are mapped
correctly. |
| 23 // Whether a character between words is mapped to the previous or next word
is arbitrary; | 23 // Whether a character between words is mapped to the previous or next word
is arbitrary; |
| 24 // all that matters is that we expose the start and end of real words. | 24 // all that matters is that we expose the start and end of real words. |
| 25 if (window.accessibilityController) { | 25 if (window.accessibilityController) { |
| 26 var axParagraph = accessibilityController.accessibleElementById('paragra
ph'); | 26 var axParagraph = accessibilityController.accessibleElementById('paragra
ph'); |
| 27 var axStaticText = axParagraph.childAtIndex(0); | 27 var axStaticText = axParagraph.childAtIndex(0); |
| 28 var text = axStaticText.stringValue.substr(9); | 28 var text = axStaticText.name; |
| 29 debug("Accessible text: \"" + text + "\""); | 29 debug("Accessible text: \"" + text + "\""); |
| 30 | 30 |
| 31 for (var i = 0; i < text.length; i++) { | 31 for (var i = 0; i < text.length; i++) { |
| 32 // Get the bounds from the accessibility tree. | 32 // Get the bounds from the accessibility tree. |
| 33 var wordStart = axStaticText.wordStart(i); | 33 var wordStart = axStaticText.wordStart(i); |
| 34 var wordEnd = axStaticText.wordEnd(i); | 34 var wordEnd = axStaticText.wordEnd(i); |
| 35 debug("Character " + i + ": '" + text.substr(i, 1) + | 35 debug("Character " + i + ": '" + text.substr(i, 1) + |
| 36 "' word=(" + wordStart + ", " + wordEnd + "): '" + | 36 "' word=(" + wordStart + ", " + wordEnd + "): '" + |
| 37 text.substr(wordStart, wordEnd - wordStart) + "'"); | 37 text.substr(wordStart, wordEnd - wordStart) + "'"); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 </script> | 40 </script> |
| 41 | 41 |
| 42 </body> | 42 </body> |
| 43 </html> | 43 </html> |
| OLD | NEW |