summaryrefslogtreecommitdiff
path: root/fxjs/cjs_document.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-07-11 17:23:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-11 17:23:53 +0000
commitb165ffb64e59998ec6d5f76c82bd2fe53734b3cd (patch)
tree2d1de5e7dc0fc4b6a4e1fbaa8437e57f9acfd4e8 /fxjs/cjs_document.cpp
parent7c694a4632dc3b11e26d66a44e598a211913d02a (diff)
downloadpdfium-b165ffb64e59998ec6d5f76c82bd2fe53734b3cd.tar.xz
Use JSGetObject() in more places.chromium/3489
Change-Id: I7f26709bdad56cc2712f21e8e644be7c53ec5ec4 Reviewed-on: https://pdfium-review.googlesource.com/37513 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r--fxjs/cjs_document.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 35e3e53437..f5b0af4c13 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -354,22 +354,16 @@ CJS_Return CJS_Document::print(
if (nLength == 9) {
if (params[8]->IsObject()) {
v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8]);
- if (CFXJS_Engine::GetObjDefnID(pObj) ==
- CJS_PrintParamsObj::GetObjDefnID()) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8]);
- CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(pObj);
- if (pJSObj) {
- CJS_PrintParamsObj* printObj =
- static_cast<CJS_PrintParamsObj*>(pJSObj);
- bUI = printObj->GetUI();
- nStart = printObj->GetStart();
- nEnd = printObj->GetEnd();
- bSilent = printObj->GetSilent();
- bShrinkToFit = printObj->GetShrinkToFit();
- bPrintAsImage = printObj->GetPrintAsImage();
- bReverse = printObj->GetReverse();
- bAnnotations = printObj->GetAnnotations();
- }
+ CJS_PrintParamsObj* pPrintObj = JSGetObject<CJS_PrintParamsObj>(pObj);
+ if (pPrintObj) {
+ bUI = pPrintObj->GetUI();
+ nStart = pPrintObj->GetStart();
+ nEnd = pPrintObj->GetEnd();
+ bSilent = pPrintObj->GetSilent();
+ bShrinkToFit = pPrintObj->GetShrinkToFit();
+ bPrintAsImage = pPrintObj->GetPrintAsImage();
+ bReverse = pPrintObj->GetReverse();
+ bAnnotations = pPrintObj->GetAnnotations();
}
}
} else {
@@ -1109,13 +1103,8 @@ CJS_Return CJS_Document::addIcon(
if (!params[1]->IsObject())
return CJS_Return(JSMessage::kTypeError);
- v8::Local<v8::Object> pJSIcon = pRuntime->ToObject(params[1]);
- if (CFXJS_Engine::GetObjDefnID(pJSIcon) != CJS_Icon::GetObjDefnID())
- return CJS_Return(JSMessage::kTypeError);
-
v8::Local<v8::Object> pObj = pRuntime->ToObject(params[1]);
- CJS_Object* obj = CFXJS_Engine::GetObjectPrivate(pObj);
- if (!obj)
+ if (!JSGetObject<CJS_Icon>(pObj))
return CJS_Return(JSMessage::kTypeError);
WideString swIconName = pRuntime->ToWideString(params[0]);