Last Comment Bug 267866 - Wrong algorithm of selection in listbox seltype="multiple"
: Wrong algorithm of selection in listbox seltype="multiple"
Product: Core
Classification: Components
Component: XUL (show other bugs)
: Trunk
: x86 Windows 2000
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Neil Deakin
data:text/html,<select size="8" multi...
Depends on:
  Show dependency treegraph
Reported: 2004-11-04 22:40 PST by alexander :surkov
Modified: 2008-07-31 03:16 PDT (History)
6 users (show)
darin.moz: blocking1.8.1-
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

testcase (624 bytes, application/vnd.mozilla.xul+xml)
2004-11-04 22:41 PST, alexander :surkov
no flags Details
tree testcase (738 bytes, application/vnd.mozilla.xul+xml)
2004-11-18 12:06 PST,
no flags Details
reset _selectionStart more often (6.29 KB, patch)
2005-10-03 07:13 PDT, Simon Bünzli
no flags Details | Diff | Splinter Review

Description User image alexander :surkov 2004-11-04 22:40:23 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616

I get invalid selection when I select items in the following way. Let m<i<n is
indexes of listitems

Reproducible: Always
Steps to Reproduce:
1. Select m item
2. Select n item keeping shift key
3. Select i item
4. Select n item keeping shift key
Actual Results:  
Indexes of selected items evaluate from m to n.

Expected Results:  
If we replace m by n in this algorithm (note: m<i<n) then selection is wrong
(also from m to n).
Comment 1 User image alexander :surkov 2004-11-04 22:41:28 PST
Created attachment 164692 [details]
Comment 2 User image alexander :surkov 2004-11-04 22:42:54 PST
Expected results:
Indexes of selected items should evaluate from i to n.
Comment 3 User image 2004-11-15 07:00:23 PST
Anyone fixing this might consider looking at tree.xml and nsTreeSelection.cpp
Comment 4 User image Justin Wood (:Callek) [away until Feb 27] 2004-11-17 20:13:25 PST
seems to be a "live" value in listbox.xml to me, I will check and test
Comment 5 User image 2004-11-18 00:25:38 PST
I guess we have three multiple selection implementations, for <html:select>
<xul:tree> and <xul:listbox>, and they need to all work the same way...
Comment 6 User image Justin Wood (:Callek) [away until Feb 27] 2004-11-18 07:40:23 PST
Updated URL for a data: html|select textcase (html trans -- quirks; in this case)

If someone can create a testcase for xul|tree  I will look into it as well, I
dont know our xul tree code well enough.
Comment 7 User image 2004-11-18 12:06:58 PST
Created attachment 166360 [details]
tree testcase

So on the face of it it looks like the code paths used by <select> and <tree>
are correct, at least in this case.
Comment 8 User image Justin Wood (:Callek) [away until Feb 27] 2004-11-19 11:49:56 PST
hmm, my minor (potential) fix did not work in my FF build, from current aviary
tree...I'll investigate further I suspect later on.
Comment 9 User image Simon Bünzli 2005-10-03 07:13:43 PDT
Created attachment 198305 [details] [diff] [review]
reset _selectionStart more often

This patch should correctly reset _selectionStart whenever addItemToSelection
and removeItemFromSelection are called outside of range selecting code (with
the minor exception of toggleItemSelection which might be considered syntactic
sugar for the other two).
Comment 10 User image Darin Fisher 2006-06-16 17:33:13 PDT
Not going to block 1.8.1 for this bug.
Comment 11 User image Simon Bünzli 2007-01-17 09:52:54 PST
This fix has been included together with the changes in bug 298371. -> FIXED

Note You need to log in before you can comment on or make changes to this bug.