зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1319660) for causing bug 1329446.
Backed out changeset d506d3c193c9 (bug 1319660) Backed out changeset 93353b53a706 (bug 1319660) Backed out changeset 9a7c2edd54b8 (bug 1319660) --HG-- extra : rebase_source : 43ad1287462697f2312aa18925a462eb85c52495
This commit is contained in:
Родитель
c0992b79c3
Коммит
9e4ddf00bd
|
@ -374,8 +374,8 @@ nsContentIterator::Init(nsIDOMRange* aDOMRange)
|
|||
// So, we shouldn't skip the empty node if the start offset is 0.
|
||||
// In other words, if the offset is 1, the node should be ignored.
|
||||
if (!startIsData && startIndx) {
|
||||
mFirst = NextNode(startNode);
|
||||
NS_WARNING_ASSERTION(mFirst, "NextNode returned null");
|
||||
mFirst = GetNextSibling(startNode);
|
||||
NS_WARNING_ASSERTION(mFirst, "GetNextSibling returned null");
|
||||
|
||||
// Does mFirst node really intersect the range? The range could be
|
||||
// 'degenerate', i.e., not collapsed but still contain no content.
|
||||
|
@ -430,8 +430,8 @@ nsContentIterator::Init(nsIDOMRange* aDOMRange)
|
|||
// the last element should be the previous node (i.e., shouldn't
|
||||
// include the end node in the range).
|
||||
if (!endIsData && !endNode->HasChildren() && !endIndx) {
|
||||
mLast = PrevNode(endNode);
|
||||
NS_WARNING_ASSERTION(mLast, "PrevNode returned null");
|
||||
mLast = GetPrevSibling(endNode);
|
||||
NS_WARNING_ASSERTION(mLast, "GetPrevSibling returned null");
|
||||
if (NS_WARN_IF(!NodeIsInTraversalRange(mLast, mPre,
|
||||
startNode, startIndx,
|
||||
endNode, endIndx))) {
|
||||
|
|
|
@ -1230,9 +1230,8 @@ final class GeckoEditable extends JNIObject
|
|||
// with Gecko here.
|
||||
mIgnoreSelectionChange = false;
|
||||
|
||||
} else if (indexInText == 0 && text.length() == action.mSequence.length() &&
|
||||
oldEnd - start == action.mEnd - action.mStart) {
|
||||
// The new change exactly matches our saved change, so do a direct replace.
|
||||
} else if (indexInText == 0 && text.length() == action.mSequence.length()) {
|
||||
// The new text exactly matches our sequence, so do a direct replace.
|
||||
mText.currentReplace(start, oldEnd, action.mSequence);
|
||||
|
||||
// Ignore the next selection change because the selection change is a
|
||||
|
|
|
@ -4020,39 +4020,14 @@ function runSetSelectionEventTest()
|
|||
contenteditable.innerHTML = "a<blink>b</blink>c";
|
||||
synthesizeSelectionSet(0, 3);
|
||||
is(selection.anchorNode, contenteditable.firstChild,
|
||||
"runSetSelectionEventTest #16 (0, 3), \"" + contenteditable.innerHTML + "\": selection anchor node should be the first text node");
|
||||
"runSetSelectionEventTest #15 (0, 0), \"" + contenteditable.innerHTML + "\": selection anchor node should be the first text node");
|
||||
is(selection.anchorOffset, 0,
|
||||
"runSetSelectionEventTest #16 (0, 3), \"" + contenteditable.innerHTML + "\": selection anchor offset should be 0");
|
||||
"runSetSelectionEventTest #15 (0, 0), \"" + contenteditable.innerHTML + "\": selection anchor offset should be 0");
|
||||
is(selection.focusNode, contenteditable.lastChild,
|
||||
"runSetSelectionEventTest #16 (0, 3), \"" + contenteditable.innerHTML + "\": selection focus node should be the last text node");
|
||||
"runSetSelectionEventTest #15 (0, 0), \"" + contenteditable.innerHTML + "\": selection focus node should be the last text node");
|
||||
is(selection.focusOffset, contenteditable.lastChild.wholeText.length,
|
||||
"runSetSelectionEventTest #16 (0, 3), \"" + contenteditable.innerHTML + "\": selection focus offset should be the length of the last text node");
|
||||
"runSetSelectionEventTest #15 (0, 0), \"" + contenteditable.innerHTML + "\": selection focus offset should be the length of the last text node");
|
||||
checkSelection(0, "abc", "runSetSelectionEventTest #16 (0, 3), \"" + contenteditable.innerHTML + "\"");
|
||||
|
||||
// #17 (bug 1319660 - incorrect adjustment of content iterator last node)
|
||||
contenteditable.innerHTML = "<div>a</div><div><br></div>";
|
||||
|
||||
synthesizeSelectionSet(kLFLen, 1+kLFLen);
|
||||
is(selection.anchorNode, contenteditable.firstChild,
|
||||
"runSetSelectionEventTest #17 (kLFLen, 1+kLFLen), \"" + contenteditable.innerHTML + "\": selection anchor node should be the first <div> element");
|
||||
is(selection.anchorOffset, 0,
|
||||
"runSetSelectionEventTest #17 (kLFLen, 1+kLFLen), \"" + contenteditable.innerHTML + "\": selection anchor offset should be 0");
|
||||
is(selection.focusNode, contenteditable.lastChild,
|
||||
"runSetSelectionEventTest #17 (kLFLen, 1+kLFLen), \"" + contenteditable.innerHTML + "\": selection focus node should be the second <div> element");
|
||||
is(selection.focusOffset, 0,
|
||||
"runSetSelectionEventTest #17 (kLFLen, 1+kLFLen), \"" + contenteditable.innerHTML + "\": selection focus offset should be the length of the last text node");
|
||||
checkSelection(kLFLen, "a" + kLF, "runSetSelectionEventTest #17 (kLFLen, 1+kLFLen), \"" + contenteditable.innerHTML + "\"");
|
||||
|
||||
synthesizeSelectionSet(1+2*kLFLen, 0);
|
||||
is(selection.anchorNode, contenteditable.lastChild,
|
||||
"runSetSelectionEventTest #17 (1+2*kLFLen, 0), \"" + contenteditable.innerHTML + "\": selection anchor node should be the second <div> element");
|
||||
is(selection.anchorOffset, 0,
|
||||
"runSetSelectionEventTest #17 (1+2*kLFLen, 0), \"" + contenteditable.innerHTML + "\": selection anchor offset should be 0");
|
||||
is(selection.focusNode, contenteditable.lastChild,
|
||||
"runSetSelectionEventTest #17 (1+2*kLFLen, 0), \"" + contenteditable.innerHTML + "\": selection focus node should be the second <div> element");
|
||||
is(selection.focusOffset, 0,
|
||||
"runSetSelectionEventTest #17 (1+2*kLFLen, 0), \"" + contenteditable.innerHTML + "\": selection focus offset should be the length of the last text node");
|
||||
checkSelection(1+2*kLFLen, "", "runSetSelectionEventTest #17 (1+2*kLFLen, 0), \"" + contenteditable.innerHTML + "\"");
|
||||
}
|
||||
|
||||
function runQueryTextContentEventTest()
|
||||
|
|
Загрузка…
Ссылка в новой задаче