summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_xfawidget.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-26 19:06:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-26 19:06:06 +0000
commit4ef943b992782d930a7550b98e3d0389886a0ba3 (patch)
treebc063c260a73bc83fbbb77b9bce59d8d97f28965 /fpdfsdk/cpdfsdk_xfawidget.h
parent2daa06ab9596a42c967497c2bae16ddd902dcaf0 (diff)
downloadpdfium-4ef943b992782d930a7550b98e3d0389886a0ba3.tar.xz
Be more careful casting to widget subclasses.
Part of the effort to reduce unchecked static casts. Change-Id: I1bff1c53aa7c5804660de4b65cf01523d70fcbb7 Reviewed-on: https://pdfium-review.googlesource.com/38896 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_xfawidget.h')
-rw-r--r--fpdfsdk/cpdfsdk_xfawidget.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_xfawidget.h b/fpdfsdk/cpdfsdk_xfawidget.h
index d2635eb4e1..5db9f8d066 100644
--- a/fpdfsdk/cpdfsdk_xfawidget.h
+++ b/fpdfsdk/cpdfsdk_xfawidget.h
@@ -36,4 +36,9 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
UnownedPtr<CXFA_FFWidget> m_hXFAWidget;
};
+inline CPDFSDK_XFAWidget* ToXFAWidget(CPDFSDK_Annot* pAnnot) {
+ return pAnnot && pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::XFAWIDGET
+ ? static_cast<CPDFSDK_XFAWidget*>(pAnnot) : nullptr;
+}
+
#endif // FPDFSDK_CPDFSDK_XFAWIDGET_H_