Bug 1121335 - Choose the right selection range for drag mode, r=roc

This commit is contained in:
Peter Chang 2015-01-23 06:09:00 +01:00
parent 8c1a91fc06
commit 2ce93a45ac

View File

@ -771,8 +771,10 @@ SelectionCarets::DragSelection(const nsPoint &movePoint)
return nsEventStatus_eConsumeNoDefault;
}
// Limit the drag behavior not to cross the end of last selection range
// when drag the start frame and vice versa
nsRefPtr<nsRange> range = mDragMode == START_FRAME ?
selection->GetRangeAt(0) : selection->GetRangeAt(rangeCount - 1);
selection->GetRangeAt(rangeCount - 1) : selection->GetRangeAt(0);
if (!CompareRangeWithContentOffset(range, fs, offsets, mDragMode)) {
return nsEventStatus_eConsumeNoDefault;
}