Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: fpdfsdk/src/javascript/Field.cpp

Issue 1603173004: Merge to XFA: Bugs in CJS_PublicMethods::ParseNumber(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | fpdfsdk/src/javascript/JS_Value.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/Field.cpp
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 7baefd111cbd2ed37edc07ebd8154cd08bd4a132..1b5551506988ff01d839af51883cc80fa21d1a4c 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -2737,19 +2737,7 @@ FX_BOOL Field::value(IJS_Context* cc,
return FALSE;
case FIELDTYPE_COMBOBOX:
case FIELDTYPE_TEXTFIELD: {
- CFX_WideString swValue = pFormField->GetValue();
-
- double dRet;
- FX_BOOL bDot;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet,
- bDot)) {
- if (bDot)
- vp << dRet;
- else
- vp << dRet;
- } else {
- vp << swValue;
- }
+ vp << pFormField->GetValue();
} break;
case FIELDTYPE_LISTBOX: {
if (pFormField->CountSelectedItems() > 1) {
@@ -2765,40 +2753,18 @@ FX_BOOL Field::value(IJS_Context* cc,
}
vp << ValueArray;
} else {
- CFX_WideString swValue = pFormField->GetValue();
-
- double dRet;
- FX_BOOL bDot;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet,
- bDot)) {
- if (bDot)
- vp << dRet;
- else
- vp << dRet;
- } else {
- vp << swValue;
- }
+ vp << pFormField->GetValue();
}
} break;
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON: {
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
- if (!pFormField->GetControl(i)->IsChecked())
- continue;
-
- CFX_WideString swValue = pFormField->GetControl(i)->GetExportValue();
- double dRet;
- FX_BOOL bDotDummy;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet,
- bDotDummy)) {
- vp << dRet;
- } else {
- vp << swValue;
+ if (pFormField->GetControl(i)->IsChecked()) {
+ vp << pFormField->GetControl(i)->GetExportValue();
+ bFind = true;
+ break;
}
-
- bFind = TRUE;
- break;
}
if (!bFind)
vp << L"Off";
@@ -2808,7 +2774,7 @@ FX_BOOL Field::value(IJS_Context* cc,
break;
}
}
-
+ vp.MaybeCoerceToNumber();
return TRUE;
}
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | fpdfsdk/src/javascript/JS_Value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698