Commit 07983f1c authored by rods%netscape.com's avatar rods%netscape.com
Browse files

Make the default "submit"

Bug 59035 r=kmcclusk sr=attinasi
parent d452604e
Loading
Loading
Loading
Loading
+4 −21
Original line number Original line Diff line number Diff line
@@ -319,26 +319,9 @@ nsHTMLButtonControlFrame::IsReset(PRInt32 type)
}
}


PRBool
PRBool
nsHTMLButtonControlFrame::IsSubmit(nsIPresContext* aPresContext, PRInt32 type)
nsHTMLButtonControlFrame::IsSubmit(PRInt32 type)
{
{
  nsCompatibility mode;
  if (NS_FORM_BUTTON_SUBMIT == type) {
  nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
  if (eCompatibility_Standard == mode && mContent != nsnull) {
    // The default type for a html4 button is NS_FORM_BUTTON_BUTTON, 
    // but that does not mean that the type was actually set to "button"
    // so we need to check here to see if a type was actually set
    // and oif it wasn't explicitly then we we allow to be a submit
    if (NS_FORM_BUTTON_BUTTON == type) {
      nsAutoString type;
      if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::type, type)) {
        return PR_FALSE;
      } else {
        return PR_TRUE;
      }
    }
  }

  if (NS_FORM_BUTTON_SUBMIT == type || NS_FORM_INPUT_SUBMIT == type) {
    return PR_TRUE;
    return PR_TRUE;
  } else {
  } else {
    return PR_FALSE;
    return PR_FALSE;
@@ -358,7 +341,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext)
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
                                                 this, PR_FALSE, PR_FALSE); 
                                                 this, PR_FALSE, PR_FALSE); 
    }
    }
    else if (IsSubmit(aPresContext, type) == PR_TRUE) {
    else if (IsSubmit(type) == PR_TRUE) {
      // do Submit & Frame processing of event
      // do Submit & Frame processing of event
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
                                                 this, PR_TRUE, PR_FALSE); 
                                                 this, PR_TRUE, PR_FALSE); 
+1 −1
Original line number Original line Diff line number Diff line
@@ -149,7 +149,7 @@ public:


protected:
protected:
  virtual PRBool IsReset(PRInt32 type);
  virtual PRBool IsReset(PRInt32 type);
  virtual PRBool IsSubmit(nsIPresContext* aPresContext, PRInt32 type);
  virtual PRBool IsSubmit(PRInt32 type);
  NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
  NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
                                                   const nsHTMLReflowState& aSuggestedReflowState);
                                                   const nsHTMLReflowState& aSuggestedReflowState);
  NS_IMETHOD_(nsrefcnt) AddRef(void);
  NS_IMETHOD_(nsrefcnt) AddRef(void);
+4 −21
Original line number Original line Diff line number Diff line
@@ -319,26 +319,9 @@ nsHTMLButtonControlFrame::IsReset(PRInt32 type)
}
}


PRBool
PRBool
nsHTMLButtonControlFrame::IsSubmit(nsIPresContext* aPresContext, PRInt32 type)
nsHTMLButtonControlFrame::IsSubmit(PRInt32 type)
{
{
  nsCompatibility mode;
  if (NS_FORM_BUTTON_SUBMIT == type) {
  nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
  if (eCompatibility_Standard == mode && mContent != nsnull) {
    // The default type for a html4 button is NS_FORM_BUTTON_BUTTON, 
    // but that does not mean that the type was actually set to "button"
    // so we need to check here to see if a type was actually set
    // and oif it wasn't explicitly then we we allow to be a submit
    if (NS_FORM_BUTTON_BUTTON == type) {
      nsAutoString type;
      if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::type, type)) {
        return PR_FALSE;
      } else {
        return PR_TRUE;
      }
    }
  }

  if (NS_FORM_BUTTON_SUBMIT == type || NS_FORM_INPUT_SUBMIT == type) {
    return PR_TRUE;
    return PR_TRUE;
  } else {
  } else {
    return PR_FALSE;
    return PR_FALSE;
@@ -358,7 +341,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext)
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
                                                 this, PR_FALSE, PR_FALSE); 
                                                 this, PR_FALSE, PR_FALSE); 
    }
    }
    else if (IsSubmit(aPresContext, type) == PR_TRUE) {
    else if (IsSubmit(type) == PR_TRUE) {
      // do Submit & Frame processing of event
      // do Submit & Frame processing of event
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
      nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, 
                                                 this, PR_TRUE, PR_FALSE); 
                                                 this, PR_TRUE, PR_FALSE); 
+1 −1
Original line number Original line Diff line number Diff line
@@ -149,7 +149,7 @@ public:


protected:
protected:
  virtual PRBool IsReset(PRInt32 type);
  virtual PRBool IsReset(PRInt32 type);
  virtual PRBool IsSubmit(nsIPresContext* aPresContext, PRInt32 type);
  virtual PRBool IsSubmit(PRInt32 type);
  NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
  NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
                                                   const nsHTMLReflowState& aSuggestedReflowState);
                                                   const nsHTMLReflowState& aSuggestedReflowState);
  NS_IMETHOD_(nsrefcnt) AddRef(void);
  NS_IMETHOD_(nsrefcnt) AddRef(void);