Bug 262236 Can't select listitems which are not next to.

patch=neo.liu at sun.com, r=aaronleventhal sr=neil


git-svn-id: svn://10.0.0.236/trunk@170356 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ginn.chen%sun.com 2005-03-08 03:05:03 +00:00
parent 80d95a6465
commit d4a631b933
2 changed files with 18 additions and 4 deletions

View File

@ -311,6 +311,7 @@ nsListControlFrame::nsListControlFrame(nsIPresShell* aShell,
mDummyFrame = nsnull;
mControlSelectMode = PR_FALSE;
REFLOW_COUNTER_INIT()
}
@ -3025,7 +3026,15 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
// DOM_VK_ESCAPE cancels the selection
// default processing checks to see if the pressed the first
// letter of an item in the list and advances to it
if (isControl && (keycode == nsIDOMKeyEvent::DOM_VK_UP ||
keycode == nsIDOMKeyEvent::DOM_VK_LEFT ||
keycode == nsIDOMKeyEvent::DOM_VK_DOWN ||
keycode == nsIDOMKeyEvent::DOM_VK_RIGHT)) {
mControlSelectMode = PR_TRUE;
} else if (charcode != ' ') {
mControlSelectMode = PR_FALSE;
}
switch (keycode) {
case nsIDOMKeyEvent::DOM_VK_UP:
@ -3205,6 +3214,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
mStartSelectionIndex = newIndex;
mEndSelectionIndex = newIndex;
ScrollToIndex(newIndex);
} else if (mControlSelectMode && charcode == ' ') {
SingleSelection(newIndex, PR_TRUE);
} else {
PRBool wasChanged = PerformSelection(newIndex, isShift, isControl);
if (wasChanged) {

View File

@ -265,13 +265,13 @@ protected:
PRInt32 mEndSelectionIndex;
nsIComboboxControlFrame *mComboboxFrame;
PRPackedBool mChangesSinceDragStart;
PRPackedBool mButtonDown;
nscoord mMaxWidth;
nscoord mMaxHeight;
PRInt32 mNumDisplayRows;
PRPackedBool mChangesSinceDragStart;
PRPackedBool mButtonDown;
PRBool mIsAllContentHere;
PRPackedBool mIsAllContentHere;
PRPackedBool mIsAllFramesHere;
PRPackedBool mHasBeenInitialized;
PRPackedBool mNeedToReset;
@ -279,6 +279,9 @@ protected:
PRPackedBool mOverrideReflowOpt;
//bool value for multiple discontiguous selection
PRPackedBool mControlSelectMode;
nsRefPtr<nsListEventListener> mEventListener;
PRInt16 mPassId;