Remove CFX_CSSSyntaxParser::m_iTextDataLen

Clearing the output buffer upon entry rather than upon exit means
that there is no need for a shadow length.

Change-Id: Ida29fe5f9d23ee119a325a34996ef9f9aed20b9e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/66570
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index 2524a38..ab03e8c 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -38,6 +38,7 @@
 }
 
 CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
+  m_Output.Clear();
   if (m_bError)
     return CFX_CSSSyntaxStatus::kError;
 
@@ -74,7 +75,7 @@
           case ',':
             m_Input.MoveNext();
             SwitchMode(SyntaxMode::kSelector);
-            if (m_iTextDataLen > 0)
+            if (m_Output.GetLength() > 0)
               return CFX_CSSSyntaxStatus::kSelector;
             break;
           case '{':
@@ -171,8 +172,7 @@
 }
 
 void CFX_CSSSyntaxParser::SaveTextData() {
-  m_iTextDataLen = m_Output.TrimEnd();
-  m_Output.Clear();
+  m_Output.TrimEnd();
 }
 
 void CFX_CSSSyntaxParser::SwitchMode(SyntaxMode eMode) {
@@ -197,5 +197,5 @@
 }
 
 WideStringView CFX_CSSSyntaxParser::GetCurrentString() const {
-  return WideStringView(m_Output.GetBuffer(), m_iTextDataLen);
+  return WideStringView(m_Output.GetBuffer(), m_Output.GetLength());
 }
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.h b/core/fxcrt/css/cfx_csssyntaxparser.h
index 53630cf..33f3361 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.h
+++ b/core/fxcrt/css/cfx_csssyntaxparser.h
@@ -55,7 +55,6 @@
 
   bool m_bError = false;
   SyntaxMode m_eMode = SyntaxMode::kRuleSet;
-  int32_t m_iTextDataLen = 0;
   CFX_CSSTextBuf m_Output;
   CFX_CSSExtTextBuf m_Input;
   std::stack<SyntaxMode> m_ModeStack;