Change Clear() to ClearSelection().
This CL renames Clear() in CPWL_EditCtrl, CPWL_ComboBox, and CFX_Edit
to ClearSelection(), as this function's behavior is clearing text selection.
Change-Id: Ia32f5347abc1960d7219684942df6a3fede9936c
Reviewed-on: https://pdfium-review.googlesource.com/8611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Diana Gage <drgage@google.com>
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index d00b4d6..96868d0 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -884,7 +884,7 @@
return Delete(true, true);
}
-bool CFX_Edit::Clear() {
+bool CFX_Edit::ClearSelection() {
return Clear(true, true);
}
@@ -1736,9 +1736,10 @@
return false;
CPVT_WordRange range = m_SelState.ConvertToWordRange();
- if (bAddUndo && m_bEnableUndo)
+ if (bAddUndo && m_bEnableUndo) {
AddEditUndoItem(
pdfium::MakeUnique<CFXEU_Clear>(this, range, GetSelectedText()));
+ }
SelectNone();
SetCaret(m_pVT->DeleteWords(range));
diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h
index fb64e0a..bb52462 100644
--- a/fpdfsdk/fxedit/fxet_edit.h
+++ b/fpdfsdk/fxedit/fxet_edit.h
@@ -343,7 +343,7 @@
bool InsertReturn();
bool Backspace();
bool Delete();
- bool Clear();
+ bool ClearSelection();
bool InsertText(const CFX_WideString& sText, int32_t charset);
bool Redo();
bool Undo();
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
index e507633..484027e 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
@@ -227,9 +227,9 @@
m_pEdit->GetSelection(nStartChar, nEndChar);
}
-void CPWL_ComboBox::Clear() {
+void CPWL_ComboBox::ClearSelection() {
if (m_pEdit)
- m_pEdit->Clear();
+ m_pEdit->ClearSelection();
}
void CPWL_ComboBox::CreateChildWnd(const PWL_CREATEPARAM& cp) {
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h
index a38ffa7..12c0fe9 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.h
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h
@@ -74,7 +74,7 @@
void SetEditSelection(int32_t nStartChar, int32_t nEndChar);
void GetEditSelection(int32_t& nStartChar, int32_t& nEndChar) const;
- void Clear();
+ void ClearSelection();
void SelectAll();
bool IsPopup() const;
diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp
index ac1cfa9..89361b5 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp
@@ -136,7 +136,7 @@
void CPWL_Edit::CutText() {
if (!CanCut())
return;
- m_pEdit->Clear();
+ m_pEdit->ClearSelection();
}
void CPWL_Edit::OnCreated() {
@@ -430,7 +430,7 @@
}
void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) {
- m_pEdit->Clear();
+ m_pEdit->ClearSelection();
m_pEdit->InsertText(wsText, FX_CHARSET_Default);
}
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
index 7262189..7b90579 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
@@ -169,7 +169,7 @@
return true;
case FWL_VKEY_Unknown:
if (!IsSHIFTpressed(nFlag))
- Clear();
+ ClearSelection();
else
CutText();
return true;
@@ -233,7 +233,7 @@
if (m_pEdit->IsSelected() && word == FWL_VKEY_Back)
word = FWL_VKEY_Unknown;
- Clear();
+ ClearSelection();
switch (word) {
case FWL_VKEY_Back:
@@ -342,9 +342,9 @@
m_pEdit->GetSelection(nStartChar, nEndChar);
}
-void CPWL_EditCtrl::Clear() {
+void CPWL_EditCtrl::ClearSelection() {
if (!IsReadOnly())
- m_pEdit->Clear();
+ m_pEdit->ClearSelection();
}
void CPWL_EditCtrl::SelectAll() {
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
index 04ec6e8..fca3bd8 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
@@ -28,7 +28,7 @@
CFX_WideString GetText() const;
void SetSelection(int32_t nStartChar, int32_t nEndChar);
void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const;
- void Clear();
+ void ClearSelection();
void SelectAll();
CFX_PointF GetScrollPos() const;