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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 nFieldsCount++; | 2155 nFieldsCount++; |
2156 } | 2156 } |
2157 } | 2157 } |
2158 } | 2158 } |
2159 | 2159 |
2160 if (wcscmp(sFunction.c_str(), L"AVG") == 0 && nFieldsCount > 0) | 2160 if (wcscmp(sFunction.c_str(), L"AVG") == 0 && nFieldsCount > 0) |
2161 dValue /= nFieldsCount; | 2161 dValue /= nFieldsCount; |
2162 | 2162 |
2163 dValue = (double)floor(dValue * FXSYS_pow((double)10,(double)6) + 0.49)
/ FXSYS_pow((double)10,(double)6); | 2163 dValue = (double)floor(dValue * FXSYS_pow((double)10,(double)6) + 0.49)
/ FXSYS_pow((double)10,(double)6); |
2164 CJS_Value jsValue(isolate,dValue); | 2164 CJS_Value jsValue(isolate,dValue); |
2165 » if((CJS_EventHandler*)pContext->GetEventHandler()->m_pValue) | 2165 » if(pContext->GetEventHandler()->m_pValue) |
2166 » » ((CJS_EventHandler*)pContext->GetEventHandler())->Value() = jsVa
lue.ToCFXWideString(); | 2166 » » pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString()
; |
2167 | 2167 |
2168 return TRUE; | 2168 return TRUE; |
2169 } | 2169 } |
2170 | 2170 |
2171 /* This function validates the current event to ensure that its value is | 2171 /* This function validates the current event to ensure that its value is |
2172 ** within the specified range. */ | 2172 ** within the specified range. */ |
2173 | 2173 |
2174 FX_BOOL CJS_PublicMethods::AFRange_Validate(IFXJS_Context* cc, const CJS_Paramet
ers& params, CJS_Value& vRet, CFX_WideString& sError) | 2174 FX_BOOL CJS_PublicMethods::AFRange_Validate(IFXJS_Context* cc, const CJS_Paramet
ers& params, CJS_Value& vRet, CFX_WideString& sError) |
2175 { | 2175 { |
2176 CJS_Context* pContext = (CJS_Context *)cc; | 2176 CJS_Context* pContext = (CJS_Context *)cc; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); | 2267 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); |
2268 } | 2268 } |
2269 | 2269 |
2270 if (nums.GetLength() > 0) | 2270 if (nums.GetLength() > 0) |
2271 vRet = nums; | 2271 vRet = nums; |
2272 else | 2272 else |
2273 vRet.SetNull(); | 2273 vRet.SetNull(); |
2274 | 2274 |
2275 return TRUE; | 2275 return TRUE; |
2276 } | 2276 } |
OLD | NEW |