Removed nsGfxButtonControlFrame's MouseClick method. It uses it's base classes (nsHTMLButtonControlFrame)

MouseClick instead. Reworked nsHTMLButton::MouseClick factoring out code to get Reset and Submit button
types so MouseClick can be re-used by the nsGfxButtonControlFrame.
Fix for bug 13462. Set the nsHTMLButtonControlFrame's mForm in the initial reflow.


git-svn-id: svn://10.0.0.236/trunk@47161 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kmcclusk%netscape.com
1999-09-13 20:40:59 +00:00
parent 9532af4dd5
commit 935de9c7ef
9 changed files with 158 additions and 114 deletions

View File

@@ -99,43 +99,28 @@ NS_NewGfxButtonControlFrame(nsIFrame** aNewFrame)
*aNewFrame = it;
return NS_OK;
}
void
nsGfxButtonControlFrame::MouseClicked(nsIPresContext* aPresContext)
PRBool
nsGfxButtonControlFrame::IsReset(PRInt32 type)
{
PRInt32 type;
GetType(&type);
if ((nsnull != mFormFrame) && !nsFormFrame::GetDisabled(this)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
nsIContent *formContent = nsnull;
mFormFrame->GetContent(&formContent);
switch(type) {
case NS_FORM_INPUT_RESET:
event.message = NS_FORM_RESET;
if (nsnull != formContent) {
formContent->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
}
if (nsEventStatus_eConsumeNoDefault != status) {
mFormFrame->OnReset();
}
break;
case NS_FORM_INPUT_SUBMIT:
event.message = NS_FORM_SUBMIT;
if (nsnull != formContent) {
formContent->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
}
if (nsEventStatus_eConsumeNoDefault != status) {
mFormFrame->OnSubmit(aPresContext, this);
}
}
NS_IF_RELEASE(formContent);
}
if (NS_FORM_INPUT_RESET == type) {
return PR_TRUE;
} else {
return PR_FALSE;
}
}
PRBool
nsGfxButtonControlFrame::IsSubmit(PRInt32 type)
{
if (NS_FORM_INPUT_SUBMIT == type) {
return PR_TRUE;
} else {
return PR_FALSE;
}
}
const nsIID&
nsGfxButtonControlFrame::GetIID()
{
@@ -178,9 +163,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
nsFormFrame::AddFormControlFrame(aPresContext, *this);
}
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
if ((kSuggestedNotSet != mSuggestedWidth) ||
(kSuggestedNotSet != mSuggestedHeight)) {