diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-25 23:25:55 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-25 23:25:55 +0000 |
commit | 11a6becb837a16972ffda8f94c8fb69ae100f3f4 (patch) | |
tree | 38f7e3508f1ef221eabd62b14665e78437da2d8f /fpdfsdk/formfiller/cffl_formfiller.cpp | |
parent | 91b8302dec04ca4ddc1f91545d192350665580cf (diff) | |
download | pdfium-11a6becb837a16972ffda8f94c8fb69ae100f3f4.tar.xz |
Remove some ASSERT (and cast) in favor of checked cases.
Because it is a stronger pattern at runtime.
These were found by essentially: grep -ni '\bassert\b.*type'
Change-Id: I913d77139053e8980528597a6633e1859e5204c4
Reviewed-on: https://pdfium-review.googlesource.com/38890
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 6174dde9ae..94592e719f 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -16,14 +16,6 @@ #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" -namespace { - -CPDFSDK_Widget* CPDFSDKAnnotToWidget(CPDFSDK_Annot* annot) { - return static_cast<CPDFSDK_Widget*>(annot); -} - -} // namespace - CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDFSDK_Widget* pWidget) : m_pFormFillEnv(pFormFillEnv), m_pWidget(pWidget), m_bValid(false) { @@ -71,8 +63,6 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) { - ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { CFX_Matrix mt = GetCurMatrix(); mt.Concat(mtUser2Device); @@ -80,7 +70,7 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, return; } - CPDFSDK_Widget* pWidget = CPDFSDKAnnotToWidget(pAnnot); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot); if (!CFFL_InteractiveFormFiller::IsVisible(pWidget)) return; @@ -91,8 +81,8 @@ void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) { - CPDFSDKAnnotToWidget(pAnnot)->DrawAppearance(pDevice, mtUser2Device, - CPDF_Annot::Normal, nullptr); + ToCPDFSDKWidget(pAnnot)->DrawAppearance(pDevice, mtUser2Device, + CPDF_Annot::Normal, nullptr); } void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, |