From 8c217c537fc845763018a5d81a8c55b1045f6ccd Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 3 Oct 2015 23:26:09 -0700 Subject: Merge to XFA: Do not call into formfiller code with a NULL PageView. BUG=537173 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1376093002 . (cherry picked from commit ac67d4765a8ac36cd00c9fc8b6f2b80a3e1cff72) Review URL: https://codereview.chromium.org/1378193006 . --- fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'fpdfsdk/src/formfiller/FFL_FormFiller.cpp') diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 42177f5932..642e5e8964 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -242,8 +242,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, return FALSE; } -FX_BOOL CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, - FX_UINT nFlag) { +void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); @@ -254,31 +253,31 @@ FX_BOOL CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, m_bValid = TRUE; FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); - return TRUE; } -FX_BOOL CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, - FX_UINT nFlag) { +void CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { if (!IsValid()) - return TRUE; + return; CPDFSDK_PageView* pPageView = GetCurPageView(); + if (!pPageView) + return; + CommitData(pPageView, nFlag); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) pWnd->KillFocus(); + FX_BOOL bDestroyPDFWindow; switch (m_pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: - EscapeFiller(pPageView, TRUE); - break; + bDestroyPDFWindow = TRUE; default: - EscapeFiller(pPageView, FALSE); - break; + bDestroyPDFWindow = FALSE; } - return TRUE; + EscapeFiller(pPageView, bDestroyPDFWindow); } FX_BOOL CFFL_FormFiller::IsValid() const { -- cgit v1.2.3