Chromium Code Reviews| Index: LayoutTests/accessibility/inline-text-word-boundaries.html |
| diff --git a/LayoutTests/accessibility/inline-text-word-boundaries.html b/LayoutTests/accessibility/inline-text-word-boundaries.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a7da6e65d196332e8d92da2cc8b346a04696652e |
| --- /dev/null |
| +++ b/LayoutTests/accessibility/inline-text-word-boundaries.html |
| @@ -0,0 +1,43 @@ |
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| +<html> |
| +<head> |
| +<meta charset="utf-8"> |
| +<script src="../fast/js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body> |
| + |
| +<p id="paragraph" style="width: 8em; word-wrap: break-word;"> |
| +Ace ten twenty-one thirty-five. xxxxxxxxxxxxxxxxxxx |
|
aboxhall
2013/10/17 22:27:55
Can we comment that the xxxxx... is intended to wr
dmazzoni
2013/10/19 06:48:07
Done.
|
| +</p> |
| + |
| +<p id="description"></p> |
| + |
| +<div id="console"></div> |
| + |
| +<script> |
| + |
| + description("Tests that we can compute word boundaries for any character index from the accessibility tree."); |
| + |
| + // Note: all that matters is that characters within actual words are mapped correctly. |
| + // Whether a character between words is mapped to the previous or next word is arbitrary; |
| + // all that matters is that we expose the start and end of real words. |
| + if (window.accessibilityController) { |
| + var axParagraph = accessibilityController.accessibleElementById('paragraph'); |
| + var axStaticText = axParagraph.childAtIndex(0); |
| + var text = axStaticText.stringValue.substr(9); |
| + debug("Accessible text: \"" + text + "\""); |
| + |
| + for (var i = 0; i < text.length; i++) { |
| + // Get the bounds from the accessibility tree. |
| + var wordStart = axStaticText.wordStart(i); |
| + var wordEnd = axStaticText.wordEnd(i); |
| + debug("Character " + i + ": '" + text.substr(i, 1) + |
| + "' word=(" + wordStart + ", " + wordEnd + "): '" + |
| + text.substr(wordStart, wordEnd - wordStart) + "'"); |
| + } |
| + } |
| +</script> |
| + |
| +<script src="../fast/js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |