diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-19 11:11:00 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-19 15:23:03 +0000 |
commit | d13f24c08debb293e794ba5a66dd449adf4bc2c8 (patch) | |
tree | a50b33ece47e231d155ac82e2b3cb25f8e242fec /xfa | |
parent | 0264e97bceaca69d0b0232ac680bd7b26e2db66a (diff) | |
download | pdfium-d13f24c08debb293e794ba5a66dd449adf4bc2c8.tar.xz |
Invert flag to CFDE_TextEditEngine::Iterator::IsEOF
This CL changes the IsEOF flag to match the semantics of the
FindNextBreakPos flag.
Change-Id: I1a8aba91171baeacf80bdea4b9468d6093599c90
Reviewed-on: https://pdfium-review.googlesource.com/14291
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_texteditengine.cpp | 20 | ||||
-rw-r--r-- | xfa/fde/cfde_texteditengine.h | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp index 0c64e39aeb..a28aeb5f6c 100644 --- a/xfa/fde/cfde_texteditengine.cpp +++ b/xfa/fde/cfde_texteditengine.cpp @@ -840,12 +840,12 @@ void CFDE_TextEditEngine::RebuildPieces() { contents_bounding_box_ = CFX_RectF(); auto iter = pdfium::MakeUnique<CFDE_TextEditEngine::Iterator>(this); - while (!iter->IsEOF(true)) { + while (!iter->IsEOF(false)) { iter->Next(false); CFX_BreakType break_status = text_break_.AppendChar( password_mode_ ? password_alias_ : iter->GetChar()); - if (iter->IsEOF(true) && CFX_BreakTypeNoneOrPiece(break_status)) + if (iter->IsEOF(false) && CFX_BreakTypeNoneOrPiece(break_status)) break_status = text_break_.EndBreak(CFX_BreakType::Paragraph); if (CFX_BreakTypeNoneOrPiece(break_status)) @@ -1019,19 +1019,19 @@ int32_t CFDE_TextEditEngine::Iterator::GetAt() const { return current_position_; } -bool CFDE_TextEditEngine::Iterator::IsEOF(bool bTail) const { - return bTail ? current_position_ > -1 && +bool CFDE_TextEditEngine::Iterator::IsEOF(bool bPrev) const { + return bPrev ? current_position_ == -1 + : current_position_ > -1 && static_cast<size_t>(current_position_) == - engine_->GetLength() - : current_position_ == -1; + engine_->GetLength(); } void CFDE_TextEditEngine::Iterator::FindNextBreakPos(bool bPrev) { - if (IsEOF(!bPrev)) + if (IsEOF(bPrev)) return; WordBreakProperty ePreType = WordBreakProperty::kNone; - if (!IsEOF(bPrev)) { + if (!IsEOF(!bPrev)) { Next(!bPrev); ePreType = GetWordBreakProperty(GetChar()); Next(bPrev); @@ -1045,7 +1045,7 @@ void CFDE_TextEditEngine::Iterator::FindNextBreakPos(bool bPrev) { WordBreakProperty eNextType = GetWordBreakProperty(GetChar()); bool wBreak = CheckStateChangeForWordBreak(eCurType, eNextType); if (wBreak) { - if (IsEOF(!bPrev)) { + if (IsEOF(bPrev)) { Next(!bPrev); return; } @@ -1080,5 +1080,5 @@ void CFDE_TextEditEngine::Iterator::FindNextBreakPos(bool bPrev) { ePreType = eCurType; eCurType = eNextType; bFirst = false; - } while (!IsEOF(!bPrev)); + } while (!IsEOF(bPrev)); } diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h index 40f12e5f76..fc5a5fb490 100644 --- a/xfa/fde/cfde_texteditengine.h +++ b/xfa/fde/cfde_texteditengine.h @@ -47,7 +47,7 @@ class CFDE_TextEditEngine { void SetAt(int32_t nIndex); int32_t GetAt() const; void FindNextBreakPos(bool bPrev); - bool IsEOF(bool bTail) const; + bool IsEOF(bool bPrev) const; private: CFX_UnownedPtr<const CFDE_TextEditEngine> engine_; |