зеркало из https://github.com/mozilla/gecko-dev.git
Bug 22526: Correct bug where form was submitted by pressing enter in last text input if odd number of inputs r=harishd
This commit is contained in:
Родитель
fd76569535
Коммит
915ecbc26a
|
@ -147,6 +147,7 @@ nsFormFrame::nsFormFrame()
|
|||
: nsBlockFrame()
|
||||
{
|
||||
mTextSubmitter = nsnull;
|
||||
mTextSubmitterSet = PR_FALSE;
|
||||
}
|
||||
|
||||
nsFormFrame::~nsFormFrame()
|
||||
|
@ -363,9 +364,12 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext* aPresContext, nsIFormContr
|
|||
aFrame.GetType(&type);
|
||||
|
||||
// a solo text control can be a submitter (if return is hit)
|
||||
// XXX pollmann this logic is flawed - three text boxes?
|
||||
if ((NS_FORM_INPUT_TEXT == type) || (NS_FORM_INPUT_PASSWORD == type)) {
|
||||
mTextSubmitter = (nsnull == mTextSubmitter) ? &aFrame : nsnull;
|
||||
// Only set if this is the first text input found. Otherwise, set to null.
|
||||
if (!mTextSubmitterSet) {
|
||||
mTextSubmitter = &aFrame;
|
||||
mTextSubmitterSet = PR_TRUE;
|
||||
} else mTextSubmitter = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ protected:
|
|||
nsVoidArray mFormControls;
|
||||
nsVoidArray mRadioGroups;
|
||||
nsIFormControlFrame* mTextSubmitter;
|
||||
PRBool mTextSubmitterSet;
|
||||
};
|
||||
|
||||
#endif // nsFormFrame_h___
|
||||
|
|
Загрузка…
Ссылка в новой задаче