Fix bug #3375 and #3368: Allow hidden inputs and password inputs to store values.

This commit is contained in:
pollmann%netscape.com 1999-03-03 02:54:25 +00:00
Родитель dafba1f6f4
Коммит 16ee81ed7f
2 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -328,7 +328,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
{
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE) {
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame) {
@ -338,6 +338,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
return NS_OK;
}
}
// Treat value == defaultValue for other input elements
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue);
}
@ -347,16 +348,18 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
{
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type) {
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame ) {
formControlFrame->SetProperty(nsHTMLAtoms::value, aValue);
NS_RELEASE(formControlFrame);
}
return NS_OK;
}
}
return NS_OK;
}
// Treat value == defaultValue for other input elements.
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue, PR_TRUE);
}
NS_IMETHODIMP

Просмотреть файл

@ -328,7 +328,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
{
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE) {
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame) {
@ -338,6 +338,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
return NS_OK;
}
}
// Treat value == defaultValue for other input elements
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue);
}
@ -347,16 +348,18 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
{
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type) {
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame ) {
formControlFrame->SetProperty(nsHTMLAtoms::value, aValue);
NS_RELEASE(formControlFrame);
}
return NS_OK;
}
}
return NS_OK;
}
// Treat value == defaultValue for other input elements.
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue, PR_TRUE);
}
NS_IMETHODIMP