зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1399091 - Avoid adding the same range to multiple selections. r=mats
This commit is contained in:
Родитель
8036d190e1
Коммит
98224a4eda
|
@ -1048,12 +1048,19 @@ nsRange::SetSelection(mozilla::dom::Selection* aSelection)
|
|||
if (mSelection == aSelection) {
|
||||
return;
|
||||
}
|
||||
|
||||
// At least one of aSelection and mSelection must be null
|
||||
// aSelection will be null when we are removing from a selection
|
||||
// and a range can't be in more than one selection at a time,
|
||||
// thus mSelection must be null too.
|
||||
MOZ_ASSERT(!aSelection || !mSelection);
|
||||
|
||||
// Extra step in case our parent failed to ensure the above
|
||||
// invariant.
|
||||
if (aSelection && mSelection) {
|
||||
mSelection->RemoveRange(this);
|
||||
}
|
||||
|
||||
mSelection = aSelection;
|
||||
if (mSelection) {
|
||||
nsINode* commonAncestor = GetCommonAncestor();
|
||||
|
|
Загрузка…
Ссылка в новой задаче