зеркало из https://github.com/mozilla/gecko-dev.git
*** empty log message ***
This commit is contained in:
Родитель
4a9a2cb416
Коммит
24c1a2552e
|
@ -54,7 +54,8 @@ NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
// Initialize GFX-rendered state
|
||||
nsGfxCheckboxControlFrame::nsGfxCheckboxControlFrame()
|
||||
: mChecked(eOff),
|
||||
mCheckButtonFaceStyle(nsnull)
|
||||
mCheckButtonFaceStyle(nsnull),
|
||||
mInClickEvent(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,14 @@ nsGfxCheckboxControlFrame::SetCheckboxFaceStyleContext(nsIStyleContext *aCheckbo
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsGfxCheckboxControlFrame::SetIsInClickEvent(PRBool aVal)
|
||||
{
|
||||
mInClickEvent = aVal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
//
|
||||
// Init
|
||||
|
@ -414,6 +423,22 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
nsGfxCheckboxControlFrame::CheckState
|
||||
nsGfxCheckboxControlFrame::GetCheckboxState ( )
|
||||
{
|
||||
// If we are processing an onclick event then
|
||||
// always return the opposite value
|
||||
// additional explanantion is in nsICheckboxControlFrame or nsHTMLInputElement.cpp
|
||||
if (mInClickEvent) {
|
||||
if (!IsTristateCheckbox()) {
|
||||
return mChecked == eOn? eOff : eOn;
|
||||
} else {
|
||||
switch (mChecked) {
|
||||
case eOff: return eOn;
|
||||
case eOn: return eMixed;
|
||||
case eMixed: return eOff;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,9 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
//nsIRadioControlFrame methods
|
||||
//nsICheckboxControlFrame methods
|
||||
NS_IMETHOD SetCheckboxFaceStyleContext(nsIStyleContext *aCheckboxFaceStyleContext);
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal);
|
||||
|
||||
void InitializeControl(nsIPresContext* aPresContext);
|
||||
|
||||
|
@ -133,8 +134,9 @@ protected:
|
|||
virtual void PaintMixedMark(nsIRenderingContext& aRenderingContext,
|
||||
float aPixelsToTwips, const nsRect& aRect) ;
|
||||
|
||||
//GFX-rendered state variables
|
||||
CheckState mChecked;
|
||||
//GFX-rendered state variables
|
||||
PRBool mInClickEvent;
|
||||
CheckState mChecked;
|
||||
nsIStyleContext* mCheckButtonFaceStyle;
|
||||
|
||||
private:
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
//nsIRadioControlFrame methods
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_IMETHOD SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext);
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal);
|
||||
|
||||
|
||||
virtual PRBool GetChecked();
|
||||
|
@ -111,6 +112,7 @@ protected:
|
|||
virtual void SetRadioState(nsIPresContext* aPresContext, PRBool aValue);
|
||||
|
||||
//GFX-rendered state variables
|
||||
PRBool mInClickEvent;
|
||||
PRBool mChecked;
|
||||
nsIStyleContext* mRadioButtonFaceStyle;
|
||||
PRBool mRestoredChecked;
|
||||
|
|
|
@ -46,6 +46,28 @@ public:
|
|||
*
|
||||
*/
|
||||
NS_IMETHOD SetCheckboxFaceStyleContext(nsIStyleContext *aCheckboxFaceStyleContext) = 0;
|
||||
|
||||
/**
|
||||
* When a user clicks on a checkbox the value needs to be set after the onmouseup
|
||||
* and before the onclick event is processed via script. The EVM always lets script
|
||||
* get first crack at the processing, and script can cancel further processing of
|
||||
* the event by return null.
|
||||
*
|
||||
* This means the checkbox needs to have it's new value set before it goes to script
|
||||
* to process the onclick and then if script cancels the event it needs to be set back.
|
||||
* In Nav and IE there is a flash of it being set and then unset
|
||||
*
|
||||
* We have added this extra method to the checkbox to tell it to temporarily return the
|
||||
* opposite value while processing the click event. This way script gets the correct "future"
|
||||
* value of the checkbox, but there is no visual updating until after script is done processing.
|
||||
* That way if the event is cancelled then the checkbox will not flash.
|
||||
*
|
||||
* So get the Frame for the checkbox and tell it we are processing an onclick event
|
||||
* (see also: nsHTMLInputElement.cpp)
|
||||
*/
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,27 @@ public:
|
|||
* Sets the Pseudo Style Contexts for the Radio button
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext) = 0;
|
||||
/**
|
||||
* When a user clicks on a radiobutton the value needs to be set after the onmouseup
|
||||
* and before the onclick event is processed via script. The EVM always lets script
|
||||
* get first crack at the processing, and script can cancel further processing of
|
||||
* the event by return null.
|
||||
*
|
||||
* This means the radiobutton needs to have it's new value set before it goes to script
|
||||
* to process the onclick and then if script cancels the event it needs to be set back.
|
||||
* In Nav and IE there is a flash of it being set and then unset
|
||||
*
|
||||
* We have added this extra method to the radiobutton to tell it to temporarily return the
|
||||
* opposite value while processing the click event. This way script gets the correct "future"
|
||||
* value of the radiobutton, but there is no visual updating until after script is done processing.
|
||||
* That way if the event is cancelled then the radiobutton will not flash.
|
||||
*
|
||||
* So get the Frame for the radiobutton and tell it we are processing an onclick event
|
||||
* (see also: nsHTMLInputElement.cpp)
|
||||
*/
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,6 +46,28 @@ public:
|
|||
*
|
||||
*/
|
||||
NS_IMETHOD SetCheckboxFaceStyleContext(nsIStyleContext *aCheckboxFaceStyleContext) = 0;
|
||||
|
||||
/**
|
||||
* When a user clicks on a checkbox the value needs to be set after the onmouseup
|
||||
* and before the onclick event is processed via script. The EVM always lets script
|
||||
* get first crack at the processing, and script can cancel further processing of
|
||||
* the event by return null.
|
||||
*
|
||||
* This means the checkbox needs to have it's new value set before it goes to script
|
||||
* to process the onclick and then if script cancels the event it needs to be set back.
|
||||
* In Nav and IE there is a flash of it being set and then unset
|
||||
*
|
||||
* We have added this extra method to the checkbox to tell it to temporarily return the
|
||||
* opposite value while processing the click event. This way script gets the correct "future"
|
||||
* value of the checkbox, but there is no visual updating until after script is done processing.
|
||||
* That way if the event is cancelled then the checkbox will not flash.
|
||||
*
|
||||
* So get the Frame for the checkbox and tell it we are processing an onclick event
|
||||
* (see also: nsHTMLInputElement.cpp)
|
||||
*/
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,27 @@ public:
|
|||
* Sets the Pseudo Style Contexts for the Radio button
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext) = 0;
|
||||
/**
|
||||
* When a user clicks on a radiobutton the value needs to be set after the onmouseup
|
||||
* and before the onclick event is processed via script. The EVM always lets script
|
||||
* get first crack at the processing, and script can cancel further processing of
|
||||
* the event by return null.
|
||||
*
|
||||
* This means the radiobutton needs to have it's new value set before it goes to script
|
||||
* to process the onclick and then if script cancels the event it needs to be set back.
|
||||
* In Nav and IE there is a flash of it being set and then unset
|
||||
*
|
||||
* We have added this extra method to the radiobutton to tell it to temporarily return the
|
||||
* opposite value while processing the click event. This way script gets the correct "future"
|
||||
* value of the radiobutton, but there is no visual updating until after script is done processing.
|
||||
* That way if the event is cancelled then the radiobutton will not flash.
|
||||
*
|
||||
* So get the Frame for the radiobutton and tell it we are processing an onclick event
|
||||
* (see also: nsHTMLInputElement.cpp)
|
||||
*/
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,8 @@ NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
// Initialize GFX-rendered state
|
||||
nsGfxCheckboxControlFrame::nsGfxCheckboxControlFrame()
|
||||
: mChecked(eOff),
|
||||
mCheckButtonFaceStyle(nsnull)
|
||||
mCheckButtonFaceStyle(nsnull),
|
||||
mInClickEvent(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,14 @@ nsGfxCheckboxControlFrame::SetCheckboxFaceStyleContext(nsIStyleContext *aCheckbo
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsGfxCheckboxControlFrame::SetIsInClickEvent(PRBool aVal)
|
||||
{
|
||||
mInClickEvent = aVal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
//
|
||||
// Init
|
||||
|
@ -414,6 +423,22 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
nsGfxCheckboxControlFrame::CheckState
|
||||
nsGfxCheckboxControlFrame::GetCheckboxState ( )
|
||||
{
|
||||
// If we are processing an onclick event then
|
||||
// always return the opposite value
|
||||
// additional explanantion is in nsICheckboxControlFrame or nsHTMLInputElement.cpp
|
||||
if (mInClickEvent) {
|
||||
if (!IsTristateCheckbox()) {
|
||||
return mChecked == eOn? eOff : eOn;
|
||||
} else {
|
||||
switch (mChecked) {
|
||||
case eOff: return eOn;
|
||||
case eOn: return eMixed;
|
||||
case eMixed: return eOff;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,9 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
//nsIRadioControlFrame methods
|
||||
//nsICheckboxControlFrame methods
|
||||
NS_IMETHOD SetCheckboxFaceStyleContext(nsIStyleContext *aCheckboxFaceStyleContext);
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal);
|
||||
|
||||
void InitializeControl(nsIPresContext* aPresContext);
|
||||
|
||||
|
@ -133,8 +134,9 @@ protected:
|
|||
virtual void PaintMixedMark(nsIRenderingContext& aRenderingContext,
|
||||
float aPixelsToTwips, const nsRect& aRect) ;
|
||||
|
||||
//GFX-rendered state variables
|
||||
CheckState mChecked;
|
||||
//GFX-rendered state variables
|
||||
PRBool mInClickEvent;
|
||||
CheckState mChecked;
|
||||
nsIStyleContext* mCheckButtonFaceStyle;
|
||||
|
||||
private:
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
//nsIRadioControlFrame methods
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
NS_IMETHOD SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext);
|
||||
NS_IMETHOD SetIsInClickEvent(PRBool aVal);
|
||||
|
||||
|
||||
virtual PRBool GetChecked();
|
||||
|
@ -111,6 +112,7 @@ protected:
|
|||
virtual void SetRadioState(nsIPresContext* aPresContext, PRBool aValue);
|
||||
|
||||
//GFX-rendered state variables
|
||||
PRBool mInClickEvent;
|
||||
PRBool mChecked;
|
||||
nsIStyleContext* mRadioButtonFaceStyle;
|
||||
PRBool mRestoredChecked;
|
||||
|
|
Загрузка…
Ссылка в новой задаче