Submit name/value pair for images that have value set (bug 57795, r=alexsavulov, sr=jst)

This commit is contained in:
jkeiser%netscape.com 2002-01-24 19:08:57 +00:00
Родитель 57b832743d
Коммит 4400a74ab1
1 изменённых файлов: 23 добавлений и 3 удалений

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

@ -1881,8 +1881,19 @@ nsHTMLInputElement::GetMaxNumValues(PRInt32 *_retval)
{ {
PRInt32 type; PRInt32 type;
GetType(&type); GetType(&type);
*_retval = type == NS_FORM_INPUT_IMAGE ? 2 : 1; if (type == NS_FORM_INPUT_IMAGE) {
nsAutoString name;
nsAutoString value;
GetName(name);
GetValue(value);
if (name.IsEmpty() || value.IsEmpty()) {
*_retval = 2;
} else {
*_retval = 3;
}
} else {
*_retval = 1;
}
return NS_OK; return NS_OK;
} }
@ -1965,17 +1976,26 @@ nsHTMLInputElement::GetNamesValues(PRInt32 aMaxNumValues,
// Figure out the proper name of the x and y values // Figure out the proper name of the x and y values
nsAutoString name; nsAutoString name;
rv = GetName(name); rv = GetName(name);
aNumValues = 2;
if (!name.IsEmpty()) { if (!name.IsEmpty()) {
aNames[0] = name; aNames[0] = name;
aNames[0].Append(NS_LITERAL_STRING(".x")); aNames[0].Append(NS_LITERAL_STRING(".x"));
aNames[1] = name; aNames[1] = name;
aNames[1].Append(NS_LITERAL_STRING(".y")); aNames[1].Append(NS_LITERAL_STRING(".y"));
nsAutoString value;
rv = GetValue(value);
if (!value.IsEmpty()) {
aNames[2] = name;
aValues[2] = value;
aNumValues = 3;
} else {
aNumValues = 2;
}
} else { } else {
// If the Image Element has no name, simply return x and y // If the Image Element has no name, simply return x and y
// to Nav and IE compatability. // to Nav and IE compatability.
aNames[0] = NS_LITERAL_STRING("x"); aNames[0] = NS_LITERAL_STRING("x");
aNames[1] = NS_LITERAL_STRING("y"); aNames[1] = NS_LITERAL_STRING("y");
aNumValues = 2;
} }
break; break;