mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1129078 - part 1, Remove the chunk that bug 739396 added to Selection::Extend. r=smaug
This commit is contained in:
parent
f4a34c2cf5
commit
00aef14813
@ -5001,48 +5001,6 @@ Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user