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

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: 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-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..b815f2e4ca103beee76bc8925aaf072353a4025e
--- /dev/null
+++ b/LayoutTests/accessibility/inline-text-bidi-bounds-for-range.html
@@ -0,0 +1,73 @@
+<!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="horizontalParagraph">
+one two אחתשתיים three four שלושהארבעה
+</p>
+
+<p id="verticalParagraph" style="-webkit-writing-mode: vertical-lr">
+one two אחתשתיים three four שלושהארבעה
+</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) {
+ // 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.
+ function testWord(elementId, word) {
+ debug('\nTesting bounds of word ' + word + ' in ' + elementId);
+
+ var paragraph = document.getElementById(elementId);
+ var domText = paragraph.innerHTML;
+
+ // Get the bounds from the accessibility tree.
+ var axParagraph = accessibilityController.accessibleElementById(elementId);
+ var axStaticText = axParagraph.childAtIndex(0);
+ var text = axStaticText.stringValue.substr(9);
+ var wordAxIndex = text.indexOf(word);
+ eval('window.axBounds = ' + axStaticText.boundsForRange(wordAxIndex, wordAxIndex + word.length) + ';');
+
+ // Get the bounds from the DOM.
+ var 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, 2);
+ shouldBeCloseTo("axBounds.y", rangeBounds.top, 2);
+ shouldBeCloseTo("axBounds.width", rangeBounds.width, 2);
+ shouldBeCloseTo("axBounds.height", rangeBounds.height, 2);
+ }
+
+ testWord('horizontalParagraph', 'one');
+ testWord('horizontalParagraph', 'two');
+ testWord('horizontalParagraph', 'three');
+ testWord('horizontalParagraph', 'four');
+ testWord('horizontalParagraph', 'אחתשתיים');
+ testWord('horizontalParagraph', 'שלושהארבעה');
+
+ testWord('verticalParagraph', 'one');
+ testWord('verticalParagraph', 'two');
+ testWord('verticalParagraph', 'three');
+ testWord('verticalParagraph', 'four');
+ testWord('verticalParagraph', 'אחתשתיים');
+ testWord('verticalParagraph', 'שלושהארבעה');
+ }
+</script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/accessibility/inline-continuations.html ('k') | LayoutTests/accessibility/inline-text-bounds-for-range.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698