author | Ehsan Akhgari <ehsan@mozilla.com> |
Sun, 20 Mar 2011 15:53:23 -0400 | |
changeset 63602 | 57770167ce805f99ffd9d67537cbcd50824b378a |
parent 63601 | d09549b1b66453a9f9664277dace7f0977a59034 |
child 63603 | f6446439866d1948334dcd53fd4d578b489c1674 |
push id | 19245 |
push user | eakhgari@mozilla.com |
push date | Wed, 23 Mar 2011 21:40:43 +0000 |
treeherder | mozilla-central@47af4dfc6d16 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | roc |
bugs | 642823 |
milestone | 2.2a1pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/generic/test/test_bug496275.html +++ b/layout/generic/test/test_bug496275.html @@ -66,29 +66,16 @@ function isAt(anchorNode, anchorOffset, var sel = window.getSelection(); isOrIsParent(sel.anchorNode, $(anchorNode), msg + ": Wrong anchor node."); is(sel.anchorOffset, anchorOffset, msg + ": Wrong anchor offset."); isOrIsParent(sel.focusNode, $(focusNode), msg + ": Wrong focus node."); is(sel.focusOffset, $(focusOffset), msg + ": Wrong focus offset."); } -// Some of this behaves differently on windows and mac/linux. -function winIsAt(anchorNode, anchorOffset, focusNode, focusOffset, msg) { - if (navigator.platform.indexOf("Win") != -1) { - isAt(anchorNode, anchorOffset, focusNode, focusOffset, msg); - } -} - -function unixIsAt(anchorNode, anchorOffset, focusNode, focusOffset, msg) { - if (navigator.platform.indexOf("Win") == -1) { - isAt(anchorNode, anchorOffset, focusNode, focusOffset, msg); - } -} - function run() { var sel = window.getSelection(); // If nothing is focused, selection.modify() should silently fail. sel.removeAllRanges(); sel.modify("move", "forward", "character"); // Similarly, we should silently fail if the selection has been detached. @@ -137,24 +124,22 @@ function run() { sel.modify("extend", "backward", "character"); sel.modify("extend", "backward", "character"); sel.modify("extend", "forward", "character"); isAt("p3", 0, "p3", 14, "test 4"); // Put the cursor at the beginning of p3, then go forward a few words sel.collapse($("p3"), 0); sel.modify("Move", "Forward", "Word"); - unixIsAt("p3", 4, "p3", 4, "test 4a"); - winIsAt ("p3", 5, "p3", 5, "test 4a"); + isAt("p3", 4, "p3", 4, "test 4a"); sel.modify("move", "forward", "word"); // Go back and forward so the indexes are correct. sel.modify("move", "backward", "character"); sel.modify("move", "forward", "character"); - unixIsAt("p3", 14, "p3", 14, "test 4b"); - winIsAt ("p3", 0, "p3", 0, "test 4b"); + isAt("p3", 14, "p3", 14, "test 4b"); // Test the lineboundary granularity sel.collapse($("p3"), 0); sel.modify("Move", "Forward", "Lineboundary"); // Go back and forward so the indexes are correct. sel.modify("move", "Backward", "character"); sel.modify("move", "forward", "character"); isAt("p3", 14, "p3", 14, "test 5"); @@ -172,26 +157,23 @@ function run() { sel.modify("extend", "forward", "character"); isAt("l1", 1, "l1", 1, "test 6d"); sel.modify("Extend", "Right", "Character"); isAt("l1", 1, "l1", 0, "test 6e"); sel.collapse($("l1"), 0); sel.modify("move", "left", "character"); sel.modify("extend", "right", "Word"); - unixIsAt("l1", 1, "l1", 3, "test 7a"); - winIsAt ("l1", 1, "l1", 4, "test 7a"); + isAt("l1", 1, "l1", 3, "test 7a"); sel.modify("move", "left", "word"); isAt("l1", 3, "l1", 3, "test 7b"); sel.modify("move", "forward", "word"); - unixIsAt("l1", 9, "l1", 9, "test 7c"); - winIsAt ("l1", 4, "l1", 4, "test 7c"); + isAt("l1", 9, "l1", 9, "test 7c"); sel.modify("extend", "backward", "word"); - unixIsAt("l1", 9, "l1", 4, "test 7d"); - winIsAt ("l1", 4, "l1", 0, "test 7d"); + isAt("l1", 9, "l1", 4, "test 7d"); sel.modify("move", "left", "word"); isAt("l1", 3, "l1", 3, "test 7e"); sel.collapse($("l1"), 0); sel.modify("extend", "left", "lineboundary"); isAt("l1", 0, "l1", 3, "test 8a"); sel.modify("move", "forward", "lineboundary"); isAt("l1", 9, "l1", 9, "test 8b"); @@ -229,55 +211,48 @@ function run() { // $("rtl").focus(); sel.collapse($("r1"), 0); sel.modify("move", "forward", "character"); isAt("r1", 1, "r1", 1, "test 11a"); sel.modify("extend", "backward", "character"); isAt("r1", 1, "r1", 0, "test 11b"); sel.modify("move", "forward", "word"); - unixIsAt("r1", 6, "r1", 6, "test 11c"); - winIsAt ("r1", 7, "r1", 7, "test 11c"); + isAt("r1", 6, "r1", 6, "test 11c"); sel.modify("extend", "backward", "word"); - unixIsAt("r1", 6, "r1", 0, "test 11d"); - winIsAt ("r1", 7, "r1", 0, "test 11d"); + isAt("r1", 6, "r1", 0, "test 11d"); sel.modify("extend", "forward", "lineboundary"); - unixIsAt("r1", 6, "r1", 45, "test 11e"); - winIsAt ("r1", 7, "r1", 45, "test 11e"); + isAt("r1", 6, "r1", 45, "test 11e"); // Same as above, but with absolute directions. sel.collapse($("r1"), 0); sel.modify("move", "left", "character"); isAt("r1", 1, "r1", 1, "test 12a"); sel.modify("extend", "right", "character"); isAt("r1", 1, "r1", 0, "test 12b"); sel.modify("move", "left", "word"); - unixIsAt("r1", 6, "r1", 6, "test 12c"); - winIsAt ("r1", 7, "r1", 7, "test 12c"); + isAt("r1", 6, "r1", 6, "test 12c"); sel.modify("extend", "right", "word"); - unixIsAt("r1", 6, "r1", 0, "test 12d"); - winIsAt ("r1", 7, "r1", 0, "test 12d"); + isAt("r1", 6, "r1", 0, "test 12d"); // Test that move left/right is correct within the RTL div. sel.collapse($("r1"), 0); sel.modify("extend", "left", "lineboundary"); isAt("r1", 0, "r1", 45, "test 13a"); sel.modify("move", "right", "lineboundary"); isAt("r1", 0, "r1", 0, "test 13b"); // Test that up/down at the first/last line correctly wraps to the // beginning/end of the line. sel.collapse($("r1"), 0); sel.modify("move", "forward", "word"); - unixIsAt("r1", 6, "r1", 6, "test 14a"); - winIsAt ("r1", 7, "r1", 7, "test 14a"); + isAt("r1", 6, "r1", 6, "test 14a"); // Even in RTL text, "left" still means up. sel.modify("extend", "left", "Line"); - unixIsAt("r1", 6, "r1", 0, "test 14b"); - winIsAt ("r1", 7, "r1", 0, "test 14b"); + isAt("r1", 6, "r1", 0, "test 14b"); sel.modify("move", "right", "line"); isAt("r2", 0, "r2", 0, "test 14c"); sel.modify("extend", "forward", "line"); isAt("r2", 0, "r2", 57, "test 14d"); sel.modify("move", "backward", "line"); isAt("r1", 45, "r1", 45, "test 14e"); // Test some special characters. @@ -289,18 +264,17 @@ function run() { isAt("s1", 3, "s1", 3, "test 15a"); sel.modify("move", "forward", "character"); isAt("s1", 4, "s1", 4, "test 15b"); sel.modify("move", "backward", "word"); isAt("s1", 2, "s1", 2, "test 15c"); sel.modify("move", "forward", "word"); sel.modify("move", "forward", "word"); sel.modify("move", "forward", "word"); - unixIsAt("s1", 9, "s1", 9, "test 15d"); - winIsAt ("s1", 10, "s1", 10, "test 15d"); + isAt("s1", 9, "s1", 9, "test 15d"); SimpleTest.finish(); } function update_debug_info() { var sel = window.getSelection(); document.getElementById("anchor-offset").innerHTML = sel.anchorOffset; document.getElementById("focus-offset").innerHTML = sel.focusOffset;