summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-03 13:00:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-03 13:00:25 -0700
commit89fcde88f0c03da77d7fd83dece7726d66fd190e (patch)
tree509e8ee5c74480d1c60892c5868f0b888808f6b9 /xfa/fxfa
parent5fc4f31285c3a88fc157fd2d9b9cf2eb5c7cabed (diff)
downloadpdfium-89fcde88f0c03da77d7fd83dece7726d66fd190e.tar.xz
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
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp20
-rw-r--r--xfa/fxfa/app/xfa_fffield.h2
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.cpp20
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.h2
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp14
-rw-r--r--xfa/fxfa/app/xfa_fftext.h2
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp8
-rw-r--r--xfa/fxfa/include/xfa_ffwidget.h3
-rw-r--r--xfa/fxfa/include/xfa_ffwidgethandler.h3
10 files changed, 35 insertions, 43 deletions
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);
diff --git a/xfa/fxfa/include/xfa_ffwidget.h b/xfa/fxfa/include/xfa_ffwidget.h
index a6ab999485..74e4c84c4d 100644
--- a/xfa/fxfa/include/xfa_ffwidget.h
+++ b/xfa/fxfa/include/xfa_ffwidget.h
@@ -18,6 +18,7 @@ class CXFA_FFPageView;
class CXFA_FFDocView;
class CXFA_FFDoc;
class CXFA_FFApp;
+enum class FWL_WidgetHit;
inline FX_FLOAT XFA_UnitPx2Pt(FX_FLOAT fPx, FX_FLOAT fDpi) {
return fPx * 72.0f / fDpi;
@@ -84,7 +85,7 @@ class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem {
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);
virtual FX_BOOL CanUndo() { return FALSE; }
virtual FX_BOOL CanRedo() { return FALSE; }
diff --git a/xfa/fxfa/include/xfa_ffwidgethandler.h b/xfa/fxfa/include/xfa_ffwidgethandler.h
index f6cd2170a5..8159d87cf0 100644
--- a/xfa/fxfa/include/xfa_ffwidgethandler.h
+++ b/xfa/fxfa/include/xfa_ffwidgethandler.h
@@ -13,6 +13,7 @@
#include "xfa/fxfa/parser/xfa_document.h"
class CXFA_FFDocView;
+enum class FWL_WidgetHit;
class CXFA_FFWidgetHandler {
public:
@@ -64,7 +65,7 @@ class CXFA_FFWidgetHandler {
uint32_t dwFlags);
FX_BOOL OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
FX_BOOL OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
- uint32_t OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
FX_BOOL OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
void RenderWidget(CXFA_FFWidget* hWidget,
CFX_Graphics* pGS,