summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-13 13:40:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 18:26:14 +0000
commit3628f8b06e4518c81971782455270d5db4ff91c9 (patch)
tree25b61cbb0d783ba59947341ff6d1dc80613acdb8 /fpdfsdk/pdfwindow
parent469186a47d6ac939acbd80754ed9be5c085bdc22 (diff)
downloadpdfium-3628f8b06e4518c81971782455270d5db4ff91c9.tar.xz
Move CPWL_Utils::OverlapWordRange to CPVT_WordRange::Intersect
This method only deals with CPVT_WordRange objects so move to the correct class. Change-Id: If5f28178301affa8633f8ef8e89894dfb94f1ac9 Reviewed-on: https://pdfium-review.googlesource.com/7713 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit.cpp9
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp11
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.h3
3 files changed, 4 insertions, 19 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp
index 2f9c5fbea5..8a788dd184 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp
@@ -270,8 +270,7 @@ void CPWL_Edit::GetThisAppearanceStream(std::ostringstream* psAppStream) {
CPVT_WordRange wrSelBefore(wrWhole.BeginPos, wrSelect.BeginPos);
CPVT_WordRange wrSelAfter(wrSelect.EndPos, wrWhole.EndPos);
- CPVT_WordRange wrTemp =
- CPWL_Utils::OverlapWordRange(GetSelectWordRange(), wrVisible);
+ CPVT_WordRange wrTemp = GetSelectWordRange().Intersect(wrVisible);
CFX_ByteString sEditSel =
CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wrTemp);
@@ -279,7 +278,7 @@ void CPWL_Edit::GetThisAppearanceStream(std::ostringstream* psAppStream) {
sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR)
<< sEditSel;
- wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore);
+ wrTemp = wrVisible.Intersect(wrSelBefore);
CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream(
m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
@@ -289,7 +288,7 @@ void CPWL_Edit::GetThisAppearanceStream(std::ostringstream* psAppStream) {
<< CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditBefore
<< "ET\n";
- wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect);
+ wrTemp = wrVisible.Intersect(wrSelect);
CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream(
m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
@@ -299,7 +298,7 @@ void CPWL_Edit::GetThisAppearanceStream(std::ostringstream* psAppStream) {
<< CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1))
<< sEditMid << "ET\n";
- wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter);
+ wrTemp = wrVisible.Intersect(wrSelAfter);
CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(
m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index ed1a94542e..998c95c875 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -18,17 +18,6 @@
#include "fpdfsdk/pdfwindow/cpwl_icon.h"
#include "fpdfsdk/pdfwindow/cpwl_wnd.h"
-CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1,
- const CPVT_WordRange& wr2) {
- if (wr2.EndPos < wr1.BeginPos || wr2.BeginPos > wr1.EndPos ||
- wr1.EndPos < wr2.BeginPos || wr1.BeginPos > wr2.EndPos) {
- return CPVT_WordRange();
- }
-
- return CPVT_WordRange(std::max(wr1.BeginPos, wr2.BeginPos),
- std::min(wr1.EndPos, wr2.EndPos));
-}
-
CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
const float fWidth = crBBox.right - crBBox.left;
const float fHeight = crBBox.top - crBBox.bottom;
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.h b/fpdfsdk/pdfwindow/cpwl_utils.h
index df364c7f56..ec6188e2b9 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.h
+++ b/fpdfsdk/pdfwindow/cpwl_utils.h
@@ -32,9 +32,6 @@ struct CPWL_Color;
class CPWL_Utils {
public:
- static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1,
- const CPVT_WordRange& wr2);
-
static CFX_ByteString GetColorAppStream(const CPWL_Color& color,
const bool& bFillOrStroke = true);
static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect,