diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-12 12:52:18 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-12 12:52:18 +0200 |
commit | b41a9a006c001e896ac3e49fb1c04283b8ede1b7 (patch) | |
tree | e67e9e0b7891279e5f80b6d967431a7a2315915c /layout/generic/nsSelection.cpp | |
parent | a3572c5817fd647c2925abae8dcb906e427a1de5 (diff) | |
download | aura-central-b41a9a006c001e896ac3e49fb1c04283b8ede1b7.tar.gz |
Issue mcp-graveyard/UXP%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 = |