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

Unified Diff: LayoutTests/accessibility/inline-text-bidi-bounds-for-range.html

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove platform differences from inline-text-textarea output Created 7 years, 3 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-bidi-bounds-for-range.html
diff --git a/LayoutTests/accessibility/inline-text-bidi-bounds-for-range.html b/LayoutTests/accessibility/inline-text-bidi-bounds-for-range.html
new file mode 100644
index 0000000000000000000000000000000000000000..5a363a0161e233f1aeb5d53794ae1e0f48d7d1b8
--- /dev/null
+++ b/LayoutTests/accessibility/inline-text-bidi-bounds-for-range.html
@@ -0,0 +1,62 @@
+<!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" dir="ltr">
+מילה word אחרת another ועוד yet אחת
+</p>
+
+<p id="description"></p>
+
+<div id="console"></div>
+
+<script>
+
+ description("Tests that we can compute the bounds of a range of text from the accessibility tree in bidirectional text.");
+
+ if (window.accessibilityController) {
+ var axParagraph = accessibilityController.accessibleElementById('paragraph');
+ var axStaticText = axParagraph.childAtIndex(0);
+ var text = axStaticText.stringValue.substr(9);
+
+ debug('Accessible text: "' + text + '"');
+
+ // For several possible words in the text, get the bounds of the word in the accessibility
+ // tree, and also in the DOM, and assert that they're exactly the same.
+ var paragraph = document.getElementById('paragraph');
+ var domText = paragraph.innerHTML;
+ function testWord(word) {
+ debug('\nTesting bounds of word: ' + word);
+
+ // Get the bounds from the accessibility tree.
+ window.wordAxIndex = text.indexOf(word);
+ eval('window.axBounds = ' + axStaticText.boundsForRange(wordAxIndex, wordAxIndex + word.length) + ';');
+
+ // Get the bounds from the DOM.
+ window.domIndex = domText.indexOf(word);
+ var range = new Range();
+ range.setStart(paragraph.firstChild, domIndex);
+ range.setEnd(paragraph.firstChild, domIndex + word.length);
+ window.rangeBounds = range.getBoundingClientRect();
+
+ // Make sure they're the same.
+ shouldBeCloseTo("axBounds.x", rangeBounds.left, 1);
+ shouldBeCloseTo("axBounds.y", rangeBounds.top, 1);
+ shouldBeCloseTo("axBounds.width", rangeBounds.width, 1);
+ shouldBeCloseTo("axBounds.height", rangeBounds.height, 1);
+ }
+ testWord('yet');
+ testWord('another');
+ testWord('word');
+ testWord('מילה');
+ testWord('אחרת');
+ }
+</script>
+
+<xscript src="../fast/js/resources/js-test-post.js"></xscript>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698