Chromium Code Reviews| 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 "xfa/fxfa/fm2js/xfa_simpleexpression.h" | 7 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 | 10 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 533 |
| 534 void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { | 534 void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { |
| 535 CFX_WideTextBuf funcName; | 535 CFX_WideTextBuf funcName; |
| 536 m_pExp->ToJavaScript(funcName); | 536 m_pExp->ToJavaScript(funcName); |
| 537 if (m_bIsSomMethod) { | 537 if (m_bIsSomMethod) { |
| 538 javascript << funcName; | 538 javascript << funcName; |
| 539 javascript << FX_WSTRC(L"("); | 539 javascript << FX_WSTRC(L"("); |
| 540 if (m_pArguments) { | 540 if (m_pArguments) { |
| 541 uint32_t methodPara = IsMethodWithObjParam(funcName.AsStringC()); | 541 uint32_t methodPara = IsMethodWithObjParam(funcName.AsStringC()); |
| 542 if (methodPara > 0) { | 542 if (methodPara > 0) { |
| 543 for (int i = 0; i < m_pArguments->GetSize(); ++i) { | 543 for (int i = 0; i < m_pArguments->GetSize(); ++i) { |
|
Lei Zhang
2016/08/03 16:43:23
So is it the case that m_pArguments->GetSize() can
dsinclair
2016/08/03 16:55:36
The spec for formcalc doesn't mention a limit on t
| |
| 544 if ((methodPara & (0x01 << i)) > 0) { | 544 // Currently none of our expressions use objects for a parameter over |
| 545 // the 6th. Make sure we don't overflow the shift when doing this | |
| 546 // check. If we ever need more the 32 object params we can revisit. | |
| 547 if (i < 32 && (methodPara & (0x01 << i)) > 0) { | |
| 545 javascript << gs_lpStrExpFuncName[GETFMJSOBJ]; | 548 javascript << gs_lpStrExpFuncName[GETFMJSOBJ]; |
| 546 } else { | 549 } else { |
| 547 javascript << gs_lpStrExpFuncName[GETFMVALUE]; | 550 javascript << gs_lpStrExpFuncName[GETFMVALUE]; |
| 548 } | 551 } |
| 549 javascript << FX_WSTRC(L"("); | 552 javascript << FX_WSTRC(L"("); |
| 550 CXFA_FMSimpleExpression* e = m_pArguments->GetAt(i); | 553 CXFA_FMSimpleExpression* e = m_pArguments->GetAt(i); |
| 551 e->ToJavaScript(javascript); | 554 e->ToJavaScript(javascript); |
| 552 javascript << FX_WSTRC(L")"); | 555 javascript << FX_WSTRC(L")"); |
| 553 if (i + 1 < m_pArguments->GetSize()) { | 556 if (i + 1 < m_pArguments->GetSize()) { |
| 554 javascript << FX_WSTRC(L", "); | 557 javascript << FX_WSTRC(L", "); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n"); | 746 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n"); |
| 744 javascript << FX_WSTRC(L"method_return_value = accessor_object[index]."); | 747 javascript << FX_WSTRC(L"method_return_value = accessor_object[index]."); |
| 745 m_pExp2->ToJavaScript(javascript); | 748 m_pExp2->ToJavaScript(javascript); |
| 746 javascript << FX_WSTRC(L";\n}\n}\n"); | 749 javascript << FX_WSTRC(L";\n}\n}\n"); |
| 747 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object."); | 750 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object."); |
| 748 m_pExp2->ToJavaScript(javascript); | 751 m_pExp2->ToJavaScript(javascript); |
| 749 javascript << FX_WSTRC(L";\n}\n"); | 752 javascript << FX_WSTRC(L";\n}\n"); |
| 750 javascript << FX_WSTRC(L"return method_return_value;\n"); | 753 javascript << FX_WSTRC(L"return method_return_value;\n"); |
| 751 javascript << FX_WSTRC(L"}\n).call(this)"); | 754 javascript << FX_WSTRC(L"}\n).call(this)"); |
| 752 } | 755 } |
| OLD | NEW |