зеркало из https://github.com/mozilla/gecko-dev.git
Bug 726264. r=smaug
This commit is contained in:
Родитель
69fa6dcecc
Коммит
2e4be4fbfd
|
@ -279,19 +279,18 @@ static PRInt32 gReflowInx = -1;
|
|||
//------------------------------------------------------
|
||||
|
||||
nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext)
|
||||
: nsBlockFrame(aContext),
|
||||
mDisplayWidth(0)
|
||||
: nsBlockFrame(aContext)
|
||||
, mDisplayFrame(nsnull)
|
||||
, mButtonFrame(nsnull)
|
||||
, mDropdownFrame(nsnull)
|
||||
, mListControlFrame(nsnull)
|
||||
, mDisplayWidth(0)
|
||||
, mRecentSelectedIndex(NS_SKIP_NOTIFY_INDEX)
|
||||
, mDisplayedIndex(-1)
|
||||
, mDroppedDown(false)
|
||||
, mInRedisplayText(false)
|
||||
, mDelayedShowDropDown(false)
|
||||
{
|
||||
mListControlFrame = nsnull;
|
||||
mDroppedDown = false;
|
||||
mDisplayFrame = nsnull;
|
||||
mButtonFrame = nsnull;
|
||||
mDropdownFrame = nsnull;
|
||||
|
||||
mInRedisplayText = false;
|
||||
|
||||
mRecentSelectedIndex = NS_SKIP_NOTIFY_INDEX;
|
||||
|
||||
REFLOW_COUNTER_INIT()
|
||||
}
|
||||
|
||||
|
@ -332,8 +331,16 @@ nsComboboxControlFrame::SetFocus(bool aOn, bool aRepaint)
|
|||
if (aOn) {
|
||||
nsListControlFrame::ComboboxFocusSet();
|
||||
mFocused = this;
|
||||
if (mDelayedShowDropDown) {
|
||||
ShowDropDown(true); // might destroy us
|
||||
if (!weakFrame.IsAlive()) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(!mDelayedShowDropDown);
|
||||
}
|
||||
} else {
|
||||
mFocused = nsnull;
|
||||
mDelayedShowDropDown = false;
|
||||
if (mDroppedDown) {
|
||||
mListControlFrame->ComboboxFinish(mDisplayedIndex); // might destroy us
|
||||
if (!weakFrame.IsAlive()) {
|
||||
|
@ -794,16 +801,22 @@ nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
|
|||
void
|
||||
nsComboboxControlFrame::ShowDropDown(bool aDoDropDown)
|
||||
{
|
||||
mDelayedShowDropDown = false;
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mDroppedDown && aDoDropDown) {
|
||||
if (mFocused == this) {
|
||||
if (mListControlFrame) {
|
||||
mListControlFrame->SyncViewWithFrame();
|
||||
}
|
||||
ShowList(aDoDropDown); // might destroy us
|
||||
} else {
|
||||
// Delay until we get focus, see SetFocus().
|
||||
mDelayedShowDropDown = true;
|
||||
}
|
||||
} else if (mDroppedDown && !aDoDropDown) {
|
||||
ShowList(aDoDropDown); // might destroy us
|
||||
}
|
||||
|
|
|
@ -242,9 +242,6 @@ protected:
|
|||
// size to the full width except the drop-marker.
|
||||
nscoord mDisplayWidth;
|
||||
|
||||
bool mDroppedDown; // Current state of the dropdown list, true is dropped down
|
||||
bool mInRedisplayText;
|
||||
|
||||
nsRevocableEventPtr<RedisplayTextEvent> mRedisplayTextEvent;
|
||||
|
||||
PRInt32 mRecentSelectedIndex;
|
||||
|
@ -255,6 +252,13 @@ protected:
|
|||
// then open or close the combo box.
|
||||
nsCOMPtr<nsIDOMEventListener> mButtonListener;
|
||||
|
||||
// Current state of the dropdown list, true is dropped down.
|
||||
bool mDroppedDown;
|
||||
// See comment in HandleRedisplayTextEvent().
|
||||
bool mInRedisplayText;
|
||||
// Acting on ShowDropDown(true) is delayed until we're focused.
|
||||
bool mDelayedShowDropDown;
|
||||
|
||||
// static class data member for Bug 32920
|
||||
// only one control can be focused at a time
|
||||
static nsComboboxControlFrame * mFocused;
|
||||
|
|
Загрузка…
Ссылка в новой задаче