Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test: nsIAccessibleText getText* functions at caret offset</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/MochiKit/packed.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 15 | |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../common.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../role.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../states.js"></script> |
michael@0 | 22 | <script type="application/javascript" |
michael@0 | 23 | src="../events.js"></script> |
michael@0 | 24 | <script type="application/javascript" |
michael@0 | 25 | src="../text.js"></script> |
michael@0 | 26 | |
michael@0 | 27 | <script type="application/javascript"> |
michael@0 | 28 | //gA11yEventDumpToConsole = true; // debugging |
michael@0 | 29 | |
michael@0 | 30 | function traverseTextByLines(aQueue, aID, aLines) |
michael@0 | 31 | { |
michael@0 | 32 | var wholeText = ""; |
michael@0 | 33 | for (var i = 0; i < aLines.length ; i++) |
michael@0 | 34 | wholeText += aLines[i][0] + aLines[i][1]; |
michael@0 | 35 | |
michael@0 | 36 | var baseInvokerFunc = synthClick; |
michael@0 | 37 | var charIter = new charIterator(wholeText, aLines); |
michael@0 | 38 | //charIter.debugOffset = 10; // enable to run tests at given offset only |
michael@0 | 39 | |
michael@0 | 40 | while (charIter.next()) { |
michael@0 | 41 | aQueue.push(new tmpl_moveTo(aID, baseInvokerFunc, wholeText, charIter)); |
michael@0 | 42 | baseInvokerFunc = synthRightKey; |
michael@0 | 43 | } |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Used to get test list for each traversed character. |
michael@0 | 48 | */ |
michael@0 | 49 | function charIterator(aWholeText, aLines) |
michael@0 | 50 | { |
michael@0 | 51 | this.next = function charIterator_next() |
michael@0 | 52 | { |
michael@0 | 53 | // Don't increment offset if we are at end of the wrapped line |
michael@0 | 54 | // (offset is shared between end of this line and start of next line). |
michael@0 | 55 | if (this.mAtWrappedLineEnd) { |
michael@0 | 56 | this.mAtWrappedLineEnd = false; |
michael@0 | 57 | this.mLine = this.mLine.nextLine; |
michael@0 | 58 | return true; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | this.mOffset++; |
michael@0 | 62 | if (this.mOffset > aWholeText.length) |
michael@0 | 63 | return false; |
michael@0 | 64 | |
michael@0 | 65 | var nextLine = this.mLine.nextLine; |
michael@0 | 66 | if (!nextLine.isFakeLine() && this.mOffset == nextLine.start) { |
michael@0 | 67 | if (nextLine.start == this.mLine.end) |
michael@0 | 68 | this.mAtWrappedLineEnd = true; |
michael@0 | 69 | else |
michael@0 | 70 | this.mLine = nextLine; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | return true; |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | Object.defineProperty(this, "offset", { get: function() |
michael@0 | 77 | { return this.mOffset; } |
michael@0 | 78 | }); |
michael@0 | 79 | |
michael@0 | 80 | Object.defineProperty(this, "offsetDescr", { get: function() |
michael@0 | 81 | { |
michael@0 | 82 | return this.mOffset + " offset (" + this.mLine.number + " line, " + |
michael@0 | 83 | (this.mOffset - this.mLine.start) + " offset on the line)"; |
michael@0 | 84 | } |
michael@0 | 85 | }); |
michael@0 | 86 | |
michael@0 | 87 | Object.defineProperty(this, "tests", { get: function() |
michael@0 | 88 | { |
michael@0 | 89 | // Line boundary tests. |
michael@0 | 90 | var cLine = this.mLine; |
michael@0 | 91 | var pLine = cLine.prevLine; |
michael@0 | 92 | var ppLine = pLine.prevLine; |
michael@0 | 93 | var nLine = cLine.nextLine; |
michael@0 | 94 | var nnLine = nLine.nextLine; |
michael@0 | 95 | |
michael@0 | 96 | var lineTests = [ |
michael@0 | 97 | [ testTextBeforeOffset, BOUNDARY_LINE_START, pLine.start, cLine.start], |
michael@0 | 98 | [ testTextBeforeOffset, BOUNDARY_LINE_END, ppLine.end, pLine.end], |
michael@0 | 99 | [ testTextAtOffset, BOUNDARY_LINE_START, cLine.start, nLine.start], |
michael@0 | 100 | [ testTextAtOffset, BOUNDARY_LINE_END, pLine.end, cLine.end], |
michael@0 | 101 | [ testTextAfterOffset, BOUNDARY_LINE_START, nLine.start, nnLine.start], |
michael@0 | 102 | [ testTextAfterOffset, BOUNDARY_LINE_END, cLine.end, nLine.end] |
michael@0 | 103 | ]; |
michael@0 | 104 | |
michael@0 | 105 | // Word boundary tests. |
michael@0 | 106 | var cWord = this.mLine.firstWord; |
michael@0 | 107 | var nWord = cWord.nextWord, pWord = cWord.prevWord; |
michael@0 | 108 | |
michael@0 | 109 | // The current word is a farthest word starting at or after the offset. |
michael@0 | 110 | if (this.mOffset >= nWord.start) { |
michael@0 | 111 | while (this.mOffset >= nWord.start && !this.mLine.isLastWord(cWord)) { |
michael@0 | 112 | cWord = nWord; |
michael@0 | 113 | nWord = nWord.nextWord; |
michael@0 | 114 | } |
michael@0 | 115 | pWord = cWord.prevWord; |
michael@0 | 116 | |
michael@0 | 117 | } else if (this.mOffset < cWord.start) { |
michael@0 | 118 | while (this.mOffset < cWord.start) { |
michael@0 | 119 | cWord = pWord; |
michael@0 | 120 | pWord = pWord.prevWord; |
michael@0 | 121 | } |
michael@0 | 122 | nWord = cWord.nextWord; |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | var nnWord = nWord.nextWord, ppWord = pWord.prevWord; |
michael@0 | 126 | |
michael@0 | 127 | var isAfterWordEnd = |
michael@0 | 128 | this.mOffset > cWord.end || cWord.line != this.mLine; |
michael@0 | 129 | var isAtOrAfterWordEnd = (this.mOffset >= cWord.end); |
michael@0 | 130 | var useNextWordForAtWordEnd = |
michael@0 | 131 | isAtOrAfterWordEnd && this.mOffset != aWholeText.length; |
michael@0 | 132 | |
michael@0 | 133 | var wordTests = [ |
michael@0 | 134 | [ testTextBeforeOffset, BOUNDARY_WORD_START, |
michael@0 | 135 | pWord.start, cWord.start ], |
michael@0 | 136 | [ testTextBeforeOffset, BOUNDARY_WORD_END, |
michael@0 | 137 | (isAfterWordEnd ? pWord : ppWord).end, |
michael@0 | 138 | (isAfterWordEnd ? cWord : pWord).end ], |
michael@0 | 139 | [ testTextAtOffset, BOUNDARY_WORD_START, |
michael@0 | 140 | cWord.start, nWord.start ], |
michael@0 | 141 | [ testTextAtOffset, BOUNDARY_WORD_END, |
michael@0 | 142 | (useNextWordForAtWordEnd ? cWord : pWord).end, |
michael@0 | 143 | (useNextWordForAtWordEnd ? nWord : cWord).end ], |
michael@0 | 144 | [ testTextAfterOffset, BOUNDARY_WORD_START, |
michael@0 | 145 | nWord.start, nnWord.start ], |
michael@0 | 146 | [ testTextAfterOffset, BOUNDARY_WORD_END, |
michael@0 | 147 | (isAfterWordEnd ? nWord : cWord).end, |
michael@0 | 148 | (isAfterWordEnd ? nnWord : nWord).end ] |
michael@0 | 149 | ]; |
michael@0 | 150 | |
michael@0 | 151 | // Character boundary tests. |
michael@0 | 152 | var prevOffset = this.offset > 1 ? this.offset - 1 : 0; |
michael@0 | 153 | var nextOffset = this.offset >= aWholeText.length ? |
michael@0 | 154 | this.offset : this.offset + 1; |
michael@0 | 155 | var nextAfterNextOffset = nextOffset >= aWholeText.length ? |
michael@0 | 156 | nextOffset : nextOffset + 1; |
michael@0 | 157 | |
michael@0 | 158 | var charTests = [ |
michael@0 | 159 | [ testTextBeforeOffset, BOUNDARY_CHAR, |
michael@0 | 160 | prevOffset, this.offset ], |
michael@0 | 161 | [ testTextAtOffset, BOUNDARY_CHAR, |
michael@0 | 162 | this.offset, |
michael@0 | 163 | this.mAtWrappedLineEnd ? this.offset : nextOffset ], |
michael@0 | 164 | [ testTextAfterOffset, BOUNDARY_CHAR, |
michael@0 | 165 | this.mAtWrappedLineEnd ? this.offset : nextOffset, |
michael@0 | 166 | this.mAtWrappedLineEnd ? nextOffset : nextAfterNextOffset ] |
michael@0 | 167 | ]; |
michael@0 | 168 | |
michael@0 | 169 | return lineTests.concat(wordTests.concat(charTests)); |
michael@0 | 170 | } |
michael@0 | 171 | }); |
michael@0 | 172 | |
michael@0 | 173 | Object.defineProperty(this, "failures", { get: function() |
michael@0 | 174 | { |
michael@0 | 175 | if (this.mOffset == this.mLine.start) |
michael@0 | 176 | return this.mLine.lineStartFailures; |
michael@0 | 177 | if (this.mOffset == this.mLine.end) |
michael@0 | 178 | return this.mLine.lineEndFailures; |
michael@0 | 179 | return []; |
michael@0 | 180 | } |
michael@0 | 181 | }); |
michael@0 | 182 | |
michael@0 | 183 | this.mOffset = -1; |
michael@0 | 184 | this.mLine = new line(aWholeText, aLines, 0); |
michael@0 | 185 | this.mAtWrappedLineEnd = false; |
michael@0 | 186 | this.mWord = this.mLine.firstWord; |
michael@0 | 187 | } |
michael@0 | 188 | |
michael@0 | 189 | /** |
michael@0 | 190 | * A line object. Allows to navigate by lines and by words. |
michael@0 | 191 | */ |
michael@0 | 192 | function line(aWholeText, aLines, aIndex) |
michael@0 | 193 | { |
michael@0 | 194 | Object.defineProperty(this, "prevLine", { get: function() |
michael@0 | 195 | { |
michael@0 | 196 | return new line(aWholeText, aLines, aIndex - 1); |
michael@0 | 197 | } |
michael@0 | 198 | }); |
michael@0 | 199 | Object.defineProperty(this, "nextLine", { get: function() |
michael@0 | 200 | { |
michael@0 | 201 | return new line(aWholeText, aLines, aIndex + 1); |
michael@0 | 202 | } |
michael@0 | 203 | }); |
michael@0 | 204 | |
michael@0 | 205 | Object.defineProperty(this, "start", { get: function() |
michael@0 | 206 | { |
michael@0 | 207 | if (aIndex < 0) |
michael@0 | 208 | return 0; |
michael@0 | 209 | |
michael@0 | 210 | if (aIndex >= aLines.length) |
michael@0 | 211 | return aWholeText.length; |
michael@0 | 212 | |
michael@0 | 213 | return aLines[aIndex][2]; |
michael@0 | 214 | } |
michael@0 | 215 | }); |
michael@0 | 216 | Object.defineProperty(this, "end", { get: function() |
michael@0 | 217 | { |
michael@0 | 218 | if (aIndex < 0) |
michael@0 | 219 | return 0; |
michael@0 | 220 | |
michael@0 | 221 | if (aIndex >= aLines.length) |
michael@0 | 222 | return aWholeText.length; |
michael@0 | 223 | |
michael@0 | 224 | return aLines[aIndex][3]; |
michael@0 | 225 | } |
michael@0 | 226 | }); |
michael@0 | 227 | |
michael@0 | 228 | Object.defineProperty(this, "number", { get: function() |
michael@0 | 229 | { return aIndex; } |
michael@0 | 230 | }); |
michael@0 | 231 | Object.defineProperty(this, "wholeText", { get: function() |
michael@0 | 232 | { return aWholeText; } |
michael@0 | 233 | }); |
michael@0 | 234 | this.isFakeLine = function line_isFakeLine() |
michael@0 | 235 | { |
michael@0 | 236 | return aIndex < 0 || aIndex >= aLines.length; |
michael@0 | 237 | } |
michael@0 | 238 | |
michael@0 | 239 | Object.defineProperty(this, "lastWord", { get: function() |
michael@0 | 240 | { |
michael@0 | 241 | if (aIndex < 0) |
michael@0 | 242 | return new word(this, [], -1); |
michael@0 | 243 | if (aIndex >= aLines.length) |
michael@0 | 244 | return new word(this, [], 0); |
michael@0 | 245 | |
michael@0 | 246 | var words = aLines[aIndex][4].words; |
michael@0 | 247 | return new word(this, words, words.length - 2); |
michael@0 | 248 | } |
michael@0 | 249 | }); |
michael@0 | 250 | Object.defineProperty(this, "firstWord", { get: function() |
michael@0 | 251 | { |
michael@0 | 252 | if (aIndex < 0) |
michael@0 | 253 | return new word(this, [], -1); |
michael@0 | 254 | if (aIndex >= aLines.length) |
michael@0 | 255 | return new word(this, [], 0); |
michael@0 | 256 | |
michael@0 | 257 | var words = aLines[aIndex][4].words; |
michael@0 | 258 | return new word(this, words, 0); |
michael@0 | 259 | } |
michael@0 | 260 | }); |
michael@0 | 261 | |
michael@0 | 262 | this.isLastWord = function line_isLastWord(aWord) |
michael@0 | 263 | { |
michael@0 | 264 | var lastWord = this.lastWord; |
michael@0 | 265 | return lastWord.start == aWord.start && lastWord.end == aWord.end; |
michael@0 | 266 | } |
michael@0 | 267 | |
michael@0 | 268 | Object.defineProperty(this, "lineStartFailures", { get: function() |
michael@0 | 269 | { |
michael@0 | 270 | if (aIndex < 0 || aIndex >= aLines.length) |
michael@0 | 271 | return []; |
michael@0 | 272 | |
michael@0 | 273 | return aLines[aIndex][4].lsf || []; |
michael@0 | 274 | } |
michael@0 | 275 | }); |
michael@0 | 276 | Object.defineProperty(this, "lineEndFailures", { get: function() |
michael@0 | 277 | { |
michael@0 | 278 | if (aIndex < 0 || aIndex >= aLines.length) |
michael@0 | 279 | return []; |
michael@0 | 280 | |
michael@0 | 281 | return aLines[aIndex][4].lef || []; |
michael@0 | 282 | } |
michael@0 | 283 | }); |
michael@0 | 284 | } |
michael@0 | 285 | |
michael@0 | 286 | /** |
michael@0 | 287 | * A word object. Allows to navigate by words. |
michael@0 | 288 | */ |
michael@0 | 289 | function word(aLine, aWords, aIndex) |
michael@0 | 290 | { |
michael@0 | 291 | Object.defineProperty(this, "prevWord", { get: function() |
michael@0 | 292 | { |
michael@0 | 293 | if (aIndex >= 2) |
michael@0 | 294 | return new word(aLine, aWords, aIndex - 2); |
michael@0 | 295 | |
michael@0 | 296 | var prevLineLastWord = aLine.prevLine.lastWord; |
michael@0 | 297 | if (this.start == prevLineLastWord.start && !this.isFakeStartWord()) |
michael@0 | 298 | return prevLineLastWord.prevWord; |
michael@0 | 299 | return prevLineLastWord; |
michael@0 | 300 | } |
michael@0 | 301 | }); |
michael@0 | 302 | Object.defineProperty(this, "nextWord", { get: function() |
michael@0 | 303 | { |
michael@0 | 304 | if (aIndex + 2 < aWords.length) |
michael@0 | 305 | return new word(aLine, aWords, aIndex + 2); |
michael@0 | 306 | |
michael@0 | 307 | var nextLineFirstWord = aLine.nextLine.firstWord; |
michael@0 | 308 | if (this.end == nextLineFirstWord.end && !this.isFakeEndWord()) |
michael@0 | 309 | return nextLineFirstWord.nextWord; |
michael@0 | 310 | return nextLineFirstWord; |
michael@0 | 311 | } |
michael@0 | 312 | }); |
michael@0 | 313 | |
michael@0 | 314 | Object.defineProperty(this, "line", { get: function() { return aLine; } }); |
michael@0 | 315 | |
michael@0 | 316 | Object.defineProperty(this, "start", { get: function() |
michael@0 | 317 | { |
michael@0 | 318 | if (this.isFakeStartWord()) |
michael@0 | 319 | return 0; |
michael@0 | 320 | |
michael@0 | 321 | if (this.isFakeEndWord()) |
michael@0 | 322 | return aLine.end; |
michael@0 | 323 | return aWords[aIndex]; |
michael@0 | 324 | } |
michael@0 | 325 | }); |
michael@0 | 326 | Object.defineProperty(this, "end", { get: function() |
michael@0 | 327 | { |
michael@0 | 328 | if (this.isFakeStartWord()) |
michael@0 | 329 | return 0; |
michael@0 | 330 | |
michael@0 | 331 | return this.isFakeEndWord() ? aLine.end : aWords[aIndex + 1]; |
michael@0 | 332 | } |
michael@0 | 333 | }); |
michael@0 | 334 | |
michael@0 | 335 | this.toString = function word_toString() |
michael@0 | 336 | { |
michael@0 | 337 | var start = this.start, end = this.end; |
michael@0 | 338 | return "'" + aLine.wholeText.substring(start, end) + |
michael@0 | 339 | "' at [" + start + ", " + end + "]"; |
michael@0 | 340 | } |
michael@0 | 341 | |
michael@0 | 342 | this.isFakeStartWord = function() { return aIndex < 0; } |
michael@0 | 343 | this.isFakeEndWord = function() { return aIndex >= aWords.length; } |
michael@0 | 344 | } |
michael@0 | 345 | |
michael@0 | 346 | /** |
michael@0 | 347 | * A template invoker to move through the text. |
michael@0 | 348 | */ |
michael@0 | 349 | function tmpl_moveTo(aID, aInvokerFunc, aWholeText, aCharIter) |
michael@0 | 350 | { |
michael@0 | 351 | this.offset = aCharIter.offset; |
michael@0 | 352 | |
michael@0 | 353 | var checker = new caretMoveChecker(this.offset, aID); |
michael@0 | 354 | this.__proto__ = new (aInvokerFunc)(aID, checker); |
michael@0 | 355 | |
michael@0 | 356 | this.finalCheck = function genericMoveTo_finalCheck() |
michael@0 | 357 | { |
michael@0 | 358 | if (this.noTests()) |
michael@0 | 359 | return; |
michael@0 | 360 | |
michael@0 | 361 | for (var i = 0; i < this.tests.length; i++) { |
michael@0 | 362 | var func = this.tests[i][0]; |
michael@0 | 363 | var boundary = this.tests[i][1]; |
michael@0 | 364 | var startOffset = this.tests[i][2]; |
michael@0 | 365 | var endOffset = this.tests[i][3]; |
michael@0 | 366 | var text = aWholeText.substring(startOffset, endOffset); |
michael@0 | 367 | |
michael@0 | 368 | var isOk1 = kOk, isOk2 = kOk, isOk3 = kOk; |
michael@0 | 369 | for (var fIdx = 0; fIdx < this.failures.length; fIdx++) { |
michael@0 | 370 | var failure = this.failures[fIdx]; |
michael@0 | 371 | if (func.name.indexOf(failure[0]) != -1 && boundary == failure[1]) { |
michael@0 | 372 | isOk1 = failure[2]; |
michael@0 | 373 | isOk2 = failure[3]; |
michael@0 | 374 | isOk3 = failure[4]; |
michael@0 | 375 | } |
michael@0 | 376 | } |
michael@0 | 377 | |
michael@0 | 378 | func.call(null, kCaretOffset, boundary, text, startOffset, endOffset, |
michael@0 | 379 | aID, isOk1, isOk2, isOk3); |
michael@0 | 380 | } |
michael@0 | 381 | } |
michael@0 | 382 | |
michael@0 | 383 | this.getID = function genericMoveTo_getID() |
michael@0 | 384 | { |
michael@0 | 385 | return "move to " + this.offsetDescr; |
michael@0 | 386 | } |
michael@0 | 387 | |
michael@0 | 388 | this.noTests = function tmpl_moveTo_noTests() |
michael@0 | 389 | { |
michael@0 | 390 | return ("debugOffset" in aCharIter) && |
michael@0 | 391 | (aCharIter.debugOffset != this.offset); |
michael@0 | 392 | } |
michael@0 | 393 | |
michael@0 | 394 | this.offsetDescr = aCharIter.offsetDescr; |
michael@0 | 395 | this.tests = this.noTests() ? null : aCharIter.tests; |
michael@0 | 396 | this.failures = aCharIter.failures; |
michael@0 | 397 | } |
michael@0 | 398 | |
michael@0 | 399 | var gQueue = null; |
michael@0 | 400 | function doTest() |
michael@0 | 401 | { |
michael@0 | 402 | gQueue = new eventQueue(); |
michael@0 | 403 | |
michael@0 | 404 | // __a__w__o__r__d__\n |
michael@0 | 405 | // 0 1 2 3 4 5 |
michael@0 | 406 | // __t__w__o__ (soft line break) |
michael@0 | 407 | // 6 7 8 9 |
michael@0 | 408 | // __w__o__r__d__s |
michael@0 | 409 | // 10 11 12 13 14 15 |
michael@0 | 410 | |
michael@0 | 411 | traverseTextByLines(gQueue, "textarea", |
michael@0 | 412 | [ [ "aword", "\n", 0, 5, { words: [ 0, 5 ] } ], |
michael@0 | 413 | [ "two ", "", 6, 10, { words: [ 6, 9 ] } ], |
michael@0 | 414 | [ "words", "", 10, 15, { words: [ 10, 15 ] } ] |
michael@0 | 415 | ] ); |
michael@0 | 416 | |
michael@0 | 417 | var line2 = [ // " my " |
michael@0 | 418 | [ "TextBeforeOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ], |
michael@0 | 419 | [ "TextAfterOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ] |
michael@0 | 420 | ]; |
michael@0 | 421 | var line4 = [ // "riend" |
michael@0 | 422 | [ "TextBeforeOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ], |
michael@0 | 423 | [ "TextAfterOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ] |
michael@0 | 424 | ]; |
michael@0 | 425 | var line5 = [ // " t " |
michael@0 | 426 | [ "TextBeforeOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ], |
michael@0 | 427 | [ "TextAfterOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ] |
michael@0 | 428 | ]; |
michael@0 | 429 | traverseTextByLines(gQueue, "ta_wrapped", |
michael@0 | 430 | [ [ "hi ", "", 0, 3, { words: [ 0, 2 ] } ], |
michael@0 | 431 | [ "hello", "", 3, 8, { words: [ 3, 8 ] } ], |
michael@0 | 432 | [ " my ", "", 8, 12, { words: [ 9, 11 ], lsf: line2 } ], |
michael@0 | 433 | [ "longf", "", 12, 17, { words: [ 12, 17 ] } ], |
michael@0 | 434 | [ "riend", "", 17, 22, { words: [ 17, 22 ], lsf: line4 } ], |
michael@0 | 435 | [ " t ", "", 22, 25, { words: [ 23, 24 ], lsf: line5 } ], |
michael@0 | 436 | [ "sq t", "", 25, 29, { words: [ 25, 27, 28, 29 ] } ] |
michael@0 | 437 | ] ); |
michael@0 | 438 | |
michael@0 | 439 | gQueue.invoke(); // will call SimpleTest.finish(); |
michael@0 | 440 | } |
michael@0 | 441 | |
michael@0 | 442 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 443 | addA11yLoadEvent(doTest); |
michael@0 | 444 | </script> |
michael@0 | 445 | </head> |
michael@0 | 446 | <body> |
michael@0 | 447 | |
michael@0 | 448 | <a target="_blank" |
michael@0 | 449 | title="nsIAccessibleText getText related functions tests at caret offset" |
michael@0 | 450 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=852021"> |
michael@0 | 451 | Bug 852021 |
michael@0 | 452 | </a> |
michael@0 | 453 | <p id="display"></p> |
michael@0 | 454 | <div id="content" style="display: none"></div> |
michael@0 | 455 | <pre id="test"> |
michael@0 | 456 | |
michael@0 | 457 | <textarea id="textarea" cols="5">aword |
michael@0 | 458 | two words</textarea> |
michael@0 | 459 | |
michael@0 | 460 | <textarea id="ta_wrapped" cols="5">hi hello my longfriend t sq t</textarea> |
michael@0 | 461 | </pre> |
michael@0 | 462 | </body> |
michael@0 | 463 | </html> |