diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-20 16:21:31 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-21 13:29:50 +0000 |
commit | b8777a2c5f38ea4d6fc74ea01a114d3e056c0fdb (patch) | |
tree | 83acc47e45d932146a70941b7484e78c426b3b27 /fpdfsdk | |
parent | 36eed87d19e741be9909500c45dd12e50ff6a1ab (diff) | |
download | pdfium-b8777a2c5f38ea4d6fc74ea01a114d3e056c0fdb.tar.xz |
Add embeddertest for CFWL_Edit
This CL adds two mouse selection tests for CFWL_Edit. In order to do so
the needed selection code was added to the XFA widget handler and
plumbed down to the CFWL_Edit field as needed.
Bug: pdfium:840
Change-Id: Ia3b5f5d191494a4579c01524df8fb35b24cc0085
Reviewed-on: https://pdfium-review.googlesource.com/14530
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index b5c52a89cc..c1ef2bdb23 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -97,16 +97,22 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return rcWidget; } -// TODO(bug 840): Implement so selected text can be obtained from XFA -// fields. WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { - return WideString(); + if (!pAnnot) + return WideString(); + + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + return pWidgetHandler->GetSelectedText(pAnnot->GetXFAWidget()); } -// TODO(bug 840): Implement so text can be inserted into and deleted from XFA -// fields. void CPDFSDK_XFAWidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const WideString& text) {} + const WideString& text) { + if (!pAnnot) + return; + + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + return pWidgetHandler->PasteText(pAnnot->GetXFAWidget(), text); +} bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, |