From 891c22686b90f4b23e741b5f1564f21831ee111c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 4 Nov 2015 11:53:47 -0500 Subject: Backport CPDFSDK_BAAnnot from XFA. On the XFA branch the CPDFSDK_Annot class has been turned into a base class with CPDFSDK_BAAnnot serving the purpose that was served by CPDFSDK_Annot. This CL pulls those changes into master to put it more in line with the XFA branch. (This removes ~600 lines from the fpdfsdk/ diff). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1408073009 . --- fpdfsdk/src/fsdk_annothandler.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/src/fsdk_annothandler.cpp') diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index b1b2e2cc76..d6a2c00bd6 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -57,7 +57,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, return pAnnotHandler->NewAnnot(pAnnot, pPageView); } - return new CPDFSDK_Annot(pAnnot, pPageView); + return new CPDFSDK_BAAnnot(pAnnot, pPageView); } void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { @@ -100,9 +100,9 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( ASSERT(pAnnot != NULL); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); - ASSERT(pPDFAnnot != NULL); - - return GetAnnotHandler(pPDFAnnot->GetSubType()); + if (pPDFAnnot) + return GetAnnotHandler(pPDFAnnot->GetSubType()); + return nullptr; } IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( @@ -121,7 +121,8 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); } else { - pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); + ((CPDFSDK_BAAnnot*)pAnnot) + ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); } } @@ -384,7 +385,8 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { - pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); + ((CPDFSDK_BAAnnot*)pAnnot) + ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); } else { if (m_pFormFiller) { m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); -- cgit v1.2.3