Initial shift click will now work correctly for mulitple with selected items
it now will scroll to the selected items on start up b 24178,7025 r=kmcclusk git-svn-id: svn://10.0.0.236/trunk@58154 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -345,6 +345,18 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return skiprv;
|
||||
}
|
||||
#endif
|
||||
// XXX So this may do it too often
|
||||
// the side effect of this is if the user has scrolled to some other place in the list and
|
||||
// an incremental reflow comes through the list gets scrolled to the first selected item
|
||||
// I haven't been able to make it do it, but it will do it
|
||||
// basically the real solution is to know when all the reframes are there.
|
||||
if (aReflowState.reason == eReflowReason_Incremental) {
|
||||
nsCOMPtr<nsIContent> content = getter_AddRefs(GetOptionContent(mSelectedIndex));
|
||||
if (content) {
|
||||
ScrollToFrame(content);
|
||||
}
|
||||
}
|
||||
|
||||
// Strategy: Let the inherited reflow happen as though the width and height of the
|
||||
// ScrollFrame are big enough to allow the listbox to
|
||||
// shrink to fit the longest option element line in the list.
|
||||
@@ -853,10 +865,6 @@ nsListControlFrame::SingleSelection()
|
||||
}
|
||||
// Display the new selection
|
||||
SetContentSelected(mSelectedIndex, PR_TRUE);
|
||||
nsCOMPtr<nsIContent> content = getter_AddRefs(GetOptionContent(mSelectedIndex));
|
||||
if (content) {
|
||||
ScrollToFrame(content);
|
||||
}
|
||||
} else {
|
||||
// Selecting the currently selected item so do nothing.
|
||||
}
|
||||
@@ -1418,6 +1426,11 @@ nsListControlFrame::SetContentSelected(PRInt32 aIndex, PRBool aSelected)
|
||||
if (nsnull != content) {
|
||||
if (aSelected) {
|
||||
DisplaySelected(content);
|
||||
// Now that it is selected scroll to it
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(content));
|
||||
if (content) {
|
||||
ScrollToFrame(content);
|
||||
}
|
||||
} else {
|
||||
DisplayDeselected(content);
|
||||
}
|
||||
@@ -1523,7 +1536,11 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
||||
PRUint32 numOptions;
|
||||
options->GetLength(&numOptions);
|
||||
|
||||
mSelectedIndex = kNothingSelected;
|
||||
mSelectedIndex = kNothingSelected;
|
||||
mStartExtendedIndex = kNothingSelected;
|
||||
mEndExtendedIndex = kNothingSelected;
|
||||
PRBool multiple;
|
||||
GetMultiple(&multiple);
|
||||
|
||||
Deselect();
|
||||
PRUint32 i;
|
||||
@@ -1536,10 +1553,11 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
||||
mSelectedIndex = i;
|
||||
SetContentSelected(i, PR_TRUE);
|
||||
|
||||
// Now that it is selected scroll to it
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(option));
|
||||
if (content) {
|
||||
ScrollToFrame(content);
|
||||
if (multiple) {
|
||||
mStartExtendedIndex = i;
|
||||
if (mEndExtendedIndex == kNothingSelected) {
|
||||
mEndExtendedIndex = i;
|
||||
}
|
||||
}
|
||||
if (mComboboxFrame) {
|
||||
mComboboxFrame->UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // don't dispatch event
|
||||
@@ -2586,6 +2604,16 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
nsIFrame * parentFrame;
|
||||
frame->GetParent(&parentFrame);
|
||||
stateManager->GetEventTarget(&frame);
|
||||
nsCOMPtr<nsIListControlFrame> listFrame(do_QueryInterface(frame));
|
||||
if (listFrame) {
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
// This will consume the focus event we get from the clicking on the dropdown
|
||||
//stateManager->ConsumeFocusEvents(PR_TRUE);
|
||||
|
||||
Reference in New Issue
Block a user