diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-09-15 15:32:01 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-15 22:42:04 +0000 |
commit | 134ac9105586407eb3b1e06001101ff893dd4a31 (patch) | |
tree | 42742a4d7867643a9e30d637204bc320407a66c0 /fpdfsdk/formfiller/cffl_formfiller.cpp | |
parent | bf15730b2c9577d4efd2124d84c6c8ccc5f66b43 (diff) | |
download | pdfium-134ac9105586407eb3b1e06001101ff893dd4a31.tar.xz |
Introduce CPWL_Wnd::PrivateData class.
First step in passing ownership of this memory to the CPWL_Wnd.
In turn, nest two other classes that also require PrivateData to
satisfy nesting rules.
Move one stray #define to the appropriate file while at it.
Change-Id: I565934565421f5843a3b792b3bdc21b5e8839eb8
Reviewed-on: https://pdfium-review.googlesource.com/14170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index f405e3578d..e59cd0520f 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -37,8 +37,7 @@ CFFL_FormFiller::~CFFL_FormFiller() { void CFFL_FormFiller::DestroyWindows() { for (const auto& it : m_Maps) { CPWL_Wnd* pWnd = it.second; - CFFL_PrivateData* pData = - static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); + auto* pData = static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); pWnd->InvalidateProvider(this); pWnd->Destroy(); delete pWnd; @@ -359,7 +358,7 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, CPWL_Wnd::CreateParams cp = GetCreateParam(); cp.pAttachedWidget.Reset(m_pWidget.Get()); - CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; + auto* pPrivateData = new CFFL_PrivateData; pPrivateData->pWidget = m_pWidget.Get(); pPrivateData->pPageView = pPageView; pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge(); @@ -384,18 +383,17 @@ void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) { return; CPWL_Wnd* pWnd = it->second; - CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); + auto* pData = static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); pWnd->Destroy(); delete pWnd; delete pData; - m_Maps.erase(it); } -CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { +CFX_Matrix CFFL_FormFiller::GetWindowMatrix(CPWL_Wnd::PrivateData* pAttached) { CFX_Matrix mt; - auto* pPrivateData = reinterpret_cast<CFFL_PrivateData*>(pAttachedData); - if (!pAttachedData || !pPrivateData->pPageView) + auto* pPrivateData = static_cast<CFFL_PrivateData*>(pAttached); + if (!pPrivateData || !pPrivateData->pPageView) return mt; CFX_Matrix mtPageView; |