summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-06 11:44:39 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-06 15:54:37 +0000
commiteb57e0d0b396606b39ef76a864b8bf9dd91a8ed8 (patch)
tree3d4ee88701eed1cbb56f456ea6ebc7c7c0f47f6c /xfa/fwl/cfwl_edit.cpp
parent746552254ad113ef88b40aca4dbc0e57cefbac85 (diff)
downloadpdfium-eb57e0d0b396606b39ef76a864b8bf9dd91a8ed8.tar.xz
Implement word selection in CFDE_TextEditEngine
This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 72adb5392b..99a312bfca 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1234,14 +1234,13 @@ void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) {
}
void CFWL_Edit::OnButtonDoubleClick(CFWL_MessageMouse* pMsg) {
- // TODO(dsinclair): Handle OnButtonDoubleClick
- // int32_t nCount = 0;
- // int32_t nIndex = pPage->SelectWord(DeviceToEngine(pMsg->m_pos), nCount);
- // if (nIndex < 0)
- // return;
- //
- // m_EdtEngine.AddSelRange(nIndex, nCount);
- // SetCursorPosition(nIndex + nCount - 1);
+ size_t click_idx = m_EdtEngine.GetIndexForPoint(DeviceToEngine(pMsg->m_pos));
+ size_t start_idx;
+ size_t end_idx;
+ std::tie(start_idx, end_idx) = m_EdtEngine.BoundsForWordAt(click_idx);
+
+ m_EdtEngine.SetSelection(start_idx, end_idx);
+ m_CursorPosition = end_idx;
RepaintRect(m_rtEngine);
}