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

Unified Diff: fpdfsdk/src/fsdk_annothandler.cpp

Issue 1235393002: Tidy up CPDFDOC_Environment. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months 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
Index: fpdfsdk/src/fsdk_annothandler.cpp
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 30abd0816fcb6a9d781ee0de280f415a223b42f7..daea4045d4e09a68b9faa126abefdf27f357044d 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -384,25 +384,19 @@ FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot)
return FALSE;
}
-CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage)
+CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage)
{
- ASSERT(pPage != NULL);
- pPage->GetPDFDocument();
-
- CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc();
- ASSERT(pSDKDoc);
+ CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
Lei Zhang 2015/07/16 17:05:06 kill tabs
Tom Sepez 2015/07/16 18:01:28 Untabified file.
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm();
- ASSERT(pInterForm != NULL);
-
- CPDFSDK_Widget* pWidget = NULL;
- if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInterForm(), pAnnot->GetAnnotDict()))
- {
- pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
- pInterForm->AddMap(pCtrl, pWidget);
- CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
- if(pPDFInterForm && pPDFInterForm->NeedConstructAP())
- pWidget->ResetAppearance(NULL,FALSE);
- }
+ CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInterForm(), pAnnot->GetAnnotDict());
+ if (!pCtrl)
+ return nullptr;
+
+ CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
+ pInterForm->AddMap(pCtrl, pWidget);
+ CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
+ if (pPDFInterForm && pPDFInterForm->NeedConstructAP())
+ pWidget->ResetAppearance(NULL, FALSE);
Lei Zhang 2015/07/16 17:05:06 NULL -> nullptr
Tom Sepez 2015/07/16 18:01:28 Done.
return pWidget;
}

Powered by Google App Engine
This is Rietveld 408576698