summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-21 14:27:59 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-21 20:44:29 +0000
commitb45ea1fce52d93615470bab8b671cba5907fb01e (patch)
tree15153c437a253f73b3f5bb154a294ace77fe2c6d /xfa/fwl/cfwl_edit.cpp
parent37a35df8c878d6e21a62ce0dfd2d480997d9e86c (diff)
downloadpdfium-b45ea1fce52d93615470bab8b671cba5907fb01e.tar.xz
Convert CFWL messages to use CFX_PointF
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index a227176ed0..35a83f9da5 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -142,18 +142,18 @@ void CFWL_Edit::Update() {
InitCaret();
}
-FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowScrollBar(true)) {
- if (m_pVertScrollBar->GetWidgetRect().Contains(fx, fy))
+ if (m_pVertScrollBar->GetWidgetRect().Contains(point))
return FWL_WidgetHit::VScrollBar;
}
if (IsShowScrollBar(false)) {
- if (m_pHorzScrollBar->GetWidgetRect().Contains(fx, fy))
+ if (m_pHorzScrollBar->GetWidgetRect().Contains(point))
return FWL_WidgetHit::HScrollBar;
}
}
- if (m_rtClient.Contains(fx, fy))
+ if (m_rtClient.Contains(point))
return FWL_WidgetHit::Edit;
return FWL_WidgetHit::Unknown;
}
@@ -1057,9 +1057,9 @@ void CFWL_Edit::LayoutScrollBar() {
UpdateScroll();
}
-void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) {
- pt.x += m_fScrollOffsetX - m_rtEngine.left;
- pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset;
+CFX_PointF CFWL_Edit::DeviceToEngine(const CFX_PointF& pt) {
+ return pt + CFX_PointF(m_fScrollOffsetX - m_rtEngine.left,
+ m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset);
}
void CFWL_Edit::InitVerticalScrollBar() {
@@ -1268,10 +1268,8 @@ void CFWL_Edit::DoButtonDown(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
bool bBefore = true;
- int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
+ int32_t nIndex = pPage->GetCharIndex(DeviceToEngine(pMsg->m_pos), bBefore);
if (nIndex < 0)
nIndex = 0;
@@ -1346,10 +1344,8 @@ void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
int32_t nCount = 0;
- int32_t nIndex = pPage->SelectWord(pt, nCount);
+ int32_t nIndex = pPage->SelectWord(DeviceToEngine(pMsg->m_pos), nCount);
if (nIndex < 0)
return;
@@ -1366,10 +1362,8 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
bool bBefore = true;
- int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
+ int32_t nIndex = pPage->GetCharIndex(DeviceToEngine(pMsg->m_pos), bBefore);
m_EdtEngine.SetCaretPos(nIndex, bBefore);
nIndex = m_EdtEngine.GetCaretPos();
m_EdtEngine.ClearSelection();