summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_baannothandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-28 00:00:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-28 00:00:25 +0000
commit522d77db501ab7ae33f7d17e4ab456232ca5a70c (patch)
treed53f5d73117cd098bf3ee4ff6e1fc05b59becdb8 /fpdfsdk/cpdfsdk_baannothandler.cpp
parentf19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da (diff)
downloadpdfium-522d77db501ab7ae33f7d17e4ab456232ca5a70c.tar.xz
Add CPDSDK_Annot::AsBAAnnot() checked downcast method
XFA introduces some additional subclasses, so it doesn't hurt to be sure in all cases before making a static cast. Change-Id: I7447ca58be0b57201b39ba40a3fc5f47505cee58 Reviewed-on: https://pdfium-review.googlesource.com/39013 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_baannothandler.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index ab46a9683c..a5969c98a2 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -72,15 +72,15 @@ void CPDFSDK_BAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
return;
#endif // PDF_ENABLE_XFA
if (bDrawAnnots && pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP) {
- static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
- pDevice, *pUser2Device, CPDF_Annot::Normal, nullptr);
+ pAnnot->AsBAAnnot()->DrawAppearance(pDevice, *pUser2Device,
+ CPDF_Annot::Normal, nullptr);
}
}
void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
- CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get());
+ CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
pBAAnnot->SetOpenState(true);
UpdateAnnotRects(pPageView, pBAAnnot);
}
@@ -88,7 +88,7 @@ void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
- CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get());
+ CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
pBAAnnot->SetOpenState(false);
UpdateAnnotRects(pPageView, pBAAnnot);
}