From 3e62029e1d7b04128c8a7e4e33afcc76eff701ab Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Sun, 19 Sep 1999 09:48:04 +0000 Subject: [PATCH] Bug 13960: Combo box must not be dropped down before mouse moves update the selected option. git-svn-id: svn://10.0.0.236/trunk@48253 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsListControlFrame.cpp | 26 +++++++++++-------- .../html/forms/src/nsListControlFrame.cpp | 26 +++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 3feaa36809f..7a32ab5a2ab 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -2099,18 +2099,22 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent) { - if (IsInDropDownMode() == PR_TRUE) { - PRInt32 oldIndex; - PRInt32 curIndex = mSelectedIndex; - if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, oldIndex, curIndex))) { - mSelectedIndex = curIndex; - mOldSelectedIndex = oldIndex; - if (kNothingSelected != mSelectedIndex) { - if (mOldSelectedIndex != mSelectedIndex) { - if (mOldSelectedIndex != kNothingSelected) { - SetContentSelected(mOldSelectedIndex, PR_FALSE); + if (mComboboxFrame) { // Synonym for IsInDropDownMode() + PRBool isDroppedDown = PR_FALSE; + mComboboxFrame->IsDroppedDown(&isDroppedDown); + if (isDroppedDown) { + PRInt32 oldIndex; + PRInt32 curIndex = mSelectedIndex; + if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, oldIndex, curIndex))) { + mSelectedIndex = curIndex; + mOldSelectedIndex = oldIndex; + if (kNothingSelected != mSelectedIndex) { + if (mOldSelectedIndex != mSelectedIndex) { + if (mOldSelectedIndex != kNothingSelected) { + SetContentSelected(mOldSelectedIndex, PR_FALSE); + } + SetContentSelected(mSelectedIndex, PR_TRUE); } - SetContentSelected(mSelectedIndex, PR_TRUE); } } } diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 3feaa36809f..7a32ab5a2ab 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -2099,18 +2099,22 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent) { - if (IsInDropDownMode() == PR_TRUE) { - PRInt32 oldIndex; - PRInt32 curIndex = mSelectedIndex; - if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, oldIndex, curIndex))) { - mSelectedIndex = curIndex; - mOldSelectedIndex = oldIndex; - if (kNothingSelected != mSelectedIndex) { - if (mOldSelectedIndex != mSelectedIndex) { - if (mOldSelectedIndex != kNothingSelected) { - SetContentSelected(mOldSelectedIndex, PR_FALSE); + if (mComboboxFrame) { // Synonym for IsInDropDownMode() + PRBool isDroppedDown = PR_FALSE; + mComboboxFrame->IsDroppedDown(&isDroppedDown); + if (isDroppedDown) { + PRInt32 oldIndex; + PRInt32 curIndex = mSelectedIndex; + if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, oldIndex, curIndex))) { + mSelectedIndex = curIndex; + mOldSelectedIndex = oldIndex; + if (kNothingSelected != mSelectedIndex) { + if (mOldSelectedIndex != mSelectedIndex) { + if (mOldSelectedIndex != kNothingSelected) { + SetContentSelected(mOldSelectedIndex, PR_FALSE); + } + SetContentSelected(mSelectedIndex, PR_TRUE); } - SetContentSelected(mSelectedIndex, PR_TRUE); } } }