Spanify more of CFGAS_TxtBreak.

Use string views and spans in place of raw pointers.

Bug: 42271176
Change-Id: I8700cc335cb9a1e68383aea92ed2d961ee018703
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/122413
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 85b13f4..28b44b5 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -510,7 +510,7 @@
 
   CFGAS_TxtBreak::Run tr;
   tr.wsStr = m_wsText.Substr(pPiece->start_char);
-  tr.pWidths = &m_CharWidths[pPiece->start_char];
+  tr.pWidths = pdfium::make_span(m_CharWidths).subspan(pPiece->start_char);
   tr.iLength = pdfium::checked_cast<int32_t>(pPiece->char_count);
   tr.pFont = m_pFont;
   tr.fFontSize = m_fFontSize;
diff --git a/xfa/fgas/layout/cfgas_txtbreak.cpp b/xfa/fgas/layout/cfgas_txtbreak.cpp
index 79e9f17..eca7e44 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak.cpp
@@ -635,8 +635,8 @@
     return 0;
 
   Engine* pEngine = run.pEdtEngine;
-  const wchar_t* pStr = run.wsStr.c_str();
-  int32_t* pWidths = run.pWidths;
+  WideStringView pStr = run.wsStr.AsStringView();
+  pdfium::span<int32_t> pWidths = run.pWidths;
   int32_t iLength = run.iLength - 1;
   RetainPtr<CFGAS_GEFont> pFont = run.pFont;
   Mask<LayoutStyle> dwStyles = run.dwStyles;
@@ -672,8 +672,10 @@
       wch = pEngine->GetChar(iAbsolute);
       iWidth = pEngine->GetWidthOfChar(iAbsolute);
     } else {
-      wch = UNSAFE_TODO(*pStr++);
-      iWidth = UNSAFE_TODO(*pWidths++);
+      wch = pStr.Front();
+      pStr = pStr.Substr(1);
+      iWidth = pWidths.front();
+      pWidths = pWidths.subspan(1);
     }
 
     FX_CHARTYPE chartype = pdfium::unicode::GetCharType(wch);
@@ -702,10 +704,10 @@
           int32_t j = -1;
           do {
             j++;
-            if (i + j >= iLength)
+            if (i + j >= iLength) {
               break;
-
-            wNext = UNSAFE_TODO(pStr[j]);
+            }
+            wNext = pStr[j];
           } while (pdfium::unicode::GetCharType(wNext) ==
                    FX_CHARTYPE::kCombination);
           if (i + j >= iLength)
@@ -734,7 +736,7 @@
               wNext = pEngine->GetChar(iNextAbsolute);
             }
           } else if (i < iLength) {
-            wNext = *pStr;
+            wNext = pStr.Front();
           }
           std::optional<uint16_t> maybe_shadda;
           if (wch == pdfium::arabic::kArabicShadda) {
@@ -882,8 +884,8 @@
     return std::vector<CFX_RectF>();
 
   Engine* pEngine = run.pEdtEngine;
-  const wchar_t* pStr = run.wsStr.c_str();
-  int32_t* pWidths = run.pWidths;
+  WideStringView pStr = run.wsStr.AsStringView();
+  pdfium::span<int32_t> pWidths = run.pWidths;
   int32_t iLength = run.iLength;
   CFX_RectF rect(*run.pRect);
   float fFontSize = run.fFontSize;
@@ -900,8 +902,10 @@
       wch = pEngine->GetChar(iAbsolute);
       iCharSize = pEngine->GetWidthOfChar(iAbsolute);
     } else {
-      wch = UNSAFE_TODO(*pStr++);
-      iCharSize = UNSAFE_TODO(*pWidths++);
+      wch = pStr.Front();
+      pStr = pStr.Substr(1);
+      iCharSize = pWidths.front();
+      pWidths = pWidths.subspan(1);
     }
     float fCharSize = static_cast<float>(iCharSize) / kConversionFactor;
     bool bRet = (!bSingleLine && IsCtrlCode(wch));
diff --git a/xfa/fgas/layout/cfgas_txtbreak.h b/xfa/fgas/layout/cfgas_txtbreak.h
index c7b9931..c4eace4 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.h
+++ b/xfa/fgas/layout/cfgas_txtbreak.h
@@ -12,8 +12,8 @@
 
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/retain_ptr.h"
+#include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr.h"
-#include "core/fxcrt/unowned_ptr_exclusion.h"
 #include "xfa/fgas/layout/cfgas_break.h"
 #include "xfa/fgas/layout/cfgas_char.h"
 
@@ -53,7 +53,7 @@
 
     UnownedPtr<CFGAS_TxtBreak::Engine> pEdtEngine;
     WideString wsStr;
-    UNOWNED_PTR_EXCLUSION int32_t* pWidths = nullptr;
+    pdfium::span<int32_t> pWidths;
     // TODO(thestig): These 2 members probably should be size_t.
     int32_t iStart = 0;
     int32_t iLength = 0;