summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_fftext.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/fxfa/app/xfa_fftext.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/fxfa/app/xfa_fftext.cpp')
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index d8231bfda8..e8d7aa32d0 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -107,11 +107,11 @@ bool CXFA_FFText::PerformLayout() {
return true;
}
-bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!GetRectWithoutRotate().Contains(fx, fy))
+bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!GetRectWithoutRotate().Contains(point))
return false;
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
+ const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -119,33 +119,33 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return true;
}
-bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- return GetRectWithoutRotate().Contains(fx, fy) && !!GetLinkURLAtPoint(fx, fy);
+bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
+ return GetRectWithoutRotate().Contains(point) && !!GetLinkURLAtPoint(point);
}
-bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!IsButtonDown()) {
+bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!IsButtonDown())
return false;
- }
+
SetButtonDown(false);
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
+ const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ if (!wsURLContent)
return false;
- }
+
CXFA_FFDoc* pDoc = GetDoc();
pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent);
return true;
}
-FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (!GetRectWithoutRotate().Contains(fx, fy))
+FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) {
+ if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (!GetLinkURLAtPoint(fx, fy))
+ if (!GetLinkURLAtPoint(point))
return FWL_WidgetHit::Unknown;
return FWL_WidgetHit::HyperLink;
}
-const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
+const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
@@ -154,7 +154,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
for (const auto& pPieceLine : *pTextLayout->GetPieceLines()) {
for (const auto& pPiece : pPieceLine->m_textPieces) {
if (pPiece->pLinkData &&
- pPiece->rtPiece.Contains(fx - rect.left, fy - rect.top)) {
+ pPiece->rtPiece.Contains(point - rect.TopLeft())) {
return pPiece->pLinkData->GetLinkURL();
}
}