diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-12 12:52:18 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 13:27:57 +0200 |
commit | 26c888208a11c3e9159fd5c7755abb8a34aeda39 (patch) | |
tree | aeb8d96cbe900874930a76f0366ab16873a6a008 /layout/generic/nsSelection.cpp | |
parent | 9a52b3b852181bc956a97dbff1da68cf8ef415a2 (diff) | |
download | UXP-26c888208a11c3e9159fd5c7755abb8a34aeda39.tar UXP-26c888208a11c3e9159fd5c7755abb8a34aeda39.tar.gz UXP-26c888208a11c3e9159fd5c7755abb8a34aeda39.tar.lz UXP-26c888208a11c3e9159fd5c7755abb8a34aeda39.tar.xz UXP-26c888208a11c3e9159fd5c7755abb8a34aeda39.zip |
Issue #1512 - Improve handling of multiple selections.
IsSelectionEditable should check whether the focus node and anchor node
aren't null before trying to use them.
This also changes the initialization of selections' aOutIndex to the
last range in the selection as a fallback in case we don't add a range
later (in AddItem) which could also end up with a null selection
otherwise if the additional selection nodes are removed.
Diffstat (limited to 'layout/generic/nsSelection.cpp')
-rw-r--r-- | layout/generic/nsSelection.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index f2959dc9d..5ccb2d8bf 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -3844,7 +3844,7 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex, bool aNoStartSelect) if (mUserInitiated) { AutoTArray<RefPtr<nsRange>, 4> rangesToAdd; - *aOutIndex = -1; + *aOutIndex = int32_t(mRanges.Length()) - 1; nsIDocument* doc = GetParentObject(); bool selectEventsEnabled = |