Fix nits in CPDF_VariableText.

- Simplify Rearrange(). It doesn't need to return anything.
- Remove variables from RearrangeSections() or move them into narrower
  scopes.

Change-Id: Ic7d1a7fc50dd1bae6173e7ff8a80eb3092c75126
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79055
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index b61202b..72fdec5 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -764,7 +764,7 @@
   Rearrange(PlaceRange);
 }
 
-CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange& PlaceRange) {
+void CPDF_VariableText::Rearrange(const CPVT_WordRange& PlaceRange) {
   CPVT_FloatRect rcRet;
   if (IsValid()) {
     if (m_bAutoFontSize) {
@@ -776,7 +776,6 @@
     }
   }
   m_rcContent = rcRet;
-  return rcRet;
 }
 
 float CPDF_VariableText::GetAutoFontSize() {
@@ -817,25 +816,22 @@
 
 CPVT_FloatRect CPDF_VariableText::RearrangeSections(
     const CPVT_WordRange& PlaceRange) {
-  CPVT_WordPlace place;
   float fPosY = 0;
-  float fOldHeight;
-  int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex;
-  int32_t nESecIndex = PlaceRange.EndPos.nSecIndex;
   CPVT_FloatRect rcRet;
   for (int32_t s = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
        s < sz; s++) {
+    CPVT_WordPlace place;
     place.nSecIndex = s;
     CPVT_Section* pSection = m_SectionArray[s].get();
     pSection->SetPlace(place);
     CPVT_FloatRect rcSec = pSection->GetRect();
-    if (s >= nSSecIndex) {
-      if (s <= nESecIndex) {
+    if (s >= PlaceRange.BeginPos.nSecIndex) {
+      if (s <= PlaceRange.EndPos.nSecIndex) {
         rcSec = pSection->Rearrange();
         rcSec.top += fPosY;
         rcSec.bottom += fPosY;
       } else {
-        fOldHeight = pSection->GetRect().bottom - pSection->GetRect().top;
+        float fOldHeight = pSection->GetRect().bottom - pSection->GetRect().top;
         rcSec.top = fPosY;
         rcSec.bottom = fPosY + fOldHeight;
       }
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index 85dcd46..880850b 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -185,7 +185,7 @@
   CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place);
   CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
 
-  CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
+  void Rearrange(const CPVT_WordRange& PlaceRange);
   float GetAutoFontSize();
   bool IsBigger(float fFontSize) const;
   CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);