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 | a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c (patch) | |
tree | e67e9e0b7891279e5f80b6d967431a7a2315915c /layout | |
parent | 552470fb6f3e7b3028e725e0affc6e4f5550c511 (diff) | |
download | UXP-a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c.tar UXP-a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c.tar.gz UXP-a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c.tar.lz UXP-a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c.tar.xz UXP-a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c.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')
-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 = |