Remove GetSameWordsRange() arguments that are always the same
Then simplify the resulting code.
Then remove some dead code.
Then fold code into its only caller.
Change-Id: I86423ef93c69ffafdb8cc576015c2e6b2421e312
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 22f3cce..6fe176d 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -577,65 +577,33 @@
std::max(wr1.EndPos, wr2.EndPos));
}
-CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const {
- return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false);
-}
-
-CPVT_WordRange CPWL_Edit::GetLatinWordsRange(
- const CPVT_WordPlace& place) const {
- return GetSameWordsRange(place, true, false);
-}
-
#define PWL_ISLATINWORD(u) \
(u == 0x2D || (u >= 0x0041 && u <= 0x005A) || \
(u >= 0x0061 && u <= 0x007A) || (u >= 0x00C0 && u <= 0x02AF))
-#define PWL_ISARABICWORD(u) \
- ((u >= 0x0600 && u <= 0x06FF) || (u >= 0xFB50 && u <= 0xFEFC))
-
-CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place,
- bool bLatin,
- bool bArabic) const {
+CPVT_WordRange CPWL_Edit::GetLatinWordsRange(
+ const CPVT_WordPlace& place) const {
CPWL_EditImpl_Iterator* pIterator = m_pEdit->GetIterator();
CPVT_Word wordinfo;
- CPVT_WordPlace wpStart(place), wpEnd(place);
+ CPVT_WordPlace wpStart(place);
+ CPVT_WordPlace wpEnd(place);
pIterator->SetAt(place);
- if (bLatin) {
- while (pIterator->NextWord()) {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISLATINWORD(wordinfo.Word)) {
- break;
- }
+ while (pIterator->NextWord()) {
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISLATINWORD(wordinfo.Word))
+ break;
- wpEnd = pIterator->GetAt();
- }
- } else if (bArabic) {
- while (pIterator->NextWord()) {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
- break;
-
- wpEnd = pIterator->GetAt();
- }
+ wpEnd = pIterator->GetAt();
}
pIterator->SetAt(place);
- if (bLatin) {
- do {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISLATINWORD(wordinfo.Word)) {
- break;
- }
+ do {
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISLATINWORD(wordinfo.Word))
+ break;
- wpStart = pIterator->GetAt();
- } while (pIterator->PrevWord());
- } else if (bArabic) {
- do {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
- break;
-
- wpStart = pIterator->GetAt();
- } while (pIterator->PrevWord());
- }
+ wpStart = pIterator->GetAt();
+ } while (pIterator->PrevWord());
return CPVT_WordRange(wpStart, wpEnd);
}
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h
index 06e1ae2..2c39eff 100644
--- a/fpdfsdk/pwl/cpwl_edit.h
+++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -91,11 +91,7 @@
CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2);
- CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const;
CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
- CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place,
- bool bLatin,
- bool bArabic) const;
bool m_bFocus = false;
CFX_FloatRect m_rcOldWindow;