summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_notedriver.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_notedriver.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_notedriver.cpp')
-rw-r--r--xfa/fwl/cfwl_notedriver.cpp40
1 files changed, 10 insertions, 30 deletions
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 6904759e59..8feb0fb4e5 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -341,12 +341,8 @@ bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage,
pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
return !!pMsg->m_pDstTarget;
}
- if (pMsg->m_pDstTarget != pMessageForm) {
- CFX_PointF point = pMsg->m_pDstTarget->TransformTo(
- pMessageForm, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
- }
+ if (pMsg->m_pDstTarget != pMessageForm)
+ pMsg->m_pos = pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_pos);
if (!DoMouseEx(pMsg, pMessageForm))
pMsg->m_pDstTarget = pMessageForm;
return true;
@@ -359,15 +355,11 @@ bool CFWL_NoteDriver::DoWheel(CFWL_Message* pMessage,
return false;
CFWL_MessageMouseWheel* pMsg = static_cast<CFWL_MessageMouseWheel*>(pMessage);
- CFWL_Widget* pDst =
- pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
+ CFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos);
if (!pDst)
return false;
- CFX_PointF point =
- pMessageForm->TransformTo(pDst, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
+ pMsg->m_pos = pMessageForm->TransformTo(pDst, pMsg->m_pos);
pMsg->m_pDstTarget = pDst;
return true;
}
@@ -382,20 +374,12 @@ bool CFWL_NoteDriver::DoMouseEx(CFWL_Message* pMessage,
pTarget = m_pGrab;
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (!pTarget) {
- pTarget =
- pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
- }
- if (pTarget) {
- if (pMessageForm != pTarget) {
- CFX_PointF point = pMessageForm->TransformTo(
- pTarget, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
- }
- }
+ if (!pTarget)
+ pTarget = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos);
if (!pTarget)
return false;
+ if (pTarget && pMessageForm != pTarget)
+ pMsg->m_pos = pMessageForm->TransformTo(pTarget, pMsg->m_pos);
pMsg->m_pDstTarget = pTarget;
return true;
@@ -409,10 +393,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
if (m_pHover) {
CFWL_MessageMouse msLeave(nullptr, m_pHover);
- CFX_PointF point =
- pTarget->TransformTo(m_pHover, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- msLeave.m_fx = point.x;
- msLeave.m_fy = point.y;
+ msLeave.m_pos = pTarget->TransformTo(m_pHover, pMsg->m_pos);
msLeave.m_dwFlags = 0;
msLeave.m_dwCmd = FWL_MouseCommand::Leave;
DispatchMessage(&msLeave, nullptr);
@@ -424,8 +405,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) {
m_pHover = pTarget;
CFWL_MessageMouse msHover(nullptr, pTarget);
- msHover.m_fx = pMsg->m_fx;
- msHover.m_fy = pMsg->m_fy;
+ msHover.m_pos = pMsg->m_pos;
msHover.m_dwFlags = 0;
msHover.m_dwCmd = FWL_MouseCommand::Hover;
DispatchMessage(&msHover, nullptr);