зеркало из https://github.com/mozilla/gecko-dev.git
Checking in John Keiser's fix for bug 110613, problems with file inputs. r=peterv@netscape.com, sr=jst@netscape.com
This commit is contained in:
Родитель
ddc7bfe48b
Коммит
c25965bf91
|
@ -55,6 +55,11 @@ public:
|
|||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTCONTROLELEMENT_IID)
|
||||
|
||||
/**
|
||||
* Set the control's value without security checks
|
||||
*/
|
||||
NS_IMETHOD SetValueGuaranteed(const nsAReadableString& aValue) = 0;
|
||||
|
||||
/**
|
||||
* Tell the control that value has been deliberately changed (or not).
|
||||
*/
|
||||
|
|
|
@ -186,6 +186,7 @@ public:
|
|||
}
|
||||
|
||||
// nsITextControlElement
|
||||
NS_IMETHOD SetValueGuaranteed(const nsAReadableString& aValue);
|
||||
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
|
||||
|
||||
protected:
|
||||
|
@ -416,6 +417,7 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue)
|
|||
{
|
||||
PRInt32 type;
|
||||
GetType(&type);
|
||||
|
||||
if (type == NS_FORM_INPUT_TEXT || type == NS_FORM_INPUT_PASSWORD ||
|
||||
type == NS_FORM_INPUT_FILE) {
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
|
@ -425,15 +427,19 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue)
|
|||
// have) even if we force it to be created
|
||||
GetPrimaryFrame(this, formControlFrame, PR_FALSE, PR_FALSE);
|
||||
|
||||
nsIGfxTextControlFrame2* textControlFrame = nsnull;
|
||||
PRBool frameOwnsValue = PR_FALSE;
|
||||
if (formControlFrame) {
|
||||
nsIGfxTextControlFrame2* textControlFrame = nsnull;
|
||||
CallQueryInterface(formControlFrame, &textControlFrame);
|
||||
|
||||
if (textControlFrame) {
|
||||
textControlFrame->OwnsValue(&frameOwnsValue);
|
||||
} else {
|
||||
// We assume if it's not a text control frame that it owns the value
|
||||
frameOwnsValue = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool frameOwnsValue = PR_FALSE;
|
||||
if (textControlFrame) {
|
||||
textControlFrame->OwnsValue(&frameOwnsValue);
|
||||
}
|
||||
if (frameOwnsValue) {
|
||||
formControlFrame->GetProperty(nsHTMLAtoms::value, aValue);
|
||||
} else {
|
||||
|
@ -443,7 +449,7 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue)
|
|||
aValue = NS_ConvertUTF8toUCS2(mValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -469,6 +475,12 @@ nsHTMLInputElement::SetValue(const nsAReadableString& aValue)
|
|||
return SetValueSecure(aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetValueGuaranteed(const nsAReadableString& aValue)
|
||||
{
|
||||
return SetValueSecure(aValue, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetValueSecure(const nsAReadableString& aValue,
|
||||
PRBool aCheckSecurity)
|
||||
|
@ -1849,6 +1861,7 @@ nsHTMLInputElement::GetMaxNumValues(PRInt32 *_retval)
|
|||
PRInt32 type;
|
||||
GetType(&type);
|
||||
*_retval = type == NS_FORM_INPUT_IMAGE ? 2 : 1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsIPresState* aState);
|
||||
|
||||
// nsITextControlElement
|
||||
NS_IMETHOD SetValueGuaranteed(const nsAReadableString& aValue);
|
||||
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
|
||||
|
||||
// nsIContent
|
||||
|
@ -422,6 +423,12 @@ nsHTMLTextAreaElement::GetValue(nsAWritableString& aValue)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTextAreaElement::SetValueGuaranteed(const nsAReadableString& aValue)
|
||||
{
|
||||
return SetValue(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTextAreaElement::SetValue(const nsAReadableString& aValue)
|
||||
{
|
||||
|
|
|
@ -3402,19 +3402,10 @@ nsGfxTextControlFrame2::SetTextControlFrameState(const nsAReadableString& aValue
|
|||
else
|
||||
{
|
||||
// Otherwise set the value in content.
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputControl = do_QueryInterface(mContent);
|
||||
if (inputControl)
|
||||
nsCOMPtr<nsITextControlElement> textControl = do_QueryInterface(mContent);
|
||||
if (textControl)
|
||||
{
|
||||
inputControl->SetValue(aValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textareaControl
|
||||
= do_QueryInterface(mContent);
|
||||
if (textareaControl)
|
||||
{
|
||||
textareaControl->SetValue(aValue);
|
||||
}
|
||||
textControl->SetValueGuaranteed(aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче