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

Side by Side Diff: fpdfsdk/javascript/cjs_runtime.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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 | « fpdfsdk/javascript/cjs_runtime.h ('k') | fpdfsdk/javascript/color.h » ('j') | 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 "fpdfsdk/javascript/cjs_runtime.h" 7 #include "fpdfsdk/javascript/cjs_runtime.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) { 218 void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) {
219 m_FieldEventSet.erase(event); 219 m_FieldEventSet.erase(event);
220 } 220 }
221 221
222 #ifdef PDF_ENABLE_XFA 222 #ifdef PDF_ENABLE_XFA
223 CFX_WideString ChangeObjName(const CFX_WideString& str) { 223 CFX_WideString ChangeObjName(const CFX_WideString& str) {
224 CFX_WideString sRet = str; 224 CFX_WideString sRet = str;
225 sRet.Replace(L"_", L"."); 225 sRet.Replace(L"_", L".");
226 return sRet; 226 return sRet;
227 } 227 }
228 FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, 228 bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
229 CFXJSE_Value* pValue) { 229 CFXJSE_Value* pValue) {
230 const FX_CHAR* name = utf8Name.c_str(); 230 const FX_CHAR* name = utf8Name.c_str();
231 231
232 v8::Isolate::Scope isolate_scope(GetIsolate()); 232 v8::Isolate::Scope isolate_scope(GetIsolate());
233 v8::HandleScope handle_scope(GetIsolate()); 233 v8::HandleScope handle_scope(GetIsolate());
234 v8::Local<v8::Context> context = NewLocalContext(); 234 v8::Local<v8::Context> context = NewLocalContext();
235 v8::Context::Scope context_scope(context); 235 v8::Context::Scope context_scope(context);
236 236
237 v8::Local<v8::Value> propvalue = 237 v8::Local<v8::Value> propvalue =
238 context->Global()->Get(v8::String::NewFromUtf8( 238 context->Global()->Get(v8::String::NewFromUtf8(
239 GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength())); 239 GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength()));
240 240
241 if (propvalue.IsEmpty()) { 241 if (propvalue.IsEmpty()) {
242 pValue->SetUndefined(); 242 pValue->SetUndefined();
243 return FALSE; 243 return false;
244 } 244 }
245 pValue->ForceSetValue(propvalue); 245 pValue->ForceSetValue(propvalue);
246 return TRUE; 246 return true;
247 } 247 }
248 FX_BOOL CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, 248 bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
249 CFXJSE_Value* pValue) { 249 CFXJSE_Value* pValue) {
250 if (utf8Name.IsEmpty() || !pValue) 250 if (utf8Name.IsEmpty() || !pValue)
251 return FALSE; 251 return false;
252 const FX_CHAR* name = utf8Name.c_str(); 252 const FX_CHAR* name = utf8Name.c_str();
253 v8::Isolate* pIsolate = GetIsolate(); 253 v8::Isolate* pIsolate = GetIsolate();
254 v8::Isolate::Scope isolate_scope(pIsolate); 254 v8::Isolate::Scope isolate_scope(pIsolate);
255 v8::HandleScope handle_scope(pIsolate); 255 v8::HandleScope handle_scope(pIsolate);
256 v8::Local<v8::Context> context = NewLocalContext(); 256 v8::Local<v8::Context> context = NewLocalContext();
257 v8::Context::Scope context_scope(context); 257 v8::Context::Scope context_scope(context);
258 258
259 // v8::Local<v8::Context> tmpCotext = 259 // v8::Local<v8::Context> tmpCotext =
260 // v8::Local<v8::Context>::New(GetIsolate(), m_context); 260 // v8::Local<v8::Context>::New(GetIsolate(), m_context);
261 v8::Local<v8::Value> propvalue = 261 v8::Local<v8::Value> propvalue =
262 v8::Local<v8::Value>::New(GetIsolate(), pValue->DirectGetValue()); 262 v8::Local<v8::Value>::New(GetIsolate(), pValue->DirectGetValue());
263 context->Global()->Set( 263 context->Global()->Set(
264 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, 264 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString,
265 utf8Name.GetLength()), 265 utf8Name.GetLength()),
266 propvalue); 266 propvalue);
267 return TRUE; 267 return true;
268 } 268 }
269 #endif 269 #endif
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/cjs_runtime.h ('k') | fpdfsdk/javascript/color.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698