summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/PWL_Edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Edit.cpp')
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index f84c38e23b..4b9e0d2f49 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -6,6 +6,7 @@
#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include <algorithm>
#include <memory>
#include <vector>
@@ -791,21 +792,8 @@ void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place,
CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2) {
- CPVT_WordRange wrRet;
-
- if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) {
- wrRet.BeginPos = wr1.BeginPos;
- } else {
- wrRet.BeginPos = wr2.BeginPos;
- }
-
- if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) {
- wrRet.EndPos = wr2.EndPos;
- } else {
- wrRet.EndPos = wr1.EndPos;
- }
-
- return wrRet;
+ return CPVT_WordRange(std::min(wr1.BeginPos, wr2.BeginPos),
+ std::max(wr1.EndPos, wr2.EndPos));
}
CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const {