зеркало из 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()
|
: nsBlockFrame()
|
||||||
{
|
{
|
||||||
mTextSubmitter = nsnull;
|
mTextSubmitter = nsnull;
|
||||||
|
mTextSubmitterSet = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFormFrame::~nsFormFrame()
|
nsFormFrame::~nsFormFrame()
|
||||||
|
@ -363,9 +364,12 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext* aPresContext, nsIFormContr
|
||||||
aFrame.GetType(&type);
|
aFrame.GetType(&type);
|
||||||
|
|
||||||
// a solo text control can be a submitter (if return is hit)
|
// 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)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ protected:
|
||||||
nsVoidArray mFormControls;
|
nsVoidArray mFormControls;
|
||||||
nsVoidArray mRadioGroups;
|
nsVoidArray mRadioGroups;
|
||||||
nsIFormControlFrame* mTextSubmitter;
|
nsIFormControlFrame* mTextSubmitter;
|
||||||
|
PRBool mTextSubmitterSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsFormFrame_h___
|
#endif // nsFormFrame_h___
|
||||||
|
|
Загрузка…
Ссылка в новой задаче