summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-02-02 17:24:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-02 17:24:58 +0000
commit9cbd2dd8ff0812aae57a99d6a7dc285cc8b9e262 (patch)
tree1154231be2ecfddc3635f6e0e3f837e0dd70376d /fpdfsdk
parent48b47f48ae6c5e3206bc306f2215a82273d5a313 (diff)
downloadpdfium-9cbd2dd8ff0812aae57a99d6a7dc285cc8b9e262.tar.xz
Make global object function names clearer.
Also tidy some sub-expressions. Change-Id: Ieabd5f6cea60e8ec03c8ce5ebe372fc80b05a7bb Reviewed-on: https://pdfium-review.googlesource.com/25150 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp50
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h12
2 files changed, 36 insertions, 26 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index d47c145700..0833759429 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -984,34 +984,44 @@ bool CPDFXFA_DocEnvironment::SubmitInternal(CXFA_FFDoc* hDoc,
return true;
}
-bool CPDFXFA_DocEnvironment::SetGlobalProperty(CXFA_FFDoc* hDoc,
- const ByteStringView& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::SetPropertyInNonXFAGlobalObject(
+ CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
- if (!m_pContext->GetFormFillEnv() ||
- !m_pContext->GetFormFillEnv()->GetIJSRuntime()) {
- return false;
- }
+
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
- IJS_EventContext* pContext = pFormFillEnv->GetIJSRuntime()->NewEventContext();
- bool bRet = pFormFillEnv->GetIJSRuntime()->SetValueByName(szPropName, pValue);
- pFormFillEnv->GetIJSRuntime()->ReleaseEventContext(pContext);
+ if (!pFormFillEnv)
+ return false;
+
+ IJS_Runtime* pIJSRuntime = pFormFillEnv->GetIJSRuntime();
+ if (!pIJSRuntime)
+ return false;
+
+ IJS_EventContext* pContext = pIJSRuntime->NewEventContext();
+ bool bRet = pIJSRuntime->SetValueByNameInGlobalObject(szPropName, pValue);
+ pIJSRuntime->ReleaseEventContext(pContext);
return bRet;
}
-bool CPDFXFA_DocEnvironment::GetGlobalProperty(CXFA_FFDoc* hDoc,
- const ByteStringView& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::GetPropertyFromNonXFAGlobalObject(
+ CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
- if (!m_pContext->GetFormFillEnv() ||
- !m_pContext->GetFormFillEnv()->GetIJSRuntime()) {
- return false;
- }
+
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
- IJS_EventContext* pContext = pFormFillEnv->GetIJSRuntime()->NewEventContext();
- bool bRet = pFormFillEnv->GetIJSRuntime()->GetValueByName(szPropName, pValue);
- pFormFillEnv->GetIJSRuntime()->ReleaseEventContext(pContext);
+ if (!pFormFillEnv)
+ return false;
+
+ IJS_Runtime* pIJSRuntime = pFormFillEnv->GetIJSRuntime();
+ if (!pIJSRuntime)
+ return false;
+
+ IJS_EventContext* pContext = pIJSRuntime->NewEventContext();
+ bool bRet = pIJSRuntime->GetValueByNameFromGlobalObject(szPropName, pValue);
+ pIJSRuntime->ReleaseEventContext(pContext);
return bRet;
}
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 4e037210b2..03aae3d765 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -64,12 +64,12 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
bool Submit(CXFA_FFDoc* hDoc, CXFA_Submit* submit) override;
- bool GetGlobalProperty(CXFA_FFDoc* hDoc,
- const ByteStringView& szPropName,
- CFXJSE_Value* pValue) override;
- bool SetGlobalProperty(CXFA_FFDoc* hDoc,
- const ByteStringView& szPropName,
- CFXJSE_Value* pValue) override;
+ bool GetPropertyFromNonXFAGlobalObject(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) override;
+ bool SetPropertyInNonXFAGlobalObject(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) override;
RetainPtr<IFX_SeekableReadStream> OpenLinkedFile(
CXFA_FFDoc* hDoc,