Remove CPVT_WordProps

Only one of the props was being used and that prop always had the same
value. This CL removes CPVT_WordProps.

Change-Id: I8cf64f0e9b80c5af18b8fc40ef7b602ffeec7f93
Reviewed-on: https://pdfium-review.googlesource.com/15672
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 1cbc476..3324de7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -370,7 +370,6 @@
     "core/fpdfdoc/cpvt_wordinfo.cpp",
     "core/fpdfdoc/cpvt_wordinfo.h",
     "core/fpdfdoc/cpvt_wordplace.h",
-    "core/fpdfdoc/cpvt_wordprops.h",
     "core/fpdfdoc/cpvt_wordrange.h",
     "core/fpdfdoc/csection.cpp",
     "core/fpdfdoc/csection.h",
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index e22e954..8e5a74e 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -188,27 +188,11 @@
                  pWord->fWordY + pSection->m_SecInfo.rcSection.top));
   word.fAscent = m_pVT->GetWordAscent(*pWord);
   word.fDescent = m_pVT->GetWordDescent(*pWord);
-  if (pWord->pWordProps)
-    word.WordProps = *pWord->pWordProps;
   word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
   word.fFontSize = m_pVT->GetWordFontSize();
   return true;
 }
 
-bool CPDF_VariableText::Iterator::SetWord(const CPVT_Word& word) {
-  if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
-    return false;
-
-  CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
-  if (!pdfium::IndexInBounds(pSection->m_WordArray, m_CurPos.nWordIndex))
-    return false;
-
-  CPVT_WordInfo* pWord = pSection->m_WordArray[m_CurPos.nWordIndex].get();
-  if (pWord->pWordProps)
-    *pWord->pWordProps = word.WordProps;
-  return true;
-}
-
 bool CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
   ASSERT(m_pVT);
   line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
@@ -237,18 +221,6 @@
 
   CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
   section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
-  if (pSection->m_SecInfo.pWordProps)
-    section.WordProps = *pSection->m_SecInfo.pWordProps;
-  return true;
-}
-
-bool CPDF_VariableText::Iterator::SetSection(const CPVT_Section& section) {
-  if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
-    return false;
-
-  CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
-  if (pSection->m_SecInfo.pWordProps)
-    *pSection->m_SecInfo.pWordProps = section.WordProps;
   return true;
 }
 
@@ -310,7 +282,7 @@
   int32_t nFontIndex =
       GetSubWord() > 0 ? GetDefaultFontIndex()
                        : GetWordFontIndex(word, charset, GetDefaultFontIndex());
-  return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, nullptr));
+  return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex));
 }
 
 CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace& place) {
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index f714102..ee68f02 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -27,7 +27,6 @@
 struct CPVT_SectionInfo;
 
 struct CPVT_WordInfo;
-struct CPVT_WordProps;
 
 #define VARIABLETEXT_HALF 0.5f
 
@@ -46,11 +45,9 @@
     bool PrevLine();
     bool NextSection();
     bool PrevSection();
-    bool SetWord(const CPVT_Word& word);
     bool GetWord(CPVT_Word& word) const;
     bool GetLine(CPVT_Line& line) const;
     bool GetSection(CPVT_Section& section) const;
-    bool SetSection(const CPVT_Section& section);
     void SetAt(int32_t nWordIndex);
     void SetAt(const CPVT_WordPlace& place);
     const CPVT_WordPlace& GetAt() const { return m_CurPos; }
diff --git a/core/fpdfdoc/cpvt_section.h b/core/fpdfdoc/cpvt_section.h
index ce8928c..6b2ae07 100644
--- a/core/fpdfdoc/cpvt_section.h
+++ b/core/fpdfdoc/cpvt_section.h
@@ -8,13 +8,11 @@
 #define CORE_FPDFDOC_CPVT_SECTION_H_
 
 #include "core/fpdfdoc/cpvt_wordplace.h"
-#include "core/fpdfdoc/cpvt_wordprops.h"
 #include "core/fxcrt/fx_coordinates.h"
 
 struct CPVT_Section {
   CPVT_WordPlace secplace;
   CFX_FloatRect rcSection;
-  CPVT_WordProps WordProps;
 };
 
 #endif  // CORE_FPDFDOC_CPVT_SECTION_H_
diff --git a/core/fpdfdoc/cpvt_sectioninfo.cpp b/core/fpdfdoc/cpvt_sectioninfo.cpp
index 96ce37d..a23d3e4 100644
--- a/core/fpdfdoc/cpvt_sectioninfo.cpp
+++ b/core/fpdfdoc/cpvt_sectioninfo.cpp
@@ -21,8 +21,4 @@
 
   rcSection = other.rcSection;
   nTotalLine = other.nTotalLine;
-  if (other.pWordProps)
-    pWordProps = pdfium::MakeUnique<CPVT_WordProps>(*other.pWordProps);
-  else
-    pWordProps.reset();
 }
diff --git a/core/fpdfdoc/cpvt_sectioninfo.h b/core/fpdfdoc/cpvt_sectioninfo.h
index 7ebe06c..9483a85 100644
--- a/core/fpdfdoc/cpvt_sectioninfo.h
+++ b/core/fpdfdoc/cpvt_sectioninfo.h
@@ -10,7 +10,6 @@
 #include <memory>
 
 #include "core/fpdfdoc/cpvt_floatrect.h"
-#include "core/fpdfdoc/cpvt_wordprops.h"
 
 struct CPVT_SectionInfo {
   CPVT_SectionInfo();
@@ -21,7 +20,6 @@
 
   CPVT_FloatRect rcSection;
   int32_t nTotalLine;
-  std::unique_ptr<CPVT_WordProps> pWordProps;
 };
 
 #endif  // CORE_FPDFDOC_CPVT_SECTIONINFO_H_
diff --git a/core/fpdfdoc/cpvt_word.h b/core/fpdfdoc/cpvt_word.h
index 28e1924..ad0ba74 100644
--- a/core/fpdfdoc/cpvt_word.h
+++ b/core/fpdfdoc/cpvt_word.h
@@ -8,7 +8,6 @@
 #define CORE_FPDFDOC_CPVT_WORD_H_
 
 #include "core/fpdfdoc/cpvt_wordplace.h"
-#include "core/fpdfdoc/cpvt_wordprops.h"
 #include "core/fxcrt/fx_system.h"
 
 class CPVT_Word {
@@ -24,7 +23,6 @@
   float fWidth;
   int32_t nFontIndex;
   float fFontSize;
-  CPVT_WordProps WordProps;
 };
 
 inline CPVT_Word::CPVT_Word()
diff --git a/core/fpdfdoc/cpvt_wordinfo.cpp b/core/fpdfdoc/cpvt_wordinfo.cpp
index 36859c2..24ad4b8 100644
--- a/core/fpdfdoc/cpvt_wordinfo.cpp
+++ b/core/fpdfdoc/cpvt_wordinfo.cpp
@@ -16,10 +16,7 @@
       fWordTail(0.0f),
       nFontIndex(-1) {}
 
-CPVT_WordInfo::CPVT_WordInfo(uint16_t word,
-                             int32_t charset,
-                             int32_t fontIndex,
-                             CPVT_WordProps* pProps)
+CPVT_WordInfo::CPVT_WordInfo(uint16_t word, int32_t charset, int32_t fontIndex)
     : Word(word),
       nCharset(charset),
       fWordX(0.0f),
@@ -49,8 +46,4 @@
   fWordX = word.fWordX;
   fWordY = word.fWordY;
   fWordTail = word.fWordTail;
-  if (word.pWordProps)
-    pWordProps = pdfium::MakeUnique<CPVT_WordProps>(*word.pWordProps);
-  else
-    pWordProps.reset();
 }
diff --git a/core/fpdfdoc/cpvt_wordinfo.h b/core/fpdfdoc/cpvt_wordinfo.h
index 00f5a45..9b2ec8a 100644
--- a/core/fpdfdoc/cpvt_wordinfo.h
+++ b/core/fpdfdoc/cpvt_wordinfo.h
@@ -9,15 +9,11 @@
 
 #include <memory>
 
-#include "core/fpdfdoc/cpvt_wordprops.h"
 #include "core/fxcrt/fx_system.h"
 
 struct CPVT_WordInfo {
   CPVT_WordInfo();
-  CPVT_WordInfo(uint16_t word,
-                int32_t charset,
-                int32_t fontIndex,
-                CPVT_WordProps* pProps);
+  CPVT_WordInfo(uint16_t word, int32_t charset, int32_t fontIndex);
   CPVT_WordInfo(const CPVT_WordInfo& word);
   ~CPVT_WordInfo();
 
@@ -29,7 +25,6 @@
   float fWordY;
   float fWordTail;
   int32_t nFontIndex;
-  std::unique_ptr<CPVT_WordProps> pWordProps;
 };
 
 #endif  // CORE_FPDFDOC_CPVT_WORDINFO_H_
diff --git a/core/fpdfdoc/cpvt_wordprops.h b/core/fpdfdoc/cpvt_wordprops.h
deleted file mode 100644
index 2d0e5d5..0000000
--- a/core/fpdfdoc/cpvt_wordprops.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FPDFDOC_CPVT_WORDPROPS_H_
-#define CORE_FPDFDOC_CPVT_WORDPROPS_H_
-
-#include "core/fpdfdoc/cpdf_variabletext.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-
-struct CPVT_WordProps {
-  CPVT_WordProps()
-      : nFontIndex(-1),
-        fFontSize(0.0f),
-        dwWordColor(0),
-        nScriptType(CPDF_VariableText::ScriptType::Normal),
-        nWordStyle(0),
-        fCharSpace(0.0f),
-        nHorzScale(0) {}
-
-  CPVT_WordProps(int32_t fontIndex,
-                 float fontSize,
-                 FX_COLORREF wordColor = 0,
-                 CPDF_VariableText::ScriptType scriptType =
-                     CPDF_VariableText::ScriptType::Normal,
-                 int32_t wordStyle = 0,
-                 float charSpace = 0,
-                 int32_t horzScale = 100)
-      : nFontIndex(fontIndex),
-        fFontSize(fontSize),
-        dwWordColor(wordColor),
-        nScriptType(scriptType),
-        nWordStyle(wordStyle),
-        fCharSpace(charSpace),
-        nHorzScale(horzScale) {}
-
-  CPVT_WordProps(const CPVT_WordProps& other)
-      : nFontIndex(other.nFontIndex),
-        fFontSize(other.fFontSize),
-        dwWordColor(other.dwWordColor),
-        nScriptType(other.nScriptType),
-        nWordStyle(other.nWordStyle),
-        fCharSpace(other.fCharSpace),
-        nHorzScale(other.nHorzScale) {}
-
-  int32_t nFontIndex;
-  float fFontSize;
-  FX_COLORREF dwWordColor;
-  CPDF_VariableText::ScriptType nScriptType;
-  int32_t nWordStyle;
-  float fCharSpace;
-  int32_t nHorzScale;
-};
-
-#endif  // CORE_FPDFDOC_CPVT_WORDPROPS_H_
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 1f2bef4..f8b658a 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -9,6 +9,7 @@
 #include <algorithm>
 
 #include "core/fpdfdoc/cline.h"
+#include "core/fpdfdoc/cpdf_variabletext.h"
 #include "core/fpdfdoc/cpvt_wordinfo.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
diff --git a/core/fpdfdoc/csection.h b/core/fpdfdoc/csection.h
index 7c2b70b..d516c45 100644
--- a/core/fpdfdoc/csection.h
+++ b/core/fpdfdoc/csection.h
@@ -12,6 +12,8 @@
 
 #include "core/fpdfdoc/cline.h"
 #include "core/fpdfdoc/cpvt_sectioninfo.h"
+#include "core/fpdfdoc/cpvt_wordinfo.h"
+#include "core/fpdfdoc/cpvt_wordrange.h"
 #include "core/fpdfdoc/ctypeset.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_system.h"
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 856377e..090985e 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -9,6 +9,7 @@
 #include <algorithm>
 
 #include "core/fpdfdoc/cline.h"
+#include "core/fpdfdoc/cpdf_variabletext.h"
 #include "core/fpdfdoc/cpvt_wordinfo.h"
 #include "core/fpdfdoc/csection.h"
 #include "third_party/base/stl_util.h"
@@ -470,22 +471,8 @@
         if (pdfium::IndexInBounds(m_pSection->m_WordArray, w)) {
           CPVT_WordInfo* pWord = m_pSection->m_WordArray[w].get();
           pWord->fWordX = fPosX - fMinX;
-          if (pWord->pWordProps) {
-            switch (pWord->pWordProps->nScriptType) {
-              default:
-              case CPDF_VariableText::ScriptType::Normal:
-                pWord->fWordY = fPosY - fMinY;
-                break;
-              case CPDF_VariableText::ScriptType::Super:
-                pWord->fWordY = fPosY - m_pVT->GetWordAscent(*pWord) - fMinY;
-                break;
-              case CPDF_VariableText::ScriptType::Sub:
-                pWord->fWordY = fPosY - m_pVT->GetWordDescent(*pWord) - fMinY;
-                break;
-            }
-          } else {
-            pWord->fWordY = fPosY - fMinY;
-          }
+          pWord->fWordY = fPosY - fMinY;
+
           fPosX += m_pVT->GetWordWidth(*pWord);
         }
       }
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index b7dc032..11edae6 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -11,7 +11,8 @@
 #include <memory>
 #include <vector>
 
-#include "core/fpdfdoc/cpvt_wordprops.h"
+#include "core/fpdfdoc/cpdf_variabletext.h"
+#include "core/fpdfdoc/cpvt_wordrange.h"
 #include "core/fxcrt/unowned_ptr.h"
 
 #define FX_EDIT_ISLATINWORD(u)                  \
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h
index 885969c..9a725d1 100644
--- a/fpdfsdk/pwl/cpwl_list_box.h
+++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -17,7 +17,6 @@
 class CPWL_ListBox;
 class IPWL_Filler_Notify;
 struct CPVT_WordPlace;
-struct CPVT_WordProps;
 
 class CPWL_List_Notify {
  public: