OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 | 8 |
9 <p id="horizontalParagraph"> | 9 <p id="horizontalParagraph"> |
10 one two אחתשתיים three four שלושהארבעה | 10 one two אחתשתיים three four שלושהארבעה |
(...skipping 16 matching lines...) Expand all Loading... |
27 // tree, and also in the DOM, and assert that they're exactly the same. | 27 // tree, and also in the DOM, and assert that they're exactly the same. |
28 function testWord(elementId, word) { | 28 function testWord(elementId, word) { |
29 debug('\nTesting bounds of word ' + word + ' in ' + elementId); | 29 debug('\nTesting bounds of word ' + word + ' in ' + elementId); |
30 | 30 |
31 var paragraph = document.getElementById(elementId); | 31 var paragraph = document.getElementById(elementId); |
32 var domText = paragraph.innerHTML; | 32 var domText = paragraph.innerHTML; |
33 | 33 |
34 // Get the bounds from the accessibility tree. | 34 // Get the bounds from the accessibility tree. |
35 var axParagraph = accessibilityController.accessibleElementById(elem
entId); | 35 var axParagraph = accessibilityController.accessibleElementById(elem
entId); |
36 var axStaticText = axParagraph.childAtIndex(0); | 36 var axStaticText = axParagraph.childAtIndex(0); |
37 var text = axStaticText.stringValue.substr(9); | 37 var text = axStaticText.name; |
38 var wordAxIndex = text.indexOf(word); | 38 var wordAxIndex = text.indexOf(word); |
39 eval('window.axBounds = ' + axStaticText.boundsForRange(wordAxIndex,
wordAxIndex + word.length) + ';'); | 39 eval('window.axBounds = ' + axStaticText.boundsForRange(wordAxIndex,
wordAxIndex + word.length) + ';'); |
40 | 40 |
41 // Get the bounds from the DOM. | 41 // Get the bounds from the DOM. |
42 var domIndex = domText.indexOf(word); | 42 var domIndex = domText.indexOf(word); |
43 var range = new Range(); | 43 var range = new Range(); |
44 range.setStart(paragraph.firstChild, domIndex); | 44 range.setStart(paragraph.firstChild, domIndex); |
45 range.setEnd(paragraph.firstChild, domIndex + word.length); | 45 range.setEnd(paragraph.firstChild, domIndex + word.length); |
46 window.rangeBounds = range.getBoundingClientRect(); | 46 window.rangeBounds = range.getBoundingClientRect(); |
47 | 47 |
(...skipping 15 matching lines...) Expand all Loading... |
63 testWord('verticalParagraph', 'two'); | 63 testWord('verticalParagraph', 'two'); |
64 testWord('verticalParagraph', 'three'); | 64 testWord('verticalParagraph', 'three'); |
65 testWord('verticalParagraph', 'four'); | 65 testWord('verticalParagraph', 'four'); |
66 testWord('verticalParagraph', 'אחתשתיים'); | 66 testWord('verticalParagraph', 'אחתשתיים'); |
67 testWord('verticalParagraph', 'שלושהארבעה'); | 67 testWord('verticalParagraph', 'שלושהארבעה'); |
68 } | 68 } |
69 </script> | 69 </script> |
70 | 70 |
71 </body> | 71 </body> |
72 </html> | 72 </html> |
OLD | NEW |