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

Side by Side Diff: fpdfsdk/src/javascript/PublicMethods.cpp

Issue 1342223003: Merge to M46: Resolve bad cast to CJS_EventHandler (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2490
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 } 2016 }
2017 } 2017 }
2018 } 2018 }
2019 2019
2020 if (wcscmp(sFunction.c_str(), L"AVG") == 0 && nFieldsCount > 0) 2020 if (wcscmp(sFunction.c_str(), L"AVG") == 0 && nFieldsCount > 0)
2021 dValue /= nFieldsCount; 2021 dValue /= nFieldsCount;
2022 2022
2023 dValue = (double)floor(dValue * FXSYS_pow((double)10, (double)6) + 0.49) / 2023 dValue = (double)floor(dValue * FXSYS_pow((double)10, (double)6) + 0.49) /
2024 FXSYS_pow((double)10, (double)6); 2024 FXSYS_pow((double)10, (double)6);
2025 CJS_Value jsValue(isolate, dValue); 2025 CJS_Value jsValue(isolate, dValue);
2026 if ((CJS_EventHandler*)pContext->GetEventHandler()->m_pValue) 2026 if (pContext->GetEventHandler()->m_pValue)
2027 ((CJS_EventHandler*)pContext->GetEventHandler())->Value() = 2027 pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString();
2028 jsValue.ToCFXWideString();
2029 2028
2030 return TRUE; 2029 return TRUE;
2031 } 2030 }
2032 2031
2033 /* This function validates the current event to ensure that its value is 2032 /* This function validates the current event to ensure that its value is
2034 ** within the specified range. */ 2033 ** within the specified range. */
2035 2034
2036 FX_BOOL CJS_PublicMethods::AFRange_Validate(IFXJS_Context* cc, 2035 FX_BOOL CJS_PublicMethods::AFRange_Validate(IFXJS_Context* cc,
2037 const CJS_Parameters& params, 2036 const CJS_Parameters& params,
2038 CJS_Value& vRet, 2037 CJS_Value& vRet,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 nums.SetElement(nIndex, CJS_Value(isolate, sPart.c_str())); 2118 nums.SetElement(nIndex, CJS_Value(isolate, sPart.c_str()));
2120 } 2119 }
2121 2120
2122 if (nums.GetLength() > 0) 2121 if (nums.GetLength() > 0)
2123 vRet = nums; 2122 vRet = nums;
2124 else 2123 else
2125 vRet.SetNull(); 2124 vRet.SetNull();
2126 2125
2127 return TRUE; 2126 return TRUE;
2128 } 2127 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698