diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-03-27 16:27:34 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-27 16:27:34 +0000 |
commit | 1f12904e10b3dcfde861f4befeaec34519f2d6d4 (patch) | |
tree | 8c0ec0dfbf60277c7db9332b9932e3cac4501588 | |
parent | c90adc58b97200d20b0532bde95b79dcba00637f (diff) | |
download | pdfium-1f12904e10b3dcfde861f4befeaec34519f2d6d4.tar.xz |
Remove CXFA_FFNotify proxy methods
This CL removes proxy methods from CXFA_FFNotify and calls them
directly.
Change-Id: I1fecc625e0b81b659baeffc9ca567c5c20e12c23
Reviewed-on: https://pdfium-review.googlesource.com/29252
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 11 | ||||
-rw-r--r-- | fxjs/xfa/cjx_hostpseudomodel.cpp | 54 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffnotify.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffnotify.h | 4 |
4 files changed, 32 insertions, 49 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index da117f5272..c634c72a43 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -18,6 +18,7 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_eventparam.h" +#include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" @@ -202,8 +203,9 @@ void CFXJSE_Engine::GlobalPropertySetter(CFXJSE_Value* pObject, if (!pNotify) return; - pNotify->GetDocEnvironment()->SetPropertyInNonXFAGlobalObject( - pNotify->GetHDOC(), szPropName, pValue); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); + hDoc->GetDocEnvironment()->SetPropertyInNonXFAGlobalObject(hDoc, szPropName, + pValue); } void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, @@ -259,8 +261,9 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, if (!pNotify) return; - pNotify->GetDocEnvironment()->GetPropertyFromNonXFAGlobalObject( - pNotify->GetHDOC(), szPropName, pValue); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); + hDoc->GetDocEnvironment()->GetPropertyFromNonXFAGlobalObject(hDoc, szPropName, + pValue); } int32_t CFXJSE_Engine::GlobalPropTypeGetter(CFXJSE_Value* pOriginalValue, diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp index 37c639f6e4..6ca431e78d 100644 --- a/fxjs/xfa/cjx_hostpseudomodel.cpp +++ b/fxjs/xfa/cjx_hostpseudomodel.cpp @@ -12,6 +12,7 @@ #include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" +#include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cscript_hostpseudomodel.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" @@ -93,11 +94,11 @@ void CJX_HostPseudoModel::calculationsEnabled(CFXJSE_Value* pValue, CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocEnvironment()->SetCalculationsEnabled(hDoc, - pValue->ToBoolean()); + hDoc->GetDocEnvironment()->SetCalculationsEnabled(hDoc, + pValue->ToBoolean()); return; } - pValue->SetBoolean(pNotify->GetDocEnvironment()->IsCalculationsEnabled(hDoc)); + pValue->SetBoolean(hDoc->GetDocEnvironment()->IsCalculationsEnabled(hDoc)); } void CJX_HostPseudoModel::currentPage(CFXJSE_Value* pValue, @@ -109,10 +110,10 @@ void CJX_HostPseudoModel::currentPage(CFXJSE_Value* pValue, CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, pValue->ToInteger()); + hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, pValue->ToInteger()); return; } - pValue->SetInteger(pNotify->GetDocEnvironment()->GetCurrentPage(hDoc)); + pValue->SetInteger(hDoc->GetDocEnvironment()->GetCurrentPage(hDoc)); } void CJX_HostPseudoModel::language(CFXJSE_Value* pValue, @@ -142,7 +143,7 @@ void CJX_HostPseudoModel::numPages(CFXJSE_Value* pValue, ThrowException(L"Unable to set numPages value."); return; } - pValue->SetInteger(pNotify->GetDocEnvironment()->CountPages(hDoc)); + pValue->SetInteger(hDoc->GetDocEnvironment()->CountPages(hDoc)); } void CJX_HostPseudoModel::platform(CFXJSE_Value* pValue, @@ -172,12 +173,12 @@ void CJX_HostPseudoModel::title(CFXJSE_Value* pValue, CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocEnvironment()->SetTitle(hDoc, pValue->ToWideString()); + hDoc->GetDocEnvironment()->SetTitle(hDoc, pValue->ToWideString()); return; } WideString wsTitle; - pNotify->GetDocEnvironment()->GetTitle(hDoc, wsTitle); + hDoc->GetDocEnvironment()->GetTitle(hDoc, wsTitle); pValue->SetString(wsTitle.UTF8Encode().AsStringView()); } @@ -190,12 +191,11 @@ void CJX_HostPseudoModel::validationsEnabled(CFXJSE_Value* pValue, CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocEnvironment()->SetValidationsEnabled(hDoc, - pValue->ToBoolean()); + hDoc->GetDocEnvironment()->SetValidationsEnabled(hDoc, pValue->ToBoolean()); return; } - bool bEnabled = pNotify->GetDocEnvironment()->IsValidationsEnabled(hDoc); + bool bEnabled = hDoc->GetDocEnvironment()->IsValidationsEnabled(hDoc); pValue->SetBoolean(bEnabled); } @@ -205,10 +205,6 @@ void CJX_HostPseudoModel::variation(CFXJSE_Value* pValue, if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; - CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); - if (!pNotify) - return; - if (bSetting) { ThrowException(L"Unable to set variation value."); return; @@ -219,10 +215,6 @@ void CJX_HostPseudoModel::variation(CFXJSE_Value* pValue, void CJX_HostPseudoModel::version(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { - CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); - if (!pNotify) - return; - if (bSetting) { ThrowException(L"Unable to set version value."); return; @@ -260,7 +252,7 @@ CJS_Return CJX_HostPseudoModel::gotoURL( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); WideString URL = runtime->ToWideString(params[0]); - pNotify->GetDocEnvironment()->GotoURL(hDoc, URL); + hDoc->GetDocEnvironment()->GotoURL(hDoc, URL); return CJS_Return(true); } @@ -307,11 +299,12 @@ CJS_Return CJX_HostPseudoModel::openList( return CJS_Return(true); CXFA_FFWidget* hWidget = - pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + XFA_GetWidgetFromLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) return CJS_Return(true); - pNotify->GetDocEnvironment()->SetFocusWidget(pNotify->GetHDOC(), hWidget); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); + hDoc->GetDocEnvironment()->SetFocusWidget(hDoc, hWidget); pNotify->OpenDropDownList(hWidget); return CJS_Return(true); } @@ -562,8 +555,8 @@ CJS_Return CJX_HostPseudoModel::print( int32_t nStartPage = runtime->ToInt32(params[1]); int32_t nEndPage = runtime->ToInt32(params[2]); - pNotify->GetDocEnvironment()->Print(pNotify->GetHDOC(), nStartPage, nEndPage, - dwOptions); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); + hDoc->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions); return CJS_Return(true); } @@ -594,7 +587,8 @@ CJS_Return CJX_HostPseudoModel::exportData( if (params.size() >= 2) XDP = runtime->ToBoolean(params[1]); - pNotify->GetDocEnvironment()->ExportData(pNotify->GetHDOC(), filePath, XDP); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); + hDoc->GetDocEnvironment()->ExportData(hDoc, filePath, XDP); return CJS_Return(true); } @@ -606,13 +600,13 @@ CJS_Return CJX_HostPseudoModel::pageUp( return CJS_Return(true); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t nCurPage = pNotify->GetDocEnvironment()->GetCurrentPage(hDoc); + int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) return CJS_Return(true); nNewPage = nCurPage - 1; - pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); + hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); return CJS_Return(true); } @@ -624,8 +618,8 @@ CJS_Return CJX_HostPseudoModel::pageDown( return CJS_Return(true); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t nCurPage = pNotify->GetDocEnvironment()->GetCurrentPage(hDoc); - int32_t nPageCount = pNotify->GetDocEnvironment()->CountPages(hDoc); + int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc); + int32_t nPageCount = hDoc->GetDocEnvironment()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) return CJS_Return(true); @@ -635,6 +629,6 @@ CJS_Return CJX_HostPseudoModel::pageDown( else nNewPage = nCurPage + 1; - pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); + hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); return CJS_Return(true); } diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 187d1a4ced..5ba699b168 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -233,14 +233,6 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { pDocView->AddValidateNode(pNode); } -CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { - return m_pDoc.Get(); -} - -IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const { - return m_pDoc->GetDocEnvironment(); -} - IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { return m_pDoc->GetApp()->GetAppProvider(); } @@ -250,10 +242,6 @@ CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { return pDocView ? pDocView->GetWidgetHandler() : nullptr; } -CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { - return XFA_GetWidgetFromLayoutItem(pLayoutItem); -} - void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { if (hWidget->GetNode()->GetFFWidgetType() != XFA_FFWidgetType::kChoiceList) return; diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h index f3f9093cbc..e61b00ebfe 100644 --- a/xfa/fxfa/cxfa_ffnotify.h +++ b/xfa/fxfa/cxfa_ffnotify.h @@ -58,11 +58,9 @@ class CXFA_FFNotify { bool bIsFormReady, bool bRecursive); void AddCalcValidate(CXFA_Node* pNode); - CXFA_FFDoc* GetHDOC(); - IXFA_DocEnvironment* GetDocEnvironment() const; + CXFA_FFDoc* GetHDOC() { return m_pDoc.Get(); } IXFA_AppProvider* GetAppProvider(); CXFA_FFWidgetHandler* GetWidgetHandler(); - CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); void OpenDropDownList(CXFA_FFWidget* hWidget); void ResetData(CXFA_Node* pNode); int32_t GetLayoutStatus(); |