Remove out paramenters from CXFA_TextLayout::GetUnderline()

Do the same for GetLineThrough(). Also split off GetPeriod()
from GetUnderline() so each method has a single purpose.

Change-Id: Ie029c6def125047d95dee3b7b454497838d2421f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73451
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 95eddf7..3e60ea9 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -1017,10 +1017,12 @@
       pTP->iBidiLevel = pPiece->m_iBidiLevel;
       pTP->iHorScale = pPiece->m_iHorizontalScale;
       pTP->iVerScale = pPiece->m_iVerticalScale;
-      m_textParser.GetUnderline(m_pTextProvider, pStyle.Get(), pTP->iUnderline,
-                                pTP->iPeriod);
-      m_textParser.GetLinethrough(m_pTextProvider, pStyle.Get(),
-                                  pTP->iLineThrough);
+      pTP->iUnderline =
+          m_textParser.GetUnderline(m_pTextProvider, pStyle.Get());
+      pTP->iPeriod =
+          m_textParser.GetUnderlinePeriod(m_pTextProvider, pStyle.Get());
+      pTP->iLineThrough =
+          m_textParser.GetLinethrough(m_pTextProvider, pStyle.Get());
       pTP->dwColor = m_textParser.GetColor(m_pTextProvider, pStyle.Get());
       pTP->pFont =
           m_textParser.GetFont(m_pDoc.Get(), m_pTextProvider, pStyle.Get());
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index fdbb3cb..fa53a53 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -412,50 +412,42 @@
   return font ? static_cast<int32_t>(font->GetVerticalScale()) : 100;
 }
 
-void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
-                                   const CFX_CSSComputedStyle* pStyle,
-                                   int32_t& iUnderline,
-                                   XFA_AttributeValue& iPeriod) const {
-  iUnderline = 0;
-  iPeriod = XFA_AttributeValue::All;
+int32_t CXFA_TextParser::GetUnderline(
+    CXFA_TextProvider* pTextProvider,
+    const CFX_CSSComputedStyle* pStyle) const {
   CXFA_Font* font = pTextProvider->GetFontIfExists();
-  if (!pStyle) {
-    if (font) {
-      iUnderline = font->GetUnderline();
-      iPeriod = font->GetUnderlinePeriod();
-    }
-    return;
-  }
+  if (!pStyle)
+    return font ? font->GetUnderline() : 0;
 
-  uint32_t dwDecoration = pStyle->GetTextDecoration();
+  const uint32_t dwDecoration = pStyle->GetTextDecoration();
   if (dwDecoration & CFX_CSSTEXTDECORATION_Double)
-    iUnderline = 2;
-  else if (dwDecoration & CFX_CSSTEXTDECORATION_Underline)
-    iUnderline = 1;
-
-  WideString wsValue;
-  if (pStyle->GetCustomStyle(L"underlinePeriod", &wsValue)) {
-    if (wsValue.EqualsASCII("word"))
-      iPeriod = XFA_AttributeValue::Word;
-  } else if (font) {
-    iPeriod = font->GetUnderlinePeriod();
-  }
+    return 2;
+  if (dwDecoration & CFX_CSSTEXTDECORATION_Underline)
+    return 1;
+  return 0;
 }
 
-void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
-                                     const CFX_CSSComputedStyle* pStyle,
-                                     int32_t& iLinethrough) const {
-  iLinethrough = 0;
-  if (pStyle) {
-    uint32_t dwDecoration = pStyle->GetTextDecoration();
-    if (dwDecoration & CFX_CSSTEXTDECORATION_LineThrough)
-      iLinethrough = 1;
-    return;
+XFA_AttributeValue CXFA_TextParser::GetUnderlinePeriod(
+    CXFA_TextProvider* pTextProvider,
+    const CFX_CSSComputedStyle* pStyle) const {
+  WideString wsValue;
+  if (pStyle && pStyle->GetCustomStyle(L"underlinePeriod", &wsValue)) {
+    return wsValue.EqualsASCII("word") ? XFA_AttributeValue::Word
+                                       : XFA_AttributeValue::All;
   }
-
   CXFA_Font* font = pTextProvider->GetFontIfExists();
-  if (font)
-    iLinethrough = font->GetLineThrough();
+  return font ? font->GetUnderlinePeriod() : XFA_AttributeValue::All;
+}
+
+int32_t CXFA_TextParser::GetLinethrough(
+    CXFA_TextProvider* pTextProvider,
+    const CFX_CSSComputedStyle* pStyle) const {
+  if (pStyle) {
+    const uint32_t dwDecoration = pStyle->GetTextDecoration();
+    return (dwDecoration & CFX_CSSTEXTDECORATION_LineThrough) ? 1 : 0;
+  }
+  CXFA_Font* font = pTextProvider->GetFontIfExists();
+  return font ? font->GetLineThrough() : 0;
 }
 
 FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h
index 79753fa..fbae3cf 100644
--- a/xfa/fxfa/cxfa_textparser.h
+++ b/xfa/fxfa/cxfa_textparser.h
@@ -58,20 +58,18 @@
                                   const CFX_CSSComputedStyle* pStyle) const;
   float GetFontSize(CXFA_TextProvider* pTextProvider,
                     const CFX_CSSComputedStyle* pStyle) const;
-
   int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
                       const CFX_CSSComputedStyle* pStyle,
                       const CFX_XMLNode* pXMLNode) const;
   int32_t GetVerScale(CXFA_TextProvider* pTextProvider,
                       const CFX_CSSComputedStyle* pStyle) const;
-
-  void GetUnderline(CXFA_TextProvider* pTextProvider,
-                    const CFX_CSSComputedStyle* pStyle,
-                    int32_t& iUnderline,
-                    XFA_AttributeValue& iPeriod) const;
-  void GetLinethrough(CXFA_TextProvider* pTextProvider,
-                      const CFX_CSSComputedStyle* pStyle,
-                      int32_t& iLinethrough) const;
+  int32_t GetUnderline(CXFA_TextProvider* pTextProvider,
+                       const CFX_CSSComputedStyle* pStyle) const;
+  XFA_AttributeValue GetUnderlinePeriod(
+      CXFA_TextProvider* pTextProvider,
+      const CFX_CSSComputedStyle* pStyle) const;
+  int32_t GetLinethrough(CXFA_TextProvider* pTextProvider,
+                         const CFX_CSSComputedStyle* pStyle) const;
   FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
                    const CFX_CSSComputedStyle* pStyle) const;
   float GetBaseline(CXFA_TextProvider* pTextProvider,