summaryrefslogtreecommitdiff
path: root/fxjs/cjs_document.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-06 18:30:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-06 18:30:15 +0000
commitddaa40fe873070d3aae9a21b9a93848fc7e809f1 (patch)
tree222d228484da9e234a647254440e9aff98dca224 /fxjs/cjs_document.cpp
parent5caa34c64382d8587a3ec3de5edbb30976b1390d (diff)
downloadpdfium-ddaa40fe873070d3aae9a21b9a93848fc7e809f1.tar.xz
Stop using some v8::Context slot to find runtime.
Instead, use the object binding's pointer. Puts the cart back behind the horse. Change-Id: I4c06ae991b871c6e90b0e6c70b69886addca2354 Reviewed-on: https://pdfium-review.googlesource.com/33630 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r--fxjs/cjs_document.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 3022519293..d6dc4d6020 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -254,12 +254,12 @@ CJS_Return CJS_Document::getField(
if (pFieldObj.IsEmpty())
return CJS_Return(false);
- CJS_Field* pJSField =
- static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj));
- pJSField->AttachField(this, wideName);
+ auto* pJSField =
+ static_cast<CJS_Field*>(CFXJS_Engine::GetObjectPrivate(pFieldObj));
if (!pJSField)
return CJS_Return(false);
+ pJSField->AttachField(this, wideName);
return CJS_Return(pJSField->ToV8Object());
}
@@ -362,7 +362,7 @@ CJS_Return CJS_Document::print(
if (CFXJS_Engine::GetObjDefnID(pObj) ==
CJS_PrintParamsObj::GetObjDefnID()) {
v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8]);
- CJS_Object* pJSObj = pRuntime->GetObjectPrivate(pObj);
+ CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(pObj);
if (pJSObj) {
CJS_PrintParamsObj* printObj =
static_cast<CJS_PrintParamsObj*>(pJSObj);
@@ -1013,8 +1013,7 @@ CJS_Return CJS_Document::getAnnot(
CPDFSDK_AnnotIteration annotIteration(pPageView, false);
CPDFSDK_BAAnnot* pSDKBAAnnot = nullptr;
for (const auto& pSDKAnnotCur : annotIteration) {
- CPDFSDK_BAAnnot* pBAAnnot =
- static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get());
+ auto* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get());
if (pBAAnnot && pBAAnnot->GetAnnotName() == swAnnotName) {
pSDKBAAnnot = pBAAnnot;
break;
@@ -1028,8 +1027,8 @@ CJS_Return CJS_Document::getAnnot(
if (pObj.IsEmpty())
return CJS_Return(false);
- CJS_Annot* pJS_Annot =
- static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj));
+ auto* pJS_Annot =
+ static_cast<CJS_Annot*>(CFXJS_Engine::GetObjectPrivate(pObj));
if (!pJS_Annot)
return CJS_Return(false);
@@ -1063,8 +1062,8 @@ CJS_Return CJS_Document::getAnnots(
if (pObj.IsEmpty())
return CJS_Return(false);
- CJS_Annot* pJS_Annot =
- static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj));
+ auto* pJS_Annot =
+ static_cast<CJS_Annot*>(CFXJS_Engine::GetObjectPrivate(pObj));
pJS_Annot->SetSDKAnnot(static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get()));
pRuntime->PutArrayElement(
annots, i,
@@ -1119,7 +1118,7 @@ CJS_Return CJS_Document::addIcon(
return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
v8::Local<v8::Object> pObj = pRuntime->ToObject(params[1]);
- CJS_Object* obj = pRuntime->GetObjectPrivate(pObj);
+ CJS_Object* obj = CFXJS_Engine::GetObjectPrivate(pObj);
if (!obj)
return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
@@ -1140,8 +1139,8 @@ CJS_Return CJS_Document::get_icons(CJS_Runtime* pRuntime) {
if (pObj.IsEmpty())
return CJS_Return(false);
- CJS_Icon* pJS_Icon =
- static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
+ auto* pJS_Icon =
+ static_cast<CJS_Icon*>(CFXJS_Engine::GetObjectPrivate(pObj));
pJS_Icon->SetIconName(name);
pRuntime->PutArrayElement(Icons, i++,
pJS_Icon
@@ -1172,12 +1171,12 @@ CJS_Return CJS_Document::getIcon(
if (pObj.IsEmpty())
return CJS_Return(false);
- CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
- if (!pJS_Icon)
+ auto* pJSIcon = static_cast<CJS_Icon*>(CFXJS_Engine::GetObjectPrivate(pObj));
+ if (!pJSIcon)
return CJS_Return(false);
- pJS_Icon->SetIconName(*it);
- return CJS_Return(pJS_Icon->ToV8Object());
+ pJSIcon->SetIconName(*it);
+ return CJS_Return(pJSIcon->ToV8Object());
}
CJS_Return CJS_Document::removeIcon(