ra=ashuk
bug=79427. This checkin adds the following behavior: On GetValue, if a checkbox or radio button, it returns "CHECKED" or "UNCHECKED". On SetValue, any string not equal to the empty string causes the checkbox to be set. git-svn-id: svn://10.0.0.236/trunk@96927 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -686,6 +686,23 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getNodeValue
|
||||
nsresult rv;
|
||||
|
||||
OMDNI_QUERY_AND_CALL(node, GetValue, ret)
|
||||
if (input) {
|
||||
nsAutoString typeStr;
|
||||
PRBool isChecked;
|
||||
if (NS_SUCCEEDED(rv = input->GetType(typeStr))) {
|
||||
if (0 == typeStr.CompareWithConversion("radio", PR_TRUE) ||
|
||||
0 == typeStr.CompareWithConversion("checkbox", PR_TRUE)) {
|
||||
if (NS_SUCCEEDED(rv = input->GetChecked(&isChecked))) {
|
||||
if (isChecked) {
|
||||
ret.AssignWithConversion("CHECKED");
|
||||
}
|
||||
else {
|
||||
ret.AssignWithConversion("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!OMDNI_didCall) {
|
||||
rv = node->GetNodeValue(ret);
|
||||
@@ -1002,6 +1019,25 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_NodeImpl_setNodeValue
|
||||
nsresult rv;
|
||||
|
||||
OMDNI_QUERY_AND_CALL(node, SetValue, *value)
|
||||
if (input) {
|
||||
nsAutoString typeStr;
|
||||
nsString empty;
|
||||
nsString val;
|
||||
|
||||
if (NS_SUCCEEDED(rv = input->GetType(typeStr))) {
|
||||
if (0 == typeStr.CompareWithConversion("radio", PR_TRUE) ||
|
||||
0 == typeStr.CompareWithConversion("checkbox", PR_TRUE)) {
|
||||
empty.AssignWithConversion("");
|
||||
val = *value;
|
||||
if (0 == empty.CompareWithConversion(val)) {
|
||||
input->SetChecked(PR_FALSE);
|
||||
}
|
||||
else {
|
||||
input->SetChecked(PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!OMDNI_didCall) {
|
||||
rv = node->SetNodeValue(*value);
|
||||
|
||||
Reference in New Issue
Block a user