mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 8 changesets (bug 1129078, bug 1128722) for mochitest-5 failures
Backed out changeset f7eff607655a (bug 1128722) Backed out changeset 801b3abc0de8 (bug 1128722) Backed out changeset 275d27c2dba0 (bug 1129078) Backed out changeset 9830ab1a2028 (bug 1129078) Backed out changeset ce5cb876af9a (bug 1129078) Backed out changeset c199ff86c77f (bug 1129078) Backed out changeset 38b1b039f14d (bug 1129078) Backed out changeset c8a99ee97313 (bug 1129078)
This commit is contained in:
parent
0953a3bcec
commit
b1abeb037e
@ -49,7 +49,6 @@ public:
|
||||
, mIsDetached(false)
|
||||
, mMaySpanAnonymousSubtrees(false)
|
||||
, mInSelection(false)
|
||||
, mIsGenerated(false)
|
||||
, mStartOffsetWasIncremented(false)
|
||||
, mEndOffsetWasIncremented(false)
|
||||
, mEnableGravitationOnElementRemoval(true)
|
||||
@ -154,27 +153,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this range was generated.
|
||||
* @see SetIsGenerated
|
||||
*/
|
||||
bool IsGenerated() const
|
||||
{
|
||||
return mIsGenerated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this range as being generated or not.
|
||||
* Currently it is used for marking ranges that are created when splitting up
|
||||
* a range to exclude a -moz-user-select:none region.
|
||||
* @see Selection::AddItem
|
||||
* @see ExcludeNonSelectableNodes
|
||||
*/
|
||||
void SetIsGenerated(bool aIsGenerated)
|
||||
{
|
||||
mIsGenerated = aIsGenerated;
|
||||
}
|
||||
|
||||
nsINode* GetCommonAncestor() const;
|
||||
void Reset();
|
||||
nsresult SetStart(nsINode* aParent, int32_t aOffset);
|
||||
@ -355,7 +333,6 @@ protected:
|
||||
bool mIsDetached;
|
||||
bool mMaySpanAnonymousSubtrees;
|
||||
bool mInSelection;
|
||||
bool mIsGenerated;
|
||||
bool mStartOffsetWasIncremented;
|
||||
bool mEndOffsetWasIncremented;
|
||||
bool mEnableGravitationOnElementRemoval;
|
||||
|
Binary file not shown.
@ -2,7 +2,6 @@
|
||||
# Android: SLOW_DIRECTORY; Mulet: bug 1048441, bug 1087611, bug 1112988, etc.
|
||||
skip-if = toolkit == 'android' || buildapp == 'mulet'
|
||||
support-files =
|
||||
Ahem.ttf
|
||||
border_radius_hit_testing_iframe.html
|
||||
preserve3d_sorting_hit_testing_iframe.html
|
||||
image_rgrg-256x256.png
|
||||
@ -70,11 +69,6 @@ support-files =
|
||||
bug1123067-2.html
|
||||
bug1123067-3.html
|
||||
bug1123067-ref.html
|
||||
selection-utils.js
|
||||
multi-range-user-select.html
|
||||
multi-range-user-select-ref.html
|
||||
multi-range-script-select.html
|
||||
multi-range-script-select-ref.html
|
||||
|
||||
[test_preserve3d_sorting_hit_testing.html]
|
||||
[test_after_paint_pref.html]
|
||||
|
@ -1,173 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase #1 for bug 1129078</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="selection-utils.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: Ahem;
|
||||
src: url("Ahem.ttf");
|
||||
}
|
||||
html,body { margin:0; padding: 0; }
|
||||
body,pre { font-family: Ahem; font-size: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="select">
|
||||
2af45494-ak7e-11e4-a0c6-a7e7
|
||||
38222880-bj6d-11e4-8064-fb7b
|
||||
3d649ae4-ci5c-11e4-995d-17b2
|
||||
434351bc-dh4b-11e4-9971-4fc8
|
||||
4dc0e0b4-eg4a-11e4-8c28-5319
|
||||
a96319c8-ad7d-11e4-b312-039c
|
||||
</pre>
|
||||
|
||||
<pre id="log" style="border:1px solid green"></pre>
|
||||
|
||||
<script>
|
||||
|
||||
var sel = window.getSelection();
|
||||
var e = document.querySelector('#select');
|
||||
function setupSelectionPrev3() {
|
||||
addChildRanges([[0,150,0,160], [0,65,0,70], [0,15,0,15]], e);
|
||||
sel.extend(e.firstChild, 10); // to get eDirPrevious direction
|
||||
}
|
||||
function setupSelectionPrev2() {
|
||||
addChildRanges([[0,150,0,160], [0,70,0,70]], e);
|
||||
sel.extend(e.firstChild, 65); // to get eDirPrevious direction
|
||||
}
|
||||
function setupSelectionPrev1() {
|
||||
addChildRanges([[0,160,0,160]], e);
|
||||
sel.extend(e.firstChild, 150); // to get eDirPrevious direction
|
||||
}
|
||||
|
||||
function setupSelectionNext3() {
|
||||
addChildRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
}
|
||||
function setupSelectionNext2() {
|
||||
addChildRanges([[0,10,0,15], [0,65,0,70]], e);
|
||||
}
|
||||
function setupSelectionNext2b() {
|
||||
addChildRanges([[0,15,0,80], [0,150,0,160]], e);
|
||||
}
|
||||
function setupSelectionNext1() {
|
||||
addChildRanges([[0,10,0,15]], e);
|
||||
}
|
||||
function setupSelectionNext1b() {
|
||||
addChildRanges([[0,15,0,170]], e);
|
||||
}
|
||||
function setupSelectionNext1c() {
|
||||
addChildRanges([[0,150,0,160]], e);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var hash = window.location.hash
|
||||
var op = hash.substring(6,8);
|
||||
var test = hash.substring(0,6);
|
||||
if (hash.substring(0,5) == "#prev") {
|
||||
if (test == "#prev1") {
|
||||
setupSelectionPrev3();
|
||||
if (op == "SL") {
|
||||
sel.extend(e.firstChild, 8);
|
||||
} else if (op == "SR") {
|
||||
sel.extend(e.firstChild, 12);
|
||||
} else if (op == "AD") {
|
||||
addChildRanges([[0,1,0,2]], e);
|
||||
} else {
|
||||
sel.extend(e.firstChild, 1);
|
||||
}
|
||||
} else if (test == "#prev2") {
|
||||
setupSelectionPrev3();
|
||||
sel.extend(e.firstChild, 13);
|
||||
} else if (test == "#prev3") {
|
||||
if (op == "S_") {
|
||||
setupSelectionPrev3();
|
||||
sel.extend(e.firstChild, 20);
|
||||
} else if (op == "SA") {
|
||||
setupSelectionPrev3();
|
||||
sel.extend(e.firstChild, 20);
|
||||
}
|
||||
} else if (test == "#prev4") {
|
||||
addChildRanges([[0,67,0,70], [0,150,0,160], [0,15,0,67]], e);
|
||||
} else if (test == "#prev5") {
|
||||
if (op == "S_") {
|
||||
setupSelectionNext2b();
|
||||
} else if (op == "SA") {
|
||||
setupSelectionNext2b();
|
||||
}
|
||||
} else if (test == "#prev6") {
|
||||
addChildRanges([[0,152,0,160], [0,15,0,152]], e);
|
||||
} else if (test == "#prev7") {
|
||||
if (op == "AD") {
|
||||
setupSelectionPrev3();
|
||||
addChildRanges([[0,168,0,170]], e);
|
||||
} else if (op == "S_") {
|
||||
setupSelectionNext1b();
|
||||
} else if (op == "SA") {
|
||||
setupSelectionNext1b();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (test == "#next1") {
|
||||
if (op == "SL") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 158);
|
||||
} else if (op == "SR") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 162);
|
||||
} else if (op == "AD") {
|
||||
setupSelectionNext3();
|
||||
addChildRanges([[0,1,0,2]], e);
|
||||
} else if (op == "S_") {
|
||||
setupSelectionNext1c();
|
||||
sel.extend(e.firstChild, 1);
|
||||
} else if (op == "SA") {
|
||||
setupSelectionNext1c();
|
||||
sel.extend(e.firstChild, 1);
|
||||
}
|
||||
} else if (test == "#next2") {
|
||||
addChildRanges([[0,10,0,13], [0,150,0,151]], e);
|
||||
sel.extend(e.firstChild, 13);
|
||||
} else if (test == "#next3") {
|
||||
if (op == "S_") {
|
||||
addChildRanges([[0,10,0,15], [0,150,0,151]], e);
|
||||
sel.extend(e.firstChild, 20);
|
||||
} else if (op == "SA") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 20);
|
||||
}
|
||||
} else if (test == "#next4") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 67);
|
||||
} else if (test == "#next5") {
|
||||
if (op == "S_") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 80);
|
||||
} else if (op == "SA") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 80);
|
||||
}
|
||||
} else if (test == "#next6") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 152);
|
||||
} else if (test == "#next7") {
|
||||
setupSelectionNext3();
|
||||
if (op == "AD") {
|
||||
addChildRanges([[0,168,0,170]], e);
|
||||
} else {
|
||||
sel.extend(e.firstChild, 170);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTest);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,185 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase #1 for bug 1129078</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="selection-utils.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: Ahem;
|
||||
src: url("Ahem.ttf");
|
||||
}
|
||||
html,body { margin:0; padding: 0; }
|
||||
body,pre { font-family: Ahem; font-size: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="select">
|
||||
2af45494-ak7e-11e4-a0c6-a7e7
|
||||
38222880-bj6d-11e4-8064-fb7b
|
||||
3d649ae4-ci5c-11e4-995d-17b2
|
||||
434351bc-dh4b-11e4-9971-4fc8
|
||||
4dc0e0b4-eg4a-11e4-8c28-5319
|
||||
a96319c8-ad7d-11e4-b312-039c
|
||||
</pre>
|
||||
|
||||
<pre id="log" style="border:1px solid green"></pre>
|
||||
|
||||
<script>
|
||||
window.info = parent.info;
|
||||
window.is = parent.is;
|
||||
window.isnot = parent.isnot;
|
||||
window.ok = parent.ok;
|
||||
|
||||
function setupPrevSelection() {
|
||||
var sel = window.getSelection();
|
||||
var e = document.querySelector('#select');
|
||||
addChildRanges([[0,150,0,160], [0,65,0,70], [0,15,0,15]], e);
|
||||
sel.extend(e.firstChild, 10); // to get eDirPrevious direction
|
||||
}
|
||||
|
||||
function setupNextSelection() {
|
||||
var sel = window.getSelection();
|
||||
var e = document.querySelector('#select');
|
||||
addChildRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
}
|
||||
|
||||
var ops = {
|
||||
S_ : shiftClick,
|
||||
SA : shiftAccelClick,
|
||||
AD : accelDragSelect,
|
||||
SL : keyLeft,
|
||||
SR : keyRight
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var e = document.querySelector('#select');
|
||||
var hash = window.location.hash
|
||||
if (hash.substring(0,5)=="#prev")
|
||||
setupPrevSelection();
|
||||
else
|
||||
setupNextSelection();
|
||||
var op = hash.substring(6,8);
|
||||
var action = ops[op];
|
||||
var test = hash.substring(0,6);
|
||||
if (hash.substring(0,5) == "#prev") {
|
||||
if (test == "#prev1") {
|
||||
if (action == keyLeft) {
|
||||
keyLeft({shiftKey:true}, 2)
|
||||
checkRanges([[0,8,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else if (action == keyRight) {
|
||||
keyRight({shiftKey:true}, 2)
|
||||
checkRanges([[0,12,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 30, 50);
|
||||
checkRanges([[0,1,0,2], [0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else {
|
||||
action(e, 30);
|
||||
checkRanges([[0,1,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
}
|
||||
} else if (test == "#prev2") {
|
||||
action(e, 260);
|
||||
checkRanges([[0,13,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else if (test == "#prev3") {
|
||||
action(e, 400);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,15,0,20], [0,65,0,70], [0,150,0,160]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,15,0,20], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else if (test == "#prev4") {
|
||||
action(e, 180, 65);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,15,0,67], [0,67,0,70], [0,150,0,160]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,15,0,67], [0,67,0,70], [0,150,0,160]], e);
|
||||
} else if (test == "#prev5") {
|
||||
action(e, 440, 65);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,15,0,80], [0,150,0,160]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,15,0,80], [0,150,0,160]], e);
|
||||
} else if (test == "#prev6") {
|
||||
action(e, 140, 125);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,15,0,152], [0,152,0,160]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,15,0,152], [0,152,0,160]], e);
|
||||
} else if (test == "#prev7") {
|
||||
if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 460, 500, 125);
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160], [0,168,0,170]], e);
|
||||
} else if (action == shiftClick) {
|
||||
action(e, 500, 125);
|
||||
checkRanges([[0,15,0,170]], e);
|
||||
} else if (action == shiftAccelClick) {
|
||||
action(e, 500, 125);
|
||||
checkRanges([[0,15,0,170]], e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (test == "#next1") {
|
||||
if (action == keyLeft) {
|
||||
keyLeft({shiftKey:true}, 2)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,158]], e);
|
||||
} else if (action == keyRight) {
|
||||
keyRight({shiftKey:true}, 2)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,162]], e);
|
||||
} else if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 30, 50);
|
||||
checkRanges([[0,1,0,2], [0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
} else {
|
||||
action(e, 30);
|
||||
checkRanges([[0,1,0,150]], e);
|
||||
}
|
||||
} else if (test == "#next2") {
|
||||
action(e, 260);
|
||||
checkRanges([[0,10,0,13], [0,13,0,150]], e);
|
||||
} else if (test == "#next3") {
|
||||
action(e, 400);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,10,0,15], [0,20,0,150]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,10,0,15], [0,20,0,150]], e);
|
||||
} else if (test == "#next4") {
|
||||
action(e, 180, 65);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,67], [0,67,0,150]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,67], [0,67,0,150]], e);
|
||||
} else if (test == "#next5") {
|
||||
action(e, 440, 65);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,80,0,150]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,80,0,150]], e);
|
||||
} else if (test == "#next6") {
|
||||
action(e, 140, 125);
|
||||
if (action == shiftClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,152]], e);
|
||||
else if (action == shiftAccelClick)
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,152]], e);
|
||||
} else if (test == "#next7") {
|
||||
if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 460, 500, 125);
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160], [0,168,0,170]], e);
|
||||
} else if (action == shiftClick) {
|
||||
action(e, 500, 125);
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,170]], e);
|
||||
} else if (action == shiftAccelClick) {
|
||||
action(e, 500, 125);
|
||||
checkRanges([[0,10,0,15], [0,65,0,70], [0,150,0,170]], e);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTest);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,166 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase #1 for bug 1129078</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="selection-utils.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: Ahem;
|
||||
src: url("Ahem.ttf");
|
||||
}
|
||||
html,body { margin:0; padding: 0; }
|
||||
body,pre { font-family: Ahem; font-size: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="select">
|
||||
2af45494-ak7e-11e4-a0c6-a7e7
|
||||
38222880-bj6d-11e4-8064-fb7b
|
||||
3d649ae4-ci5c-11e4-995d-17b2
|
||||
434351bc-dh4b-11e4-9971-4fc8
|
||||
4dc0e0b4-eg4a-11e4-8c28-5319
|
||||
a96319c8-ad7d-11e4-b312-039c
|
||||
</pre>
|
||||
|
||||
<pre id="log" style="border:1px solid green"></pre>
|
||||
|
||||
<script>
|
||||
|
||||
var sel = window.getSelection();
|
||||
var e = document.querySelector('#select');
|
||||
function setupSelectionPrev3() {
|
||||
addChildRanges([[0,150,0,160], [0,65,0,70], [0,15,0,15]], e);
|
||||
sel.extend(e.firstChild, 10); // to get eDirPrevious direction
|
||||
}
|
||||
function setupSelectionPrev2() {
|
||||
addChildRanges([[0,150,0,160], [0,70,0,70]], e);
|
||||
sel.extend(e.firstChild, 65); // to get eDirPrevious direction
|
||||
}
|
||||
function setupSelectionPrev1() {
|
||||
addChildRanges([[0,160,0,160]], e);
|
||||
sel.extend(e.firstChild, 150); // to get eDirPrevious direction
|
||||
}
|
||||
|
||||
function setupSelectionNext3() {
|
||||
addChildRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
|
||||
}
|
||||
function setupSelectionNext2() {
|
||||
addChildRanges([[0,10,0,15], [0,65,0,70]], e);
|
||||
}
|
||||
function setupSelectionNext2b() {
|
||||
addChildRanges([[0,15,0,80], [0,150,0,160]], e);
|
||||
}
|
||||
function setupSelectionNext1() {
|
||||
addChildRanges([[0,10,0,15]], e);
|
||||
}
|
||||
function setupSelectionNext1b() {
|
||||
addChildRanges([[0,15,0,170]], e);
|
||||
}
|
||||
function setupSelectionNext1c() {
|
||||
addChildRanges([[0,150,0,160]], e);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
document.body.offsetHeight;
|
||||
var hash = window.location.hash
|
||||
var op = hash.substring(6,8);
|
||||
var test = hash.substring(0,6);
|
||||
if (hash.substring(0,5) == "#prev") {
|
||||
if (test == "#prev1") {
|
||||
setupSelectionPrev3();
|
||||
if (op == "SL") {
|
||||
sel.extend(e.firstChild, 8);
|
||||
} else if (op == "SR") {
|
||||
sel.extend(e.firstChild, 12);
|
||||
} else if (op == "AD") {
|
||||
addChildRanges([[0,1,0,2]], e);
|
||||
} else {
|
||||
sel.extend(e.firstChild, 1);
|
||||
}
|
||||
} else if (test == "#prev2") {
|
||||
setupSelectionPrev3();
|
||||
sel.extend(e.firstChild, 14); // now eDirNext
|
||||
sel.extend(e.firstChild, 13); // now eDirPrevious again
|
||||
} else if (test == "#prev3") {
|
||||
setupSelectionPrev2();
|
||||
sel.extend(e.firstChild, 20);
|
||||
} else if (test == "#prev4") {
|
||||
setupSelectionPrev2();
|
||||
sel.extend(e.firstChild, 68); // now eDirNext
|
||||
sel.extend(e.firstChild, 67); // now eDirPrevious again
|
||||
} else if (test == "#prev5") {
|
||||
setupSelectionPrev1();
|
||||
sel.extend(e.firstChild, 80);
|
||||
} else if (test == "#prev6") {
|
||||
setupSelectionPrev1();
|
||||
sel.extend(e.firstChild, 153); // now eDirNext
|
||||
sel.extend(e.firstChild, 152); // now eDirPrevious again
|
||||
} else if (test == "#prev7") {
|
||||
if (op == "AD") {
|
||||
setupSelectionPrev3();
|
||||
addChildRanges([[0,168,0,170]], e);
|
||||
} else {
|
||||
addChildRanges([[0,160,0,170]], e);
|
||||
}
|
||||
} else if (test == "#prev8") {
|
||||
if (op == "AD") {
|
||||
addChildRanges([[0,150,0,155], [0,68,0,70]], e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (test == "#next1") {
|
||||
if (op == "SL") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 158);
|
||||
} else if (op == "SR") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 162);
|
||||
} else if (op == "AD") {
|
||||
setupSelectionNext3();
|
||||
addChildRanges([[0,1,0,2]], e);
|
||||
} else {
|
||||
setupSelectionNext1();
|
||||
sel.extend(e.firstChild, 1);
|
||||
}
|
||||
} else if (test == "#next2") {
|
||||
setupSelectionNext1();
|
||||
sel.extend(e.firstChild, 13);
|
||||
} else if (test == "#next3") {
|
||||
setupSelectionNext1();
|
||||
sel.extend(e.firstChild, 20);
|
||||
} else if (test == "#next4") {
|
||||
setupSelectionNext2();
|
||||
sel.extend(e.firstChild, 67);
|
||||
} else if (test == "#next5") {
|
||||
setupSelectionNext2();
|
||||
sel.extend(e.firstChild, 80);
|
||||
} else if (test == "#next6") {
|
||||
setupSelectionNext3();
|
||||
sel.extend(e.firstChild, 152);
|
||||
} else if (test == "#next7") {
|
||||
setupSelectionNext3();
|
||||
if (op == "AD") {
|
||||
addChildRanges([[0,168,0,170]], e);
|
||||
} else {
|
||||
sel.extend(e.firstChild, 170);
|
||||
}
|
||||
} else if (test == "#next8") {
|
||||
if (op == "AD") {
|
||||
addChildRanges([[0,68,0,70], [0,150,0,155]], e);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(function(){setTimeout(runTest,0)});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,229 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Testcase #1 for bug 1129078</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="selection-utils.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: Ahem;
|
||||
src: url("Ahem.ttf");
|
||||
}
|
||||
html,body { margin:0; padding: 0; }
|
||||
body,pre { font-family: Ahem; font-size: 20px; }
|
||||
span { -moz-user-select:none; }
|
||||
x { -moz-user-select:text; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="select">
|
||||
2af45494-a<x>k7e-1</x><span id="span2">1e4-a0c6-a7e7
|
||||
38222880-bj6d-11e4-8064-fb7b
|
||||
3d649ae</span><x>4-ci5</x><span id="span3">c-11e4-995d-17b2
|
||||
434351bc-dh4b-11e4-9971-4fc8
|
||||
4dc0e0b4-eg4a-11e4-8c28-5319
|
||||
a9631</span><x>9c8-ad7d-1</x>1e4-b312-039c
|
||||
</pre>
|
||||
|
||||
<pre id="log" style="border:1px solid green"></pre>
|
||||
|
||||
<script>
|
||||
window.info = parent.info;
|
||||
window.is = parent.is;
|
||||
window.isnot = parent.isnot;
|
||||
window.ok = parent.ok;
|
||||
|
||||
var sel = window.getSelection();
|
||||
|
||||
function enableSelection(id) {
|
||||
var span = document.getElementById(id);
|
||||
span.style.MozUserSelect = 'text';
|
||||
}
|
||||
|
||||
function setupPrevSelection() {
|
||||
var e = document.querySelector('#select');
|
||||
dragSelectPoints(e, 300, 125, 200, 5);
|
||||
}
|
||||
|
||||
function setupNextSelection() {
|
||||
var e = document.querySelector('#select');
|
||||
dragSelectPoints(e, 199, 5, 300, 125);
|
||||
}
|
||||
|
||||
var ops = {
|
||||
S_ : shiftClick,
|
||||
SA : shiftAccelClick,
|
||||
AD : accelDragSelect,
|
||||
SL : keyLeft,
|
||||
SR : keyRight
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
document.body.offsetHeight;
|
||||
var e = document.querySelector('#select');
|
||||
var hash = window.location.hash
|
||||
if (hash.substring(0,5)=="#prev")
|
||||
setupPrevSelection();
|
||||
else
|
||||
setupNextSelection();
|
||||
var op = hash.substring(6,8);
|
||||
var action = ops[op];
|
||||
var test = hash.substring(0,6);
|
||||
if (hash.substring(0,5) == "#prev") {
|
||||
if (test == "#prev1") {
|
||||
if (action == keyLeft) {
|
||||
keyLeft({shiftKey:true}, 2)
|
||||
checkRanges([[0,8,-1,2], [3,0,-1,4], [5,0,6,0]], e);
|
||||
} else if (action == keyRight) {
|
||||
keyRight({shiftKey:true}, 2)
|
||||
checkRanges([[e.childNodes[1].firstChild,2,-1,2], [3,0,-1,4], [5,0,6,0]], e);
|
||||
} else if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 30, 50);
|
||||
checkRanges([[0,1,0,2], [e.childNodes[1].firstChild,0,-1,2], [3,0,-1,4], [5,0,6,0]], e);
|
||||
} else {
|
||||
action(e, 30);
|
||||
checkRanges([[0,1,-1,2], [3,0,-1,4], [5,0,6,0]], e);
|
||||
}
|
||||
} else if (test == "#prev2") {
|
||||
action(e, 260);
|
||||
checkRangeCount(3, e);
|
||||
checkRange(0, [0,3,-2,2], e.childNodes[1]);
|
||||
checkRange(1, [3,0,-1,4], e);
|
||||
checkRange(2, [5,0,6,0], e);
|
||||
} else if (test == "#prev3") {
|
||||
enableSelection('span2');
|
||||
action(e, 400);
|
||||
checkRangeCount(2, e);
|
||||
checkRange(0, [0,5,-2,4], e.childNodes[2]);
|
||||
checkRange(1, [5,0,6,0], e);
|
||||
} else if (test == "#prev4") {
|
||||
action(e, 180, 65);
|
||||
checkRangeCount(2, e);
|
||||
checkRange(0, [0,2,-2,4], e.childNodes[3]);
|
||||
checkRange(1, [5,0,6,0], e);
|
||||
} else if (test == "#prev5") {
|
||||
enableSelection('span3');
|
||||
action(e, 440, 65);
|
||||
checkRangeCount(1, e);
|
||||
var r = sel.getRangeAt(0);
|
||||
checkRangePoints(r, [e.childNodes[4].firstChild,10,e.childNodes[6],0], e);
|
||||
} else if (test == "#prev6") {
|
||||
action(e, 140, 125);
|
||||
checkRangeCount(1, e);
|
||||
var r = sel.getRangeAt(0);
|
||||
checkRangePoints(r, [e.childNodes[5].firstChild,2,e.childNodes[6],0], e);
|
||||
} else if (test == "#prev7") {
|
||||
if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 460, 500, 125);
|
||||
checkRanges([[e.childNodes[1].firstChild,0,-1,2], [3,0,-1,4], [5,0,6,0], [6,8,6,10]], e);
|
||||
} else {
|
||||
action(e, 500, 125);
|
||||
checkRanges([[6,0,6,10]], e);
|
||||
}
|
||||
} else if (test == "#prev8") {
|
||||
if (action == accelDragSelect) {
|
||||
sel.removeAllRanges();
|
||||
var e = document.querySelector('#select');
|
||||
synthesizeMouse(e, 200, 125, {type: "mousedown", accelKey: true});
|
||||
synthesizeMouse(e, 200, 120, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 100, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 80, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 210, 60, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 60, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 60, {type: "mouseup", accelKey: true});
|
||||
var x3t = e.childNodes[3].firstChild;
|
||||
var x5 = e.childNodes[5];
|
||||
checkRanges([[x3t,3,-1,4], [x5,0,x5.firstChild,5]], e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (test == "#next1") {
|
||||
if (action == keyLeft) {
|
||||
keyLeft({shiftKey:true}, 2)
|
||||
checkRanges([[0,10,-1,2], [3,0,-1,4], [5,0,e.childNodes[5].firstChild,8]], e);
|
||||
} else if (action == keyRight) {
|
||||
keyRight({shiftKey:true}, 2)
|
||||
checkRanges([[0,10,-1,2], [3,0,-1,4], [5,0,6,2]], e);
|
||||
} else if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 30, 50);
|
||||
checkRanges([[0,1,0,2], [0,10,-1,2], [3,0,-1,4], [5,0,e.childNodes[5].firstChild,10]], e);
|
||||
} else {
|
||||
action(e, 30);
|
||||
checkRanges([[0,1,0,10]], e);
|
||||
}
|
||||
} else if (test == "#next2") {
|
||||
action(e, 260);
|
||||
checkRangeCount(1, e);
|
||||
var r = sel.getRangeAt(0);
|
||||
checkRangePoints(r, [e.childNodes[0],10,e.childNodes[1].firstChild,3], e);
|
||||
} else if (test == "#next3") {
|
||||
enableSelection('span2');
|
||||
action(e, 400);
|
||||
checkRangeCount(1, e);
|
||||
var r = sel.getRangeAt(0);
|
||||
checkRangePoints(r, [e.childNodes[0],10,e.childNodes[2].firstChild,5], e);
|
||||
} else if (test == "#next4") {
|
||||
action(e, 180, 65);
|
||||
checkRangeCount(2, e);
|
||||
checkRange(0, [0,10,-1,2], e);
|
||||
checkRange(1, [-1,0,0,2], e.childNodes[3]);
|
||||
} else if (test == "#next5") {
|
||||
enableSelection('span3');
|
||||
action(e, 440, 65);
|
||||
checkRangeCount(2, e);
|
||||
checkRange(0, [0,10,-1,2], e);
|
||||
var r = sel.getRangeAt(1);
|
||||
checkRangePoints(r, [e.childNodes[3],0,e.childNodes[4].firstChild,10], e);
|
||||
} else if (test == "#next6") {
|
||||
action(e, 140, 125);
|
||||
checkRangeCount(3, e);
|
||||
checkRange(0, [0,10,-1,2], e);
|
||||
checkRange(1, [3,0,-1,4], e);
|
||||
checkRange(2, [-1,0,0,2], e.childNodes[5]);
|
||||
} else if (test == "#next7") {
|
||||
if (action == keyRight) {
|
||||
keyRight({shiftKey:true}, 2)
|
||||
checkRanges([[0,10,-1,2], [3,0,-1,4], [5,0,6,2]], e);
|
||||
} else if (action == accelDragSelect) {
|
||||
accelDragSelect(e, 460, 500, 125);
|
||||
checkRanges([[0,10,-1,2], [3,0,-1,4], [5,0,e.childNodes[5].firstChild,10], [6,8,6,10]], e);
|
||||
} else {
|
||||
action(e, 500, 125);
|
||||
checkRangeCount(3, e);
|
||||
checkRange(0, [0,10,-1,2], e);
|
||||
checkRange(1, [3,0,-1,4], e);
|
||||
var r = sel.getRangeAt(2);
|
||||
checkRangePoints(r, [e.childNodes[5],0,e.childNodes[6],10], e);
|
||||
}
|
||||
} else if (test == "#next8") {
|
||||
if (action == accelDragSelect) {
|
||||
sel.removeAllRanges();
|
||||
var e = document.querySelector('#select');
|
||||
synthesizeMouse(e, 200, 60, {type: "mousedown", accelKey: true});
|
||||
synthesizeMouse(e, 180, 60, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 80, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 100, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 120, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 190, 125, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 125, {type: "mousemove", accelKey: true});
|
||||
synthesizeMouse(e, 200, 125, {type: "mouseup", accelKey: true});
|
||||
var x3t = e.childNodes[3].firstChild;
|
||||
var x5 = e.childNodes[5];
|
||||
checkRanges([[x3t,3,-1,4], [x5,0,x5.firstChild,5]], e);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(function(){setTimeout(runTest,0)});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,151 +0,0 @@
|
||||
// -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
// vim: set ts=2 sw=2 et tw=78:
|
||||
function clearSelection(w)
|
||||
{
|
||||
var sel = (w ? w : window).getSelection();
|
||||
sel.removeAllRanges();
|
||||
}
|
||||
|
||||
function getNode(e, index) {
|
||||
if (!(typeof index==='number')) return index;
|
||||
if (index >= 0) return e.childNodes[index];
|
||||
while (++index != 0) e = e.parentNode;
|
||||
return e;
|
||||
}
|
||||
|
||||
function dragSelectPointsWithData()
|
||||
{
|
||||
var event = arguments[0];
|
||||
var e = arguments[1];
|
||||
var x1 = arguments[2];
|
||||
var y1 = arguments[3];
|
||||
var x2 = arguments[4];
|
||||
var y2 = arguments[5];
|
||||
dir = x2 > x1 ? 1 : -1;
|
||||
event['type'] = "mousedown";
|
||||
synthesizeMouse(e, x1, y1, event);
|
||||
event['type'] = "mousemove";
|
||||
synthesizeMouse(e, x1 + dir, y1, event);
|
||||
for (var i = 6; i < arguments.length; ++i)
|
||||
synthesizeMouse(e, arguments[i], y1, event);
|
||||
synthesizeMouse(e, x2 - dir, y2, event);
|
||||
event['type'] = "mouseup";
|
||||
synthesizeMouse(e, x2, y2, event);
|
||||
}
|
||||
|
||||
function dragSelectPoints()
|
||||
{
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
dragSelectPointsWithData.apply(this, [{}].concat(args));
|
||||
}
|
||||
|
||||
function dragSelect()
|
||||
{
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var e = args.shift();
|
||||
var x1 = args.shift();
|
||||
var x2 = args.shift();
|
||||
dragSelectPointsWithData.apply(this, [{},e,x1,5,x2,5].concat(args));
|
||||
}
|
||||
|
||||
function accelDragSelect()
|
||||
{
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var e = args.shift();
|
||||
var x1 = args.shift();
|
||||
var x2 = args.shift();
|
||||
var y = args.length != 0 ? args.shift() : 5;
|
||||
dragSelectPointsWithData.apply(this, [{accelKey: true},e,x1,y,x2,y].concat(args));
|
||||
}
|
||||
|
||||
function shiftClick(e, x, y)
|
||||
{
|
||||
function pos(p) { return (typeof p === "undefined") ? 5 : p }
|
||||
synthesizeMouse(e, pos(x), pos(y), { shiftKey: true });
|
||||
}
|
||||
|
||||
function keyRepeat(key,data,repeat)
|
||||
{
|
||||
while (repeat-- > 0)
|
||||
synthesizeKey(key, data);
|
||||
}
|
||||
|
||||
function keyRight(data)
|
||||
{
|
||||
var repeat = arguments.length > 1 ? arguments[1] : 1;
|
||||
keyRepeat("VK_RIGHT", data, repeat);
|
||||
}
|
||||
|
||||
function keyLeft(data)
|
||||
{
|
||||
var repeat = arguments.length > 1 ? arguments[1] : 1;
|
||||
keyRepeat("VK_LEFT", data, repeat);
|
||||
}
|
||||
|
||||
function shiftAccelClick(e, x, y)
|
||||
{
|
||||
function pos(p) { return (typeof p === "undefined") ? 5 : p }
|
||||
synthesizeMouse(e, pos(x), pos(y), { shiftKey: true, accelKey: true });
|
||||
}
|
||||
|
||||
function accelClick(e, x, y)
|
||||
{
|
||||
function pos(p) { return (typeof p === "undefined") ? 5 : p }
|
||||
synthesizeMouse(e, pos(x), pos(y), { accelKey: true });
|
||||
}
|
||||
|
||||
function addChildRanges(arr, e)
|
||||
{
|
||||
var sel = window.getSelection();
|
||||
for (i = 0; i < arr.length; ++i) {
|
||||
var data = arr[i];
|
||||
var r = new Range()
|
||||
r.setStart(getNode(e, data[0]), data[1]);
|
||||
r.setEnd(getNode(e, data[2]), data[3]);
|
||||
sel.addRange(r);
|
||||
}
|
||||
}
|
||||
|
||||
function checkText(text, e)
|
||||
{
|
||||
var sel = window.getSelection();
|
||||
is(sel.toString(), text, e.id + ": selected text")
|
||||
}
|
||||
|
||||
function checkRangeText(text, index)
|
||||
{
|
||||
var r = window.getSelection().getRangeAt(index);
|
||||
is(r.toString(), text, e.id + ": range["+index+"].toString()")
|
||||
}
|
||||
|
||||
function checkRangeCount(n, e)
|
||||
{
|
||||
var sel = window.getSelection();
|
||||
is(sel.rangeCount, n, e.id + ": Selection range count");
|
||||
}
|
||||
|
||||
function checkRangePoints(r, expected, e) {
|
||||
is(r.startContainer, expected[0], e.id + ": range.startContainer");
|
||||
is(r.startOffset, expected[1], e.id + ": range.startOffset");
|
||||
is(r.endContainer, expected[2], e.id + ": range.endContainer");
|
||||
is(r.endOffset, expected[3], e.id + ": range.endOffset");
|
||||
}
|
||||
|
||||
function checkRange(i, expected, e) {
|
||||
var sel = window.getSelection();
|
||||
if (i >= sel.rangeCount) return;
|
||||
var r = sel.getRangeAt(i);
|
||||
is(r.startContainer, getNode(e, expected[0]), e.id + ": range["+i+"].startContainer");
|
||||
is(r.startOffset, expected[1], e.id + ": range["+i+"].startOffset");
|
||||
is(r.endContainer, getNode(e, expected[2]), e.id + ": range["+i+"].endContainer");
|
||||
is(r.endOffset, expected[3], e.id + ": range["+i+"].endOffset");
|
||||
}
|
||||
|
||||
function checkRanges(arr, e)
|
||||
{
|
||||
checkRangeCount(arr.length, e);
|
||||
for (i = 0; i < arr.length; ++i) {
|
||||
var expected = arr[i];
|
||||
checkRange(i, expected, e);
|
||||
}
|
||||
}
|
@ -8,9 +8,8 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
iframe {
|
||||
border: none;
|
||||
width: 600px;
|
||||
height: 400px;
|
||||
height: 600px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
@ -93,8 +92,6 @@ function refTest(test,ref) {
|
||||
|
||||
var caretBlinkTime = null;
|
||||
function endTest() {
|
||||
var parentDoc = window.parent.document;
|
||||
parentDoc.styleSheets[parentDoc.styleSheets.length-1].deleteRule(0);
|
||||
// finish(), yet let the test actually end first, to be safe.
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
}
|
||||
@ -171,107 +168,6 @@ if (navigator.appVersion.indexOf("Android") == -1 &&
|
||||
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed");
|
||||
}
|
||||
|
||||
if ((navigator.platform.indexOf("Mac") >= 0 ||
|
||||
navigator.platform.indexOf("Linux") >= 0) &&
|
||||
SpecialPowers.Services.appinfo.name != "B2G") {
|
||||
tests = tests.concat([
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} ,
|
||||
// eDirPrevious, Shift+click
|
||||
[ 'multi-range-user-select.html#prev1S_' , 'multi-range-user-select-ref.html#prev1S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev2S_' , 'multi-range-user-select-ref.html#prev2S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev3S_' , 'multi-range-user-select-ref.html#prev3S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev4S_' , 'multi-range-user-select-ref.html#prev4S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev5S_' , 'multi-range-user-select-ref.html#prev5S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev6S_' , 'multi-range-user-select-ref.html#prev6S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev7S_' , 'multi-range-user-select-ref.html#prev7S_' ] ,
|
||||
// eDirPrevious, Shift+Accel+click
|
||||
[ 'multi-range-user-select.html#prev1SA' , 'multi-range-user-select-ref.html#prev1SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev2SA' , 'multi-range-user-select-ref.html#prev2SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev3SA' , 'multi-range-user-select-ref.html#prev3SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev4SA' , 'multi-range-user-select-ref.html#prev4SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev5SA' , 'multi-range-user-select-ref.html#prev5SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev6SA' , 'multi-range-user-select-ref.html#prev6SA' ] ,
|
||||
[ 'multi-range-user-select.html#prev7SA' , 'multi-range-user-select-ref.html#prev7SA' ] ,
|
||||
// eDirPrevious, Accel+drag-select (adding an additional range)
|
||||
[ 'multi-range-user-select.html#prev1AD' , 'multi-range-user-select-ref.html#prev1AD' ] ,
|
||||
[ 'multi-range-user-select.html#prev7AD' , 'multi-range-user-select-ref.html#prev7AD' ] ,
|
||||
// eDirPrevious, Accel+drag-select (bug 1128722)
|
||||
[ 'multi-range-user-select.html#prev8AD' , 'multi-range-user-select-ref.html#prev8AD' ] ,
|
||||
// eDirPrevious, VK_RIGHT / LEFT
|
||||
[ 'multi-range-user-select.html#prev1SR' , 'multi-range-user-select-ref.html#prev1SR' ] ,
|
||||
[ 'multi-range-user-select.html#prev1SL' , 'multi-range-user-select-ref.html#prev1SL' ] ,
|
||||
// eDirNext, Shift+click
|
||||
[ 'multi-range-user-select.html#next1S_' , 'multi-range-user-select-ref.html#next1S_' ] ,
|
||||
[ 'multi-range-user-select.html#next2S_' , 'multi-range-user-select-ref.html#next2S_' ] ,
|
||||
[ 'multi-range-user-select.html#next3S_' , 'multi-range-user-select-ref.html#next3S_' ] ,
|
||||
[ 'multi-range-user-select.html#next4S_' , 'multi-range-user-select-ref.html#next4S_' ] ,
|
||||
[ 'multi-range-user-select.html#next5S_' , 'multi-range-user-select-ref.html#next5S_' ] ,
|
||||
[ 'multi-range-user-select.html#next6S_' , 'multi-range-user-select-ref.html#next6S_' ] ,
|
||||
[ 'multi-range-user-select.html#next7S_' , 'multi-range-user-select-ref.html#next7S_' ] ,
|
||||
// eDirNext, Shift+Accel+click
|
||||
[ 'multi-range-user-select.html#next1SA' , 'multi-range-user-select-ref.html#next1SA' ] ,
|
||||
[ 'multi-range-user-select.html#next2SA' , 'multi-range-user-select-ref.html#next2SA' ] ,
|
||||
[ 'multi-range-user-select.html#next3SA' , 'multi-range-user-select-ref.html#next3SA' ] ,
|
||||
[ 'multi-range-user-select.html#next4SA' , 'multi-range-user-select-ref.html#next4SA' ] ,
|
||||
[ 'multi-range-user-select.html#next5SA' , 'multi-range-user-select-ref.html#next5SA' ] ,
|
||||
[ 'multi-range-user-select.html#next6SA' , 'multi-range-user-select-ref.html#next6SA' ] ,
|
||||
[ 'multi-range-user-select.html#next7SA' , 'multi-range-user-select-ref.html#next7SA' ] ,
|
||||
// eDirNext, Accel+drag-select (adding an additional range)
|
||||
[ 'multi-range-user-select.html#next1AD' , 'multi-range-user-select-ref.html#next1AD' ] ,
|
||||
[ 'multi-range-user-select.html#next7AD' , 'multi-range-user-select-ref.html#next7AD' ] ,
|
||||
// eDirNext, Accel+drag-select (bug 1128722)
|
||||
[ 'multi-range-user-select.html#next8AD' , 'multi-range-user-select-ref.html#next8AD' ] ,
|
||||
// eDirNext, VK_RIGHT / LEFT
|
||||
[ 'multi-range-user-select.html#next1SR' , 'multi-range-user-select-ref.html#next1SR' ] ,
|
||||
[ 'multi-range-user-select.html#next1SL' , 'multi-range-user-select-ref.html#next1SL' ] ,
|
||||
// eDirPrevious, Shift+click
|
||||
[ 'multi-range-script-select.html#prev1S_' , 'multi-range-script-select-ref.html#prev1S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev2S_' , 'multi-range-script-select-ref.html#prev2S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev3S_' , 'multi-range-script-select-ref.html#prev3S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev4S_' , 'multi-range-script-select-ref.html#prev4S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev5S_' , 'multi-range-script-select-ref.html#prev5S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev6S_' , 'multi-range-script-select-ref.html#prev6S_' ] ,
|
||||
[ 'multi-range-script-select.html#prev7S_' , 'multi-range-script-select-ref.html#prev7S_' ] ,
|
||||
// eDirPrevious, Shift+Accel+click
|
||||
[ 'multi-range-script-select.html#prev1SA' , 'multi-range-script-select-ref.html#prev1SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev2SA' , 'multi-range-script-select-ref.html#prev2SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev3SA' , 'multi-range-script-select-ref.html#prev3SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev4SA' , 'multi-range-script-select-ref.html#prev4SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev5SA' , 'multi-range-script-select-ref.html#prev5SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev6SA' , 'multi-range-script-select-ref.html#prev6SA' ] ,
|
||||
[ 'multi-range-script-select.html#prev7SA' , 'multi-range-script-select-ref.html#prev7SA' ] ,
|
||||
// eDirPrevious, Accel+drag-select (adding an additional range)
|
||||
[ 'multi-range-script-select.html#prev1AD' , 'multi-range-script-select-ref.html#prev1AD' ] ,
|
||||
[ 'multi-range-script-select.html#prev7AD' , 'multi-range-script-select-ref.html#prev7AD' ] ,
|
||||
// eDirPrevious, VK_RIGHT / LEFT
|
||||
[ 'multi-range-script-select.html#prev1SR' , 'multi-range-script-select-ref.html#prev1SR' ] ,
|
||||
[ 'multi-range-script-select.html#prev1SL' , 'multi-range-script-select-ref.html#prev1SL' ] ,
|
||||
// eDirNext, Shift+click
|
||||
[ 'multi-range-script-select.html#next1S_' , 'multi-range-script-select-ref.html#next1S_' ] ,
|
||||
[ 'multi-range-script-select.html#next2S_' , 'multi-range-script-select-ref.html#next2S_' ] ,
|
||||
[ 'multi-range-script-select.html#next3S_' , 'multi-range-script-select-ref.html#next3S_' ] ,
|
||||
[ 'multi-range-script-select.html#next4S_' , 'multi-range-script-select-ref.html#next4S_' ] ,
|
||||
[ 'multi-range-script-select.html#next5S_' , 'multi-range-script-select-ref.html#next5S_' ] ,
|
||||
[ 'multi-range-script-select.html#next6S_' , 'multi-range-script-select-ref.html#next6S_' ] ,
|
||||
[ 'multi-range-script-select.html#next7S_' , 'multi-range-script-select-ref.html#next7S_' ] ,
|
||||
// eDirNext, Shift+Accel+click
|
||||
[ 'multi-range-script-select.html#next1SA' , 'multi-range-script-select-ref.html#next1SA' ] ,
|
||||
[ 'multi-range-script-select.html#next2SA' , 'multi-range-script-select-ref.html#next2SA' ] ,
|
||||
[ 'multi-range-script-select.html#next3SA' , 'multi-range-script-select-ref.html#next3SA' ] ,
|
||||
[ 'multi-range-script-select.html#next4SA' , 'multi-range-script-select-ref.html#next4SA' ] ,
|
||||
[ 'multi-range-script-select.html#next5SA' , 'multi-range-script-select-ref.html#next5SA' ] ,
|
||||
[ 'multi-range-script-select.html#next6SA' , 'multi-range-script-select-ref.html#next6SA' ] ,
|
||||
[ 'multi-range-script-select.html#next7SA' , 'multi-range-script-select-ref.html#next7SA' ] ,
|
||||
// eDirNext, Accel+drag-select (adding an additional range)
|
||||
[ 'multi-range-script-select.html#next1AD' , 'multi-range-script-select-ref.html#next1AD' ] ,
|
||||
[ 'multi-range-script-select.html#next7AD' , 'multi-range-script-select-ref.html#next7AD' ] ,
|
||||
// eDirNext, VK_RIGHT / LEFT
|
||||
[ 'multi-range-script-select.html#next1SR' , 'multi-range-script-select-ref.html#next1SR' ] ,
|
||||
[ 'multi-range-script-select.html#next1SL' , 'multi-range-script-select-ref.html#next1SL' ] ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} ,
|
||||
]);
|
||||
}
|
||||
|
||||
var testIndex = 0;
|
||||
|
||||
function nextTest() {
|
||||
@ -288,11 +184,6 @@ function nextTest() {
|
||||
}
|
||||
function runTests() {
|
||||
try {
|
||||
if (window.parent) {
|
||||
var parentDoc = window.parent.document;
|
||||
extraCSSRule = parentDoc.styleSheets[parentDoc.styleSheets.length-1]
|
||||
.insertRule("iframe#testframe{width:600px;height:400px}",0);
|
||||
}
|
||||
try {
|
||||
caretBlinkTime = SpecialPowers.getIntPref("ui.caretBlinkTime");
|
||||
} catch (e) {}
|
||||
|
@ -27,7 +27,6 @@ struct SelectionDetails;
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
struct AutoPrepareFocusRange;
|
||||
}
|
||||
|
||||
struct RangeData
|
||||
@ -227,7 +226,7 @@ public:
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
private:
|
||||
friend struct mozilla::AutoPrepareFocusRange;
|
||||
|
||||
class ScrollSelectionIntoViewEvent;
|
||||
friend class ScrollSelectionIntoViewEvent;
|
||||
|
||||
|
@ -642,7 +642,6 @@ private:
|
||||
}
|
||||
|
||||
friend class mozilla::dom::Selection;
|
||||
friend struct mozilla::AutoPrepareFocusRange;
|
||||
#ifdef DEBUG
|
||||
void printSelection(); // for debugging
|
||||
#endif /* DEBUG */
|
||||
|
@ -326,101 +326,6 @@ IsValidSelectionPoint(nsFrameSelection *aFrameSel, nsINode *aNode)
|
||||
return !limiter || nsContentUtils::ContentIsDescendantOf(aNode, limiter);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
struct MOZ_STACK_CLASS AutoPrepareFocusRange
|
||||
{
|
||||
AutoPrepareFocusRange(Selection* aSelection,
|
||||
bool aContinueSelection,
|
||||
bool aMultipleSelection
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
if (aSelection->mRanges.Length() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aSelection->mFrameSelection->IsUserSelectionReason()) {
|
||||
mUserSelect.emplace(aSelection);
|
||||
}
|
||||
bool userSelection = aSelection->mApplyUserSelectStyle;
|
||||
|
||||
nsTArray<RangeData>& ranges = aSelection->mRanges;
|
||||
if (!userSelection ||
|
||||
(!aContinueSelection && aMultipleSelection)) {
|
||||
// Scripted command or the user is starting a new explicit multi-range
|
||||
// selection.
|
||||
for (RangeData& entry : ranges) {
|
||||
entry.mRange->SetIsGenerated(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t reason = aSelection->mFrameSelection->mSelectionChangeReason;
|
||||
bool isAnchorRelativeOp = (reason & (nsISelectionListener::DRAG_REASON |
|
||||
nsISelectionListener::MOUSEDOWN_REASON |
|
||||
nsISelectionListener::MOUSEUP_REASON |
|
||||
nsISelectionListener::COLLAPSETOSTART_REASON));
|
||||
if (!isAnchorRelativeOp) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This operation is against the anchor but our current mAnchorFocusRange
|
||||
// represents the focus in a multi-range selection. The anchor from a user
|
||||
// perspective is the most distant generated range on the opposite side.
|
||||
// Find that range and make it the mAnchorFocusRange.
|
||||
const size_t len = ranges.Length();
|
||||
size_t newAnchorFocusIndex = size_t(-1);
|
||||
if (aSelection->GetDirection() == eDirNext) {
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
if (ranges[i].mRange->IsGenerated()) {
|
||||
newAnchorFocusIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
size_t i = len;
|
||||
while (i--) {
|
||||
if (ranges[i].mRange->IsGenerated()) {
|
||||
newAnchorFocusIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newAnchorFocusIndex == size_t(-1)) {
|
||||
// There are no generated ranges - that's fine.
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup the new mAnchorFocusRange and mark the old one as generated.
|
||||
if (aSelection->mAnchorFocusRange) {
|
||||
aSelection->mAnchorFocusRange->SetIsGenerated(true);
|
||||
}
|
||||
nsRange* range = ranges[newAnchorFocusIndex].mRange;
|
||||
range->SetIsGenerated(false);
|
||||
aSelection->mAnchorFocusRange = range;
|
||||
|
||||
// Remove all generated ranges (including the old mAnchorFocusRange).
|
||||
nsRefPtr<nsPresContext> presContext = aSelection->GetPresContext();
|
||||
size_t i = len;
|
||||
while (i--) {
|
||||
range = aSelection->mRanges[i].mRange;
|
||||
if (range->IsGenerated()) {
|
||||
range->SetInSelection(false);
|
||||
aSelection->selectFrames(presContext, range, false);
|
||||
aSelection->mRanges.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
if (aSelection->mFrameSelection) {
|
||||
aSelection->mFrameSelection->InvalidateDesiredPos();
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<Selection::AutoApplyUserSelectStyle> mUserSelect;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
}
|
||||
|
||||
////////////BEGIN nsFrameSelection methods
|
||||
|
||||
@ -869,6 +774,13 @@ nsFrameSelection::MoveCaret(nsDirection aDirection,
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
if (aAmount == eSelectLine) {
|
||||
result = FetchDesiredPos(desiredPos);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
SetDesiredPos(desiredPos);
|
||||
}
|
||||
|
||||
int32_t caretStyle = Preferences::GetInt("layout.selection.caret_style", 0);
|
||||
if (caretStyle == 0
|
||||
@ -880,48 +792,39 @@ nsFrameSelection::MoveCaret(nsDirection aDirection,
|
||||
caretStyle = 2;
|
||||
}
|
||||
|
||||
bool doCollapse = !isCollapsed && !aContinueSelection && caretStyle == 2 &&
|
||||
aAmount <= eSelectLine;
|
||||
if (doCollapse) {
|
||||
if (aDirection == eDirPrevious) {
|
||||
PostReason(nsISelectionListener::COLLAPSETOSTART_REASON);
|
||||
mHint = CARET_ASSOCIATE_AFTER;
|
||||
} else {
|
||||
PostReason(nsISelectionListener::COLLAPSETOEND_REASON);
|
||||
mHint = CARET_ASSOCIATE_BEFORE;
|
||||
}
|
||||
} else {
|
||||
PostReason(nsISelectionListener::KEYPRESS_REASON);
|
||||
}
|
||||
if (!isCollapsed && !aContinueSelection && caretStyle == 2 &&
|
||||
aAmount <= eSelectLine) {
|
||||
switch (aDirection) {
|
||||
case eDirPrevious:
|
||||
{
|
||||
const nsRange* anchorFocusRange = sel->GetAnchorFocusRange();
|
||||
if (anchorFocusRange) {
|
||||
PostReason(nsISelectionListener::COLLAPSETOSTART_REASON);
|
||||
sel->Collapse(anchorFocusRange->GetStartParent(),
|
||||
anchorFocusRange->StartOffset());
|
||||
}
|
||||
mHint = CARET_ASSOCIATE_AFTER;
|
||||
sel->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION,
|
||||
nsIPresShell::ScrollAxis(),
|
||||
nsIPresShell::ScrollAxis(), scrollFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
AutoPrepareFocusRange prep(sel, aContinueSelection, false);
|
||||
|
||||
if (aAmount == eSelectLine) {
|
||||
result = FetchDesiredPos(desiredPos);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
case eDirNext:
|
||||
{
|
||||
const nsRange* anchorFocusRange = sel->GetAnchorFocusRange();
|
||||
if (anchorFocusRange) {
|
||||
PostReason(nsISelectionListener::COLLAPSETOEND_REASON);
|
||||
sel->Collapse(anchorFocusRange->GetEndParent(),
|
||||
anchorFocusRange->EndOffset());
|
||||
}
|
||||
mHint = CARET_ASSOCIATE_BEFORE;
|
||||
sel->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION,
|
||||
nsIPresShell::ScrollAxis(),
|
||||
nsIPresShell::ScrollAxis(), scrollFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
SetDesiredPos(desiredPos);
|
||||
}
|
||||
|
||||
if (doCollapse) {
|
||||
const nsRange* anchorFocusRange = sel->GetAnchorFocusRange();
|
||||
if (anchorFocusRange) {
|
||||
nsINode* node;
|
||||
int32_t offset;
|
||||
if (aDirection == eDirPrevious) {
|
||||
node = anchorFocusRange->GetStartParent();
|
||||
offset = anchorFocusRange->StartOffset();
|
||||
} else {
|
||||
node = anchorFocusRange->GetEndParent();
|
||||
offset = anchorFocusRange->EndOffset();
|
||||
}
|
||||
sel->Collapse(node, offset);
|
||||
}
|
||||
sel->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION,
|
||||
nsIPresShell::ScrollAxis(),
|
||||
nsIPresShell::ScrollAxis(), scrollFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame *frame;
|
||||
@ -965,7 +868,7 @@ nsFrameSelection::MoveCaret(nsDirection aDirection,
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PostReason(nsISelectionListener::KEYPRESS_REASON);
|
||||
if (NS_SUCCEEDED(result = frame->PeekOffset(&pos)) && pos.mResultContent)
|
||||
{
|
||||
nsIFrame *theFrame;
|
||||
@ -1473,8 +1376,6 @@ nsFrameSelection::HandleClick(nsIContent* aNewFocus,
|
||||
AdjustForMaintainedSelection(aNewFocus, aContentOffset))
|
||||
return NS_OK; //shift clicked to maintained selection. rejected.
|
||||
|
||||
int8_t index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
|
||||
AutoPrepareFocusRange prep(mDomSelections[index], aContinueSelection, aMultipleSelection);
|
||||
return TakeFocus(aNewFocus, aContentOffset, aContentEndOffset, aHint,
|
||||
aContinueSelection, aMultipleSelection);
|
||||
}
|
||||
@ -2149,8 +2050,6 @@ nsFrameSelection::SelectAll()
|
||||
}
|
||||
int32_t numChildren = rootContent->GetChildCount();
|
||||
PostReason(nsISelectionListener::NO_REASON);
|
||||
int8_t index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
|
||||
AutoPrepareFocusRange prep(mDomSelections[index], false, false);
|
||||
return TakeFocus(rootContent, 0, numChildren, CARET_ASSOCIATE_BEFORE, false, false);
|
||||
}
|
||||
|
||||
@ -3613,19 +3512,9 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex)
|
||||
rangesToAdd.AppendElement(aItem);
|
||||
}
|
||||
}
|
||||
*aOutIndex = -1;
|
||||
size_t newAnchorFocusIndex =
|
||||
GetDirection() == eDirPrevious ? 0 : rangesToAdd.Length() - 1;
|
||||
for (size_t i = 0; i < rangesToAdd.Length(); ++i) {
|
||||
int32_t index;
|
||||
nsresult rv = AddItemInternal(rangesToAdd[i], &index);
|
||||
nsresult rv = AddItemInternal(rangesToAdd[i], aOutIndex);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (i == newAnchorFocusIndex) {
|
||||
*aOutIndex = index;
|
||||
rangesToAdd[i]->SetIsGenerated(false);
|
||||
} else {
|
||||
rangesToAdd[i]->SetIsGenerated(true);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -5111,9 +5000,49 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SELECTION
|
||||
nsDirection oldDirection = GetDirection();
|
||||
#endif
|
||||
nsDirection dir = GetDirection();
|
||||
|
||||
// If aParentNode is inside a range in a multi-range selection we need
|
||||
// to remove the ranges that follows in the selection direction and
|
||||
// make that range the mAnchorFocusRange.
|
||||
if (mRanges.Length() > 1) {
|
||||
for (size_t i = 0; i < mRanges.Length(); ++i) {
|
||||
nsRange* range = mRanges[i].mRange;
|
||||
bool disconnected1 = false;
|
||||
bool disconnected2 = false;
|
||||
const bool isBeforeStart =
|
||||
nsContentUtils::ComparePoints(range->GetStartParent(),
|
||||
range->StartOffset(),
|
||||
&aParentNode, aOffset,
|
||||
&disconnected1) > 0;
|
||||
const bool isAfterEnd =
|
||||
nsContentUtils::ComparePoints(range->GetEndParent(),
|
||||
range->EndOffset(),
|
||||
&aParentNode, aOffset,
|
||||
&disconnected2) < 0;
|
||||
if (!isBeforeStart && !isAfterEnd && !disconnected1 && !disconnected2) {
|
||||
// aParentNode/aOffset is inside 'range'.
|
||||
mAnchorFocusRange = range;
|
||||
if (dir == eDirNext) {
|
||||
for (size_t j = i + 1; j < mRanges.Length(); ++j) {
|
||||
nsRange* r = mRanges[j].mRange;
|
||||
r->SetInSelection(false);
|
||||
selectFrames(presContext, r, false);
|
||||
}
|
||||
mRanges.TruncateLength(i + 1);
|
||||
} else {
|
||||
for (size_t j = 0; j < i; ++j) {
|
||||
nsRange* r = mRanges[j].mRange;
|
||||
r->SetInSelection(false);
|
||||
selectFrames(presContext, r, false);
|
||||
}
|
||||
mRanges.RemoveElementsAt(0, i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsINode* anchorNode = GetAnchorNode();
|
||||
nsINode* focusNode = GetFocusNode();
|
||||
uint32_t anchorOffset = AnchorOffset();
|
||||
@ -5165,7 +5094,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
SetDirection(eDirNext);
|
||||
dir = eDirNext;
|
||||
res = difRange->SetEnd(range->GetEndParent(), range->EndOffset());
|
||||
nsresult tmp = difRange->SetStart(focusNode, focusOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
@ -5184,7 +5113,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
}
|
||||
else if (result1 == 0 && result3 > 0){//2, a1
|
||||
//select from 2 to 1a
|
||||
SetDirection(eDirPrevious);
|
||||
dir = eDirPrevious;
|
||||
range->SetStart(aParentNode, aOffset, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
@ -5229,7 +5158,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
return;
|
||||
}
|
||||
}
|
||||
SetDirection(eDirNext);
|
||||
dir = eDirNext;
|
||||
range->SetEnd(aParentNode, aOffset, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
@ -5274,7 +5203,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
aRv.Throw(res);
|
||||
return;
|
||||
}
|
||||
SetDirection(eDirPrevious);
|
||||
dir = eDirPrevious;
|
||||
range->SetStart(aParentNode, aOffset, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
@ -5293,7 +5222,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
if (GetDirection() == eDirNext){
|
||||
range->SetEnd(startNode, startOffset);
|
||||
}
|
||||
SetDirection(eDirPrevious);
|
||||
dir = eDirPrevious;
|
||||
range->SetStart(aParentNode, aOffset, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
@ -5332,7 +5261,7 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
SetDirection(eDirPrevious);
|
||||
dir = eDirPrevious;
|
||||
res = difRange->SetEnd(focusNode, focusOffset);
|
||||
nsresult tmp = difRange->SetStart(range->GetStartParent(), range->StartOffset());
|
||||
if (NS_FAILED(tmp)) {
|
||||
@ -5361,11 +5290,15 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
|
||||
DEBUG_OUT_RANGE(range);
|
||||
#ifdef DEBUG_SELECTION
|
||||
if (GetDirection() != oldDirection) {
|
||||
printf(" direction changed to %s\n",
|
||||
GetDirection() == eDirNext? "eDirNext":"eDirPrevious");
|
||||
}
|
||||
if (eDirNext == mDirection)
|
||||
printf(" direction = 1 LEFT TO RIGHT\n");
|
||||
else
|
||||
printf(" direction = 0 RIGHT TO LEFT\n");
|
||||
#endif
|
||||
SetDirection(dir);
|
||||
#ifdef DEBUG_SELECTION
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(&aParentNode);
|
||||
|
||||
printf ("Sel. Extend to %p %s %d\n", content.get(),
|
||||
nsAtomCString(content->Tag()).get(), aOffset);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user