mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Checkin in for John Keiser <jkeiser@iname.com>. Make checkboxes and
radio buttons not fire onChange on pageload if they are checked by default. Bug 112218, r=rods, sr=jst
This commit is contained in:
parent
40b05ee2d6
commit
76acea94df
@ -313,7 +313,15 @@ nsGfxCheckboxControlFrame::InitializeControl(nsIPresContext* aPresContext)
|
||||
if (!primaryPresShell) return;
|
||||
|
||||
if (presShell.get() == primaryPresShell.get()) {
|
||||
nsFormControlHelper::Reset(this, aPresContext);
|
||||
// Reset the value
|
||||
// XXX We set the checkbox directly in the frame, because
|
||||
// content fires onChange :(
|
||||
PRBool checked = PR_FALSE;
|
||||
nsresult rv = GetDefaultCheckState(&checked);
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == rv) {
|
||||
SetCheckboxState (aPresContext, checked ? eOn : eOff );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ PRBool nsGfxRadioControlFrame::GetRadioState()
|
||||
void nsGfxRadioControlFrame::SetRadioState(nsIPresContext* aPresContext, PRBool aValue)
|
||||
{
|
||||
mChecked = aValue;
|
||||
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
|
||||
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -370,7 +370,14 @@ nsGfxRadioControlFrame::InitializeControl(nsIPresContext* aPresContext)
|
||||
if (!primaryPresShell) return;
|
||||
|
||||
if (presShell.get() == primaryPresShell.get()) {
|
||||
nsFormControlHelper::Reset(this, aPresContext);
|
||||
// set the widget to the initial state
|
||||
// XXX We can't use reset because radio buttons fire onChange
|
||||
// from content (much to our dismay)
|
||||
PRBool checked = PR_FALSE;
|
||||
nsresult rv = GetDefaultCheckState(&checked);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == rv) {
|
||||
SetRadioState(aPresContext, checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,15 @@ nsGfxCheckboxControlFrame::InitializeControl(nsIPresContext* aPresContext)
|
||||
if (!primaryPresShell) return;
|
||||
|
||||
if (presShell.get() == primaryPresShell.get()) {
|
||||
nsFormControlHelper::Reset(this, aPresContext);
|
||||
// Reset the value
|
||||
// XXX We set the checkbox directly in the frame, because
|
||||
// content fires onChange :(
|
||||
PRBool checked = PR_FALSE;
|
||||
nsresult rv = GetDefaultCheckState(&checked);
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == rv) {
|
||||
SetCheckboxState (aPresContext, checked ? eOn : eOff );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ PRBool nsGfxRadioControlFrame::GetRadioState()
|
||||
void nsGfxRadioControlFrame::SetRadioState(nsIPresContext* aPresContext, PRBool aValue)
|
||||
{
|
||||
mChecked = aValue;
|
||||
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
|
||||
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -370,7 +370,14 @@ nsGfxRadioControlFrame::InitializeControl(nsIPresContext* aPresContext)
|
||||
if (!primaryPresShell) return;
|
||||
|
||||
if (presShell.get() == primaryPresShell.get()) {
|
||||
nsFormControlHelper::Reset(this, aPresContext);
|
||||
// set the widget to the initial state
|
||||
// XXX We can't use reset because radio buttons fire onChange
|
||||
// from content (much to our dismay)
|
||||
PRBool checked = PR_FALSE;
|
||||
nsresult rv = GetDefaultCheckState(&checked);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == rv) {
|
||||
SetRadioState(aPresContext, checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user