From 89fcde88f0c03da77d7fd83dece7726d66fd190e Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 3 May 2016 13:00:25 -0700 Subject: Remove FWL_WGTHITTEST_* defines in favour of enum class. This Cl updates the FWL_WGTHITTEST_ defines to an enum class and fixes up any code issues. Review-Url: https://codereview.chromium.org/1948583002 --- xfa/fxfa/app/xfa_fffield.cpp | 20 ++++++++------------ xfa/fxfa/app/xfa_fffield.h | 2 +- xfa/fxfa/app/xfa_ffsignature.cpp | 20 ++++++++------------ xfa/fxfa/app/xfa_ffsignature.h | 2 +- xfa/fxfa/app/xfa_fftext.cpp | 14 ++++++-------- xfa/fxfa/app/xfa_fftext.h | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 4 ++-- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 8 ++++---- 8 files changed, 31 insertions(+), 41 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index d19bb4cf37..a0744def07 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -598,24 +598,20 @@ FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { TranslateFWLMessage(&ms); return TRUE; } -uint32_t CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pNormalWidget) { FX_FLOAT ffx = fx, ffy = fy; FWLToClient(ffx, ffy); - uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy); - if (dwWidgetHit != FWL_WGTHITTEST_Unknown) { - return FWL_WGTHITTEST_Client; - } + if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) + return FWL_WidgetHit::Client; } CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (m_rtCaption.Contains(fx, fy)) { - return FWL_WGTHITTEST_Titlebar; - } - return FWL_WGTHITTEST_Border; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (m_rtCaption.Contains(fx, fy)) + return FWL_WidgetHit::Titlebar; + return FWL_WidgetHit::Border; } FX_BOOL CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return TRUE; diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 70ba9fc661..576b0b105e 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -53,7 +53,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); protected: diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index ce1cee2033..4008abf808 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -96,24 +96,20 @@ FX_BOOL CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { FX_BOOL CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) { return FALSE; } -uint32_t CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pNormalWidget) { FX_FLOAT ffx = fx, ffy = fy; FWLToClient(ffx, ffy); - uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy); - if (dwWidgetHit != FWL_WGTHITTEST_Unknown) { - return FWL_WGTHITTEST_Client; - } + if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) + return FWL_WidgetHit::Client; } CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (m_rtCaption.Contains(fx, fy)) { - return FWL_WGTHITTEST_Titlebar; - } - return FWL_WGTHITTEST_Client; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (m_rtCaption.Contains(fx, fy)) + return FWL_WidgetHit::Titlebar; + return FWL_WidgetHit::Client; } FX_BOOL CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return FALSE; diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/xfa_ffsignature.h index 1b5f33ccc4..01ece76c4f 100644 --- a/xfa/fxfa/app/xfa_ffsignature.h +++ b/xfa/fxfa/app/xfa_ffsignature.h @@ -36,7 +36,7 @@ class CXFA_FFSignature final : public CXFA_FFField { virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); }; diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index b529f7e58a..c5e1cba2a8 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -139,16 +139,14 @@ FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { pDoc->GetDocProvider()->GotoURL(pDoc, CFX_WideStringC(wsURLContent), FALSE); return TRUE; } -uint32_t CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (!GetLinkURLAtPoint(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - return FWL_WGTHITTEST_HyperLink; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (!GetLinkURLAtPoint(fx, fy)) + return FWL_WidgetHit::Unknown; + return FWL_WidgetHit::HyperLink; } const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index 847805b527..f505ddb30e 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -16,7 +16,7 @@ class CXFA_FFText : public CXFA_FFDraw { virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual void RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix = NULL, uint32_t dwStatus = 0, diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index c1af34c030..47be58e889 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -249,8 +249,8 @@ FX_BOOL CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { FX_BOOL CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) { return FALSE; } -uint32_t CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { - return FALSE; +FWL_WidgetHit CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { + return FWL_WidgetHit::Unknown; } FX_BOOL CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return FALSE; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index df8e424662..314b22731a 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -160,11 +160,11 @@ FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, return bRet; } -uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, + FX_FLOAT fx, + FX_FLOAT fy) { if (!(hWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) - return FWL_WGTHITTEST_Unknown; + return FWL_WidgetHit::Unknown; hWidget->Rotate2Normal(fx, fy); return hWidget->OnHitTest(fx, fy); -- cgit v1.2.3