Remove |CPDF_TextPage::m_bIsParsed|.

All the places that check this boolean will always see it as set to
true.

Change-Id: Idfc4afbcf1c353e08f11ce5758034084807cec66
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65452
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index c9ca92e..e4d3c40 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -112,9 +112,6 @@
 
 void CPDF_LinkExtract::ExtractLinks() {
   m_LinkArray.clear();
-  if (!m_pTextPage->IsParsed())
-    return;
-
   int start = 0;
   int pos = 0;
   bool bAfterHyphen = false;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 38d1a3f..f1617ef 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -255,7 +255,6 @@
   m_TextBuf.SetAllocStep(10240);
   ProcessObject();
 
-  m_bIsParsed = true;
   const int nCount = CountChars();
   if (nCount)
     m_CharIndices.push_back(0);
@@ -315,7 +314,7 @@
 std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
                                                        int nCount) const {
   std::vector<CFX_FloatRect> rects;
-  if (start < 0 || nCount == 0 || !m_bIsParsed)
+  if (start < 0 || nCount == 0)
     return rects;
 
   const int nCharListSize = CountChars();
@@ -359,9 +358,6 @@
 
 int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
                                  const CFX_SizeF& tolerance) const {
-  if (!m_bIsParsed)
-    return -3;
-
   int pos;
   int NearPos = -1;
   double xdif = 5000;
@@ -399,9 +395,6 @@
 
 WideString CPDF_TextPage::GetTextByPredicate(
     const std::function<bool(const PAGECHAR_INFO&)>& predicate) const {
-  if (!m_bIsParsed)
-    return WideString();
-
   float posy = 0;
   bool IsContainPreChar = false;
   bool IsAddLineFeed = false;
@@ -446,7 +439,7 @@
 }
 
 void CPDF_TextPage::GetCharInfo(size_t index, CharInfo* info) const {
-  if (!m_bIsParsed || index >= size())
+  if (index >= size())
     return;
 
   const PAGECHAR_INFO& charinfo = m_CharList[index];
@@ -463,8 +456,8 @@
 }
 
 WideString CPDF_TextPage::GetPageText(int start, int count) const {
-  if (start < 0 || start >= CountChars() || count <= 0 || !m_bIsParsed ||
-      m_CharList.empty() || m_TextBuf.GetLength() == 0) {
+  if (start < 0 || start >= CountChars() || count <= 0 || m_CharList.empty() ||
+      m_TextBuf.GetLength() == 0) {
     return WideString();
   }
 
@@ -506,7 +499,7 @@
 }
 
 int CPDF_TextPage::CountRects(int start, int nCount) {
-  if (!m_bIsParsed || start < 0)
+  if (start < 0)
     return -1;
 
   m_SelRects = GetRectArray(start, nCount);
@@ -514,7 +507,7 @@
 }
 
 bool CPDF_TextPage::GetRect(int rectIndex, CFX_FloatRect* pRect) const {
-  if (!m_bIsParsed || !pdfium::IndexInBounds(m_SelRects, rectIndex))
+  if (!pdfium::IndexInBounds(m_SelRects, rectIndex))
     return false;
 
   *pRect = m_SelRects[rectIndex];
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 2bb8a18..b8f862c 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -81,7 +81,6 @@
   CPDF_TextPage(const CPDF_Page* pPage, bool rtl);
   ~CPDF_TextPage();
 
-  bool IsParsed() const { return m_bIsParsed; }
   int CharIndexFromTextIndex(int text_index) const;
   int TextIndexFromCharIndex(int char_index) const;
   size_t size() const { return m_CharList.size(); }
@@ -159,7 +158,6 @@
   UnownedPtr<CPDF_TextObject> m_pPreTextObj;
   CFX_Matrix m_perMatrix;
   const bool m_rtl;
-  bool m_bIsParsed = false;
   const CFX_Matrix m_DisplayMatrix;
   std::vector<CFX_FloatRect> m_SelRects;
   std::vector<PDFTEXT_Obj> m_LineObj;