Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: fpdfsdk/src/formfiller/FFL_IFormFiller.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_FormFiller.cpp ('k') | fpdfsdk/src/formfiller/FFL_ListBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index a939942a558841f302e5eb5ce8defa68d6a8d3d8..6d8c3a9d4b232c0cf9fba3c60a339027be453e32 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -15,12 +15,6 @@
#define FFL_MAXLISTBOXHEIGHT 140.0f
-// HHOOK CFFL_IFormFiller::m_hookSheet = NULL;
-// MSG CFFL_IFormFiller::g_Msg;
-
-/* ----------------------------- CFFL_IFormFiller -----------------------------
- */
-
CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp)
: m_pApp(pApp), m_bNotifying(FALSE) {}
@@ -44,7 +38,7 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
return pFormFiller->GetViewBBox(pPageView, pAnnot);
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
CPDF_Rect rcAnnot;
@@ -55,11 +49,11 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
}
void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
- /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags) {
- ASSERT(pPageView != NULL);
+ FX_DWORD dwFlags) {
+ ASSERT(pPageView);
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
if (IsVisible(pWidget)) {
@@ -127,7 +121,6 @@ void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {
void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (!m_bNotifying) {
@@ -139,7 +132,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -147,8 +140,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView);
m_bNotifying = FALSE;
- // if ( !IsValidAnnot(pPageView, pAnnot) ) return;
-
if (pWidget->IsAppModified()) {
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
pFormFiller->ResetPDFWindow(pPageView,
@@ -166,7 +157,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (!m_bNotifying) {
@@ -177,7 +167,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
int nValueAge = pWidget->GetValueAge();
pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -186,8 +176,6 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView);
m_bNotifying = FALSE;
- // if (!IsValidAnnot(pPageView, pAnnot)) return;
-
if (pWidget->IsAppModified()) {
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
pFormFiller->ResetPDFWindow(pPageView,
@@ -206,7 +194,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (!m_bNotifying) {
@@ -218,7 +205,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
int nValueAge = pWidget->GetValueAge();
pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags);
@@ -286,7 +273,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget,
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag) {
- ASSERT(pWidget != NULL);
+ ASSERT(pWidget);
if (!m_bNotifying) {
if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) {
@@ -294,9 +281,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget,
int nAge = pWidget->GetAppearanceAge();
int nValueAge = pWidget->GetValueAge();
- ASSERT(pPageView != NULL);
- // CReader_DocView* pDocView = pPageView->GetDocView();
- // ASSERT(pDocView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -326,7 +311,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
@@ -340,7 +324,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
// change cursor
@@ -356,7 +339,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
FX_UINT nFlags,
short zDelta,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
@@ -370,7 +352,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
@@ -384,7 +365,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CPDF_Point& point) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
@@ -397,7 +377,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
FX_UINT nKeyCode,
FX_UINT nFlags) {
- ASSERT(pAnnot != NULL);
ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
@@ -436,7 +415,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
pWidget->ClearAppModified();
CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -479,7 +458,7 @@ FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
pWidget->ClearAppModified();
CPDFSDK_PageView* pPageView = pWidget->GetPageView();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -501,10 +480,7 @@ FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) {
}
FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
- ASSERT(pWidget != NULL);
-
int nFieldFlags = pWidget->GetFieldFlags();
-
return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
}
@@ -584,8 +560,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData,
FX_FLOAT fPopupMax,
int32_t& nRet,
FX_FLOAT& fPopupRet) {
- ASSERT(pPrivateData != NULL);
-
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
CPDF_Rect rcPageView(0, 0, 0, 0);
@@ -593,7 +567,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData,
rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight();
rcPageView.Normalize();
- ASSERT(pData->pWidget != NULL);
CPDF_Rect rcAnnot = pData->pWidget->GetRect();
FX_FLOAT fTop = 0.0f;
@@ -660,12 +633,11 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
FX_BOOL& bExit,
FX_DWORD nFlag) {
if (!m_bNotifying) {
- ASSERT(pWidget != NULL);
if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) {
m_bNotifying = TRUE;
pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -675,8 +647,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
fa.bRC = TRUE;
CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
-
pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa);
pFormFiller->SaveState(pPageView);
@@ -684,9 +654,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView);
bRC = fa.bRC;
- // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
- // pWidget);
-
m_bNotifying = FALSE;
}
}
@@ -698,14 +665,11 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget,
FX_BOOL& bExit,
FX_DWORD nFlag) {
if (!m_bNotifying) {
- ASSERT(pWidget != NULL);
if (pWidget->GetAAction(CPDF_AAction::Validate)) {
m_bNotifying = TRUE;
pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
- // CReader_DocView* pDocView = pPageView->GetDocView();
- // ASSERT(pDocView != NULL);
+ ASSERT(pPageView);
PDFSDK_FieldAction fa;
fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
@@ -714,8 +678,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget,
fa.bRC = TRUE;
CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
-
pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa);
pFormFiller->SaveState(pPageView);
@@ -723,9 +685,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget,
pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView);
bRC = fa.bRC;
- // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
- // pWidget);
-
m_bNotifying = FALSE;
}
}
@@ -736,22 +695,12 @@ void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget,
FX_BOOL& bExit,
FX_DWORD nFlag) {
if (!m_bNotifying) {
- ASSERT(pWidget != NULL);
- ASSERT(pPageView != NULL);
- // CReader_DocView* pDocView = pPageView->GetDocView();
- // ASSERT(pDocView != NULL);
+ ASSERT(pWidget);
CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
pInterForm->OnCalculate(pWidget->GetFormField());
- // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
- // pWidget);
-
m_bNotifying = FALSE;
}
}
@@ -761,24 +710,15 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget,
FX_BOOL& bExit,
FX_DWORD nFlag) {
if (!m_bNotifying) {
- ASSERT(pWidget != NULL);
- ASSERT(pPageView != NULL);
- // CReader_DocView* pDocView = pPageView->GetDocView();
- // ASSERT(pDocView != NULL);
+ ASSERT(pWidget);
CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
FX_BOOL bFormated = FALSE;
CFX_WideString sValue =
pInterForm->OnFormat(pWidget->GetFormField(), bFormated);
- // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
- // pWidget);
-
if (bExit)
return;
@@ -809,20 +749,16 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData,
FX_BOOL& bRC,
FX_BOOL& bExit,
FX_DWORD nFlag) {
- ASSERT(pPrivateData != NULL);
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
+ ASSERT(pData->pWidget);
CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
-
if (!m_bNotifying) {
if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) {
m_bNotifying = TRUE;
int nAge = pData->pWidget->GetAppearanceAge();
int nValueAge = pData->pWidget->GetValueAge();
- ASSERT(pData->pPageView != NULL);
CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument();
PDFSDK_FieldAction fa;
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_FormFiller.cpp ('k') | fpdfsdk/src/formfiller/FFL_ListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698