summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-11-04 11:53:47 -0500
committerDan Sinclair <dsinclair@chromium.org>2015-11-04 11:53:47 -0500
commit891c22686b90f4b23e741b5f1564f21831ee111c (patch)
tree48da027a599084d8d79acabf28b279837058cac0 /fpdfsdk/src/fsdk_annothandler.cpp
parent1488aac2e699a5dd31bc59c3d07fe591e2d38c20 (diff)
downloadpdfium-891c22686b90f4b23e741b5f1564f21831ee111c.tar.xz
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 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp14
1 files changed, 8 insertions, 6 deletions
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);