diff options
author | jaepark <jaepark@google.com> | 2016-08-31 06:49:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 06:49:27 -0700 |
commit | 956553e715787cfc4dd8423d5e9a04a0131878c3 (patch) | |
tree | 08622d504322d5dae37b5bb5025a90c81ebdee6b /fpdfsdk/fsdk_mgr.cpp | |
parent | 87dffc0315477150c9c1964913b65bc97bdf654f (diff) | |
download | pdfium-956553e715787cfc4dd8423d5e9a04a0131878c3.tar.xz |
Use enum class for subtypes of CPDF_Annot.
Comparing CFX_ByteString for annotation subtypes is inefficient and
error-prone. This CL uses enum class to compare annotation subtypes.
Also, remove unused IPDFSDK_AnnotHandler::GetType() and
FSDK_XFAWIDGET_TYPENAME.
Review-Url: https://codereview.chromium.org/2295953002
Diffstat (limited to 'fpdfsdk/fsdk_mgr.cpp')
-rw-r--r-- | fpdfsdk/fsdk_mgr.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index fda00e0e6e..4ca2e6cc50 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -442,7 +442,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) { #endif // PDF_ENABLE_XFA if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) { - if (pFocusAnnot->GetAnnotSubtype() == "Widget") { + if (pFocusAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot; int nFieldType = pWidget->GetFieldType(); if (FIELDTYPE_TEXTFIELD == nFieldType || @@ -586,7 +586,7 @@ const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { for (const auto& pAnnot : m_pAnnotList->All()) { - if (pAnnot->GetSubtype() == "Widget") { + if (pAnnot->GetSubtype() == CPDF_Annot::Subtype::WIDGET) { CFX_FloatRect annotRect = pAnnot->GetRect(); if (annotRect.Contains(pageX, pageY)) return pAnnot.get(); @@ -602,7 +602,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, CPDFSDK_AnnotIterator annotIterator(this, false); while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); - if (pSDKAnnot->GetAnnotSubtype() == "Popup") + if (pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP) continue; if (rc.Contains(pageX, pageY)) return pSDKAnnot; @@ -617,10 +617,10 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_AnnotIterator annotIterator(this, false); while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { - bool bHitTest = pSDKAnnot->GetAnnotSubtype() == "Widget"; + bool bHitTest = pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET; #ifdef PDF_ENABLE_XFA - bHitTest = - bHitTest || pSDKAnnot->GetAnnotSubtype() == FSDK_XFAWIDGET_TYPENAME; + bHitTest = bHitTest || + pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::XFAWIDGET; #endif // PDF_ENABLE_XFA if (bHitTest) { pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); |