Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / inline-text-bidi-bounds-for-range.html
blob7996a325baed8e6765ce3b290177c87a98af1d08
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../resources/js-test.js"></script>
6 </head>
7 <body>
9 <p id="horizontalParagraph">
10 one two אחתשתיים three four שלושהארבעה
11 </p>
13 <p id="verticalParagraph" style="-webkit-writing-mode: vertical-lr">
14 one two אחתשתיים three four שלושהארבעה
15 </p>
17 <p id="description"></p>
19 <div id="console"></div>
21 <script>
23 description("Tests that we can compute the bounds of a range of text from the accessibility tree in bidirectional text.");
25 if (window.accessibilityController) {
26 // For several possible words in the text, get the bounds of the word in the accessibility
27 // tree, and also in the DOM, and assert that they're exactly the same.
28 function testWord(elementId, word) {
29 debug('\nTesting bounds of word ' + word + ' in ' + elementId);
31 var paragraph = document.getElementById(elementId);
32 var domText = paragraph.innerHTML;
34 // Get the bounds from the accessibility tree.
35 var axParagraph = accessibilityController.accessibleElementById(elementId);
36 var axStaticText = axParagraph.childAtIndex(0);
37 var text = axStaticText.stringValue.substr(9);
38 var wordAxIndex = text.indexOf(word);
39 eval('window.axBounds = ' + axStaticText.boundsForRange(wordAxIndex, wordAxIndex + word.length) + ';');
41 // Get the bounds from the DOM.
42 var domIndex = domText.indexOf(word);
43 var range = new Range();
44 range.setStart(paragraph.firstChild, domIndex);
45 range.setEnd(paragraph.firstChild, domIndex + word.length);
46 window.rangeBounds = range.getBoundingClientRect();
48 // Make sure they're the same.
49 shouldBeCloseTo("axBounds.x", "rangeBounds.left", 2);
50 shouldBeCloseTo("axBounds.y", "rangeBounds.top", 2);
51 shouldBeCloseTo("axBounds.width", "rangeBounds.width", 2);
52 shouldBeCloseTo("axBounds.height", "rangeBounds.height", 2);
55 testWord('horizontalParagraph', 'one');
56 testWord('horizontalParagraph', 'two');
57 testWord('horizontalParagraph', 'three');
58 testWord('horizontalParagraph', 'four');
59 testWord('horizontalParagraph', 'אחתשתיים');
60 testWord('horizontalParagraph', 'שלושהארבעה');
62 testWord('verticalParagraph', 'one');
63 testWord('verticalParagraph', 'two');
64 testWord('verticalParagraph', 'three');
65 testWord('verticalParagraph', 'four');
66 testWord('verticalParagraph', 'אחתשתיים');
67 testWord('verticalParagraph', 'שלושהארבעה');
69 </script>
71 </body>
72 </html>