OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (bDot) return FALSE; | 90 if (bDot) return FALSE; |
91 bDot = TRUE; | 91 bDot = TRUE; |
92 } | 92 } |
93 else if (c == '-' || c == '+') | 93 else if (c == '-' || c == '+') |
94 { | 94 { |
95 if (p != pTrim) | 95 if (p != pTrim) |
96 return FALSE; | 96 return FALSE; |
97 } | 97 } |
98 else if (c == 'e' || c == 'E') | 98 else if (c == 'e' || c == 'E') |
99 { | 99 { |
100 » » » if (bKXJS) return FALSE; | 100 » » » if (bKXJS) |
| 101 return FALSE; |
101 | 102 |
102 p++; | 103 p++; |
103 c = *p; | 104 c = *p; |
104 if (c == '+' || c == '-') | 105 if (c == '+' || c == '-') |
105 { | 106 { |
106 bKXJS = TRUE; | 107 bKXJS = TRUE; |
107 } | 108 } |
108 else | 109 else |
109 { | 110 { |
110 return FALSE; | 111 return FALSE; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 { | 162 { |
162 return ch == L'9' || ch == L'A' || ch == L'O' || ch == L'X'; | 163 return ch == L'9' || ch == L'A' || ch == L'O' || ch == L'X'; |
163 } | 164 } |
164 | 165 |
165 double CJS_PublicMethods::AF_Simple(const FX_WCHAR* sFuction, double dValue1, do
uble dValue2) | 166 double CJS_PublicMethods::AF_Simple(const FX_WCHAR* sFuction, double dValue1, do
uble dValue2) |
166 { | 167 { |
167 if (FXSYS_wcsicmp(sFuction,L"AVG") == 0 || FXSYS_wcsicmp(sFuction,L"SUM"
) == 0) | 168 if (FXSYS_wcsicmp(sFuction,L"AVG") == 0 || FXSYS_wcsicmp(sFuction,L"SUM"
) == 0) |
168 { | 169 { |
169 return dValue1 + dValue2; | 170 return dValue1 + dValue2; |
170 } | 171 } |
171 » else if (FXSYS_wcsicmp(sFuction, L"PRD") == 0) | 172 » if (FXSYS_wcsicmp(sFuction, L"PRD") == 0) |
172 { | 173 { |
173 return dValue1 * dValue2; | 174 return dValue1 * dValue2; |
174 } | 175 } |
175 » else if (FXSYS_wcsicmp(sFuction,L"MIN") == 0) | 176 » if (FXSYS_wcsicmp(sFuction,L"MIN") == 0) |
176 { | 177 { |
177 return FX_MIN(dValue1, dValue2); | 178 return FX_MIN(dValue1, dValue2); |
178 } | 179 } |
179 » else if (FXSYS_wcsicmp(sFuction,L"MAX") == 0) | 180 » if (FXSYS_wcsicmp(sFuction,L"MAX") == 0) |
180 { | 181 { |
181 return FX_MAX(dValue1, dValue2); | 182 return FX_MAX(dValue1, dValue2); |
182 } | 183 } |
183 | |
184 return dValue1; | 184 return dValue1; |
185 } | 185 } |
186 | 186 |
187 CFX_WideString CJS_PublicMethods::StrLTrim(const FX_WCHAR* pStr) | 187 CFX_WideString CJS_PublicMethods::StrLTrim(const FX_WCHAR* pStr) |
188 { | 188 { |
189 while (*pStr && *pStr == L' ') pStr++; | 189 while (*pStr && *pStr == L' ') pStr++; |
190 | 190 |
191 return pStr; | 191 return pStr; |
192 } | 192 } |
193 | 193 |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 for (std::wstring::iterator it = w_strChange2.begin(); it != w_strChange
2.end(); it++) | 1301 for (std::wstring::iterator it = w_strChange2.begin(); it != w_strChange
2.end(); it++) |
1302 { | 1302 { |
1303 if (*it == cSep) | 1303 if (*it == cSep) |
1304 { | 1304 { |
1305 if (bHasSep) | 1305 if (bHasSep) |
1306 { | 1306 { |
1307 FX_BOOL &bRc = pEvent->Rc(); | 1307 FX_BOOL &bRc = pEvent->Rc(); |
1308 bRc = FALSE; | 1308 bRc = FALSE; |
1309 return TRUE; | 1309 return TRUE; |
1310 } | 1310 } |
1311 » » » else | 1311 bHasSep = TRUE; |
1312 » » » { | 1312 continue; |
1313 » » » » bHasSep = TRUE; | |
1314 » » » » continue; | |
1315 » » » } | |
1316 } | 1313 } |
1317 if (*it == L'-') | 1314 if (*it == L'-') |
1318 { | 1315 { |
1319 if (bHasSign) | 1316 if (bHasSign) |
1320 { | 1317 { |
1321 FX_BOOL &bRc = pEvent->Rc(); | 1318 FX_BOOL &bRc = pEvent->Rc(); |
1322 bRc = FALSE; | 1319 bRc = FALSE; |
1323 return TRUE; | 1320 return TRUE; |
1324 } | 1321 } |
1325 » » » else if (it != w_strChange2.begin()) //sign's position i
s not correct | 1322 » » » if (it != w_strChange2.begin()) //sign's position is not
correct |
1326 { | 1323 { |
1327 FX_BOOL &bRc = pEvent->Rc(); | 1324 FX_BOOL &bRc = pEvent->Rc(); |
1328 bRc = FALSE; | 1325 bRc = FALSE; |
1329 return TRUE; | 1326 return TRUE; |
1330 } | 1327 } |
1331 » » » else if (pEvent->SelStart() != 0) | 1328 » » » if (pEvent->SelStart() != 0) |
1332 { | 1329 { |
1333 FX_BOOL &bRc = pEvent->Rc(); | 1330 FX_BOOL &bRc = pEvent->Rc(); |
1334 bRc = FALSE; | 1331 bRc = FALSE; |
1335 return TRUE; | 1332 return TRUE; |
1336 } | 1333 } |
1337 bHasSign = TRUE; | 1334 bHasSign = TRUE; |
1338 continue; | 1335 continue; |
1339 } | 1336 } |
1340 | 1337 |
1341 if (!IsDigit(*it)) | 1338 if (!IsDigit(*it)) |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); | 2264 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); |
2268 } | 2265 } |
2269 | 2266 |
2270 if (nums.GetLength() > 0) | 2267 if (nums.GetLength() > 0) |
2271 vRet = nums; | 2268 vRet = nums; |
2272 else | 2269 else |
2273 vRet.SetNull(); | 2270 vRet.SetNull(); |
2274 | 2271 |
2275 return TRUE; | 2272 return TRUE; |
2276 } | 2273 } |
OLD | NEW |