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

Side by Side Diff: xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp

Issue 2026993003: Remove FXJSE_Value_ToObject and call methods directly (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@context_cleanup_3
Patch Set: Created 4 years, 6 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
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 "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h"
8 8
9 #include "xfa/fxfa/app/xfa_ffnotify.h" 9 #include "xfa/fxfa/app/xfa_ffnotify.h"
10 #include "xfa/fxfa/parser/xfa_doclayout.h" 10 #include "xfa/fxfa/parser/xfa_doclayout.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return; 302 return;
303 } 303 }
304 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 304 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
305 if (!pNotify) { 305 if (!pNotify) {
306 return; 306 return;
307 } 307 }
308 CXFA_Node* pNode = NULL; 308 CXFA_Node* pNode = NULL;
309 if (iLength >= 1) { 309 if (iLength >= 1) {
310 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 310 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
311 if (FXJSE_Value_IsObject(pValue.get())) { 311 if (FXJSE_Value_IsObject(pValue.get())) {
312 pNode = 312 pNode = pValue.get()->ToNode(nullptr);
313 static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue.get(), nullptr));
314 } else if (FXJSE_Value_IsUTF8String(pValue.get())) { 313 } else if (FXJSE_Value_IsUTF8String(pValue.get())) {
315 CFX_ByteString bsString; 314 CFX_ByteString bsString;
316 FXJSE_Value_ToUTF8String(pValue.get(), bsString); 315 FXJSE_Value_ToUTF8String(pValue.get(), bsString);
317 CFX_WideString wsExpression = 316 CFX_WideString wsExpression =
318 CFX_WideString::FromUTF8(bsString.AsStringC()); 317 CFX_WideString::FromUTF8(bsString.AsStringC());
319 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 318 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
320 if (!pScriptContext) 319 if (!pScriptContext)
321 return; 320 return;
322 321
323 CXFA_Object* pObject = pScriptContext->GetThisObject(); 322 CXFA_Object* pObject = pScriptContext->GetThisObject();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 return; 499 return;
501 } 500 }
502 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 501 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
503 if (!pNotify) { 502 if (!pNotify) {
504 return; 503 return;
505 } 504 }
506 CXFA_Node* pNode = NULL; 505 CXFA_Node* pNode = NULL;
507 if (iLength >= 1) { 506 if (iLength >= 1) {
508 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 507 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
509 if (FXJSE_Value_IsObject(pValue.get())) { 508 if (FXJSE_Value_IsObject(pValue.get())) {
510 pNode = 509 pNode = pValue.get()->ToNode(nullptr);
511 static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue.get(), nullptr));
512 } else if (FXJSE_Value_IsUTF8String(pValue.get())) { 510 } else if (FXJSE_Value_IsUTF8String(pValue.get())) {
513 CFX_ByteString bsString; 511 CFX_ByteString bsString;
514 FXJSE_Value_ToUTF8String(pValue.get(), bsString); 512 FXJSE_Value_ToUTF8String(pValue.get(), bsString);
515 CFX_WideString wsExpression = 513 CFX_WideString wsExpression =
516 CFX_WideString::FromUTF8(bsString.AsStringC()); 514 CFX_WideString::FromUTF8(bsString.AsStringC());
517 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 515 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
518 if (!pScriptContext) 516 if (!pScriptContext)
519 return; 517 return;
520 518
521 CXFA_Object* pObject = pScriptContext->GetThisObject(); 519 CXFA_Object* pObject = pScriptContext->GetThisObject();
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 782 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
785 if (!pNotify) { 783 if (!pNotify) {
786 return; 784 return;
787 } 785 }
788 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); 786 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
789 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 787 CFXJSE_Value* pValue = pArguments->GetReturnValue();
790 if (pValue) { 788 if (pValue) {
791 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsDataTime).AsStringC()); 789 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsDataTime).AsStringC());
792 } 790 }
793 } 791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698