Add FORM_ReplaceSelection() and embedder tests.
This method replaces the selected text in a user-editable form text
area with another text string (which can be empty or non-empty). If
there is no selected text, FORM_ReplaceSelection() will append the
replacement text after the current caret position.
BUG=chromium:59266
Change-Id: I76448ef757d107888c33ebd5656457ebac93b952
Reviewed-on: https://pdfium-review.googlesource.com/8812
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Diana Gage <drgage@google.com>
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index fd77a73..a1ac14c 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -81,8 +81,10 @@
return GetAnnotHandler(pAnnot)->GetSelectedText(pAnnot);
}
-void CPDFSDK_AnnotHandlerMgr::Annot_DeleteSelectedText(CPDFSDK_Annot* pAnnot) {
- GetAnnotHandler(pAnnot)->DeleteSelectedText(pAnnot);
+void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(
+ CPDFSDK_Annot* pAnnot,
+ const CFX_WideString& text) {
+ GetAnnotHandler(pAnnot)->ReplaceSelection(pAnnot, text);
}
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(