Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: LayoutTests/accessibility/inline-text-word-boundaries.html

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3bff7cbb28b3f6cbe63a87c181adae87170a1817
--- /dev/null
+++ b/LayoutTests/accessibility/inline-text-word-boundaries.html
@@ -0,0 +1,44 @@
+<!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>
+
+<!-- Note: the xxxxxx... should wrap onto another line on all platforms. -->
+<p id="paragraph" style="width: 8em; word-wrap: break-word;">
+Ace ten twenty-one thirty-five. xxxxxxxxxxxxxxxxxxx
+</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>
« no previous file with comments | « LayoutTests/accessibility/inline-text-textarea-expected.txt ('k') | LayoutTests/accessibility/legend-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698