Update span<> to raw_span<> when used as a class member.

Match what chrome has done for the sake of BRP efficiency.

Change-Id: I8f01efb28a236b0f8e6fc70562cf31cf01e5d175
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117131
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 56ef515..a3f1072 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -30,6 +30,7 @@
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_random.h"
 #include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span_util.h"
 #include "core/fxcrt/stl_util.h"
 
@@ -50,7 +51,7 @@
 
   FX_FILESIZE offset_ = 0;
   DataVector<uint8_t> buffer_;
-  pdfium::span<uint8_t> available_;
+  pdfium::raw_span<uint8_t> available_;
   RetainPtr<IFX_RetainableWriteStream> const backing_file_;
 };
 
diff --git a/core/fpdfapi/font/cpdf_cid2unicodemap.h b/core/fpdfapi/font/cpdf_cid2unicodemap.h
index 9b06c09..9c53f42 100644
--- a/core/fpdfapi/font/cpdf_cid2unicodemap.h
+++ b/core/fpdfapi/font/cpdf_cid2unicodemap.h
@@ -8,7 +8,7 @@
 #define CORE_FPDFAPI_FONT_CPDF_CID2UNICODEMAP_H_
 
 #include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/span.h"
+#include "core/fxcrt/raw_span.h"
 
 class CPDF_CID2UnicodeMap {
  public:
@@ -20,7 +20,7 @@
 
  private:
   const CIDSet m_Charset;
-  const pdfium::span<const uint16_t> m_pEmbeddedMap;
+  const pdfium::raw_span<const uint16_t> m_pEmbeddedMap;
 };
 
 #endif  // CORE_FPDFAPI_FONT_CPDF_CID2UNICODEMAP_H_
diff --git a/core/fpdfapi/font/cpdf_fontglobals.h b/core/fpdfapi/font/cpdf_fontglobals.h
index e04471e..9df50f8 100644
--- a/core/fpdfapi/font/cpdf_fontglobals.h
+++ b/core/fpdfapi/font/cpdf_fontglobals.h
@@ -14,6 +14,7 @@
 
 #include "core/fpdfapi/cmaps/fpdf_cmaps.h"
 #include "core/fpdfapi/font/cpdf_cidfont.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "core/fxge/cfx_fontmapper.h"
@@ -66,9 +67,9 @@
   std::map<ByteString, RetainPtr<const CPDF_CMap>> m_CMaps;
   std::array<std::unique_ptr<CPDF_CID2UnicodeMap>, CIDSET_NUM_SETS>
       m_CID2UnicodeMaps;
-  std::array<pdfium::span<const fxcmap::CMap>, CIDSET_NUM_SETS>
+  std::array<pdfium::raw_span<const fxcmap::CMap>, CIDSET_NUM_SETS>
       m_EmbeddedCharsets;
-  std::array<pdfium::span<const uint16_t>, CIDSET_NUM_SETS>
+  std::array<pdfium::raw_span<const uint16_t>, CIDSET_NUM_SETS>
       m_EmbeddedToUnicodes;
   std::map<UnownedPtr<CPDF_Document>,
            std::unique_ptr<CFX_StockFontArray>,
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index 5c455b1..b4efb88 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -181,7 +181,7 @@
   const size_t buffer_size = safe_size.ValueOrDie();
   auto buffer = FixedSizeDataVector<uint8_t>::TryZeroed(buffer_size);
   if (buffer.empty()) {
-    m_Data.emplace<pdfium::span<const uint8_t>>();
+    m_Data.emplace<pdfium::raw_span<const uint8_t>>();
     return Stage::kComplete;
   }
 
@@ -274,5 +274,5 @@
   if (is_owned()) {
     return absl::get<FixedSizeDataVector<uint8_t>>(m_Data).span();
   }
-  return absl::get<pdfium::span<const uint8_t>>(m_Data);
+  return absl::get<pdfium::raw_span<const uint8_t>>(m_Data);
 }
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h
index 059992c..c2ed273 100644
--- a/core/fpdfapi/page/cpdf_contentparser.h
+++ b/core/fpdfapi/page/cpdf_contentparser.h
@@ -15,6 +15,7 @@
 #include "core/fpdfapi/page/cpdf_form.h"
 #include "core/fpdfapi/page/cpdf_streamcontentparser.h"
 #include "core/fxcrt/fixed_size_data_vector.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "third_party/abseil-cpp/absl/types/variant.h"
@@ -74,7 +75,7 @@
   RetainPtr<CPDF_StreamAcc> m_pSingleStream;
   std::vector<RetainPtr<CPDF_StreamAcc>> m_StreamArray;
   std::vector<uint32_t> m_StreamSegmentOffsets;
-  absl::variant<pdfium::span<const uint8_t>, FixedSizeDataVector<uint8_t>>
+  absl::variant<pdfium::raw_span<const uint8_t>, FixedSizeDataVector<uint8_t>>
       m_Data;
   uint32_t m_nStreams = 0;
   uint32_t m_CurrentOffset = 0;
diff --git a/core/fpdfapi/page/cpdf_transferfuncdib.h b/core/fpdfapi/page/cpdf_transferfuncdib.h
index 95ac7dc..36cf84d 100644
--- a/core/fpdfapi/page/cpdf_transferfuncdib.h
+++ b/core/fpdfapi/page/cpdf_transferfuncdib.h
@@ -10,6 +10,7 @@
 #include <stdint.h>
 
 #include "core/fxcrt/data_vector.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "core/fxge/dib/cfx_dibbase.h"
@@ -33,9 +34,9 @@
 
   RetainPtr<CFX_DIBBase> const m_pSrc;
   RetainPtr<CPDF_TransferFunc> const m_pTransferFunc;
-  const pdfium::span<const uint8_t> m_RampR;
-  const pdfium::span<const uint8_t> m_RampG;
-  const pdfium::span<const uint8_t> m_RampB;
+  const pdfium::raw_span<const uint8_t> m_RampR;
+  const pdfium::raw_span<const uint8_t> m_RampG;
+  const pdfium::raw_span<const uint8_t> m_RampB;
   mutable DataVector<uint8_t> m_Scanline;
 };
 
diff --git a/core/fpdfapi/parser/cpdf_flateencoder.cpp b/core/fpdfapi/parser/cpdf_flateencoder.cpp
index cbe3fa4..05dd872 100644
--- a/core/fpdfapi/parser/cpdf_flateencoder.cpp
+++ b/core/fpdfapi/parser/cpdf_flateencoder.cpp
@@ -81,5 +81,5 @@
 pdfium::span<const uint8_t> CPDF_FlateEncoder::GetSpan() const {
   if (is_owned())
     return absl::get<DataVector<uint8_t>>(m_Data);
-  return absl::get<pdfium::span<const uint8_t>>(m_Data);
+  return absl::get<pdfium::raw_span<const uint8_t>>(m_Data);
 }
diff --git a/core/fpdfapi/parser/cpdf_flateencoder.h b/core/fpdfapi/parser/cpdf_flateencoder.h
index 0a871d5..0e60d47 100644
--- a/core/fpdfapi/parser/cpdf_flateencoder.h
+++ b/core/fpdfapi/parser/cpdf_flateencoder.h
@@ -10,6 +10,7 @@
 #include <stdint.h>
 
 #include "core/fxcrt/data_vector.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "third_party/abseil-cpp/absl/types/variant.h"
@@ -42,7 +43,7 @@
   // Must outlive `m_Data`.
   RetainPtr<CPDF_StreamAcc> const m_pAcc;
 
-  absl::variant<pdfium::span<const uint8_t>, DataVector<uint8_t>> m_Data;
+  absl::variant<pdfium::raw_span<const uint8_t>, DataVector<uint8_t>> m_Data;
 
   // Only one of these two pointers is valid at any time.
   RetainPtr<const CPDF_Dictionary> m_pDict;
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index f765784..2fc9526 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -94,7 +94,7 @@
   if (is_owned())
     return std::move(absl::get<DataVector<uint8_t>>(m_Data));
 
-  auto span = absl::get<pdfium::span<const uint8_t>>(m_Data);
+  auto span = absl::get<pdfium::raw_span<const uint8_t>>(m_Data);
   return DataVector<uint8_t>(span.begin(), span.end());
 }
 
@@ -121,7 +121,7 @@
   if (dwSrcSize == 0)
     return;
 
-  absl::variant<pdfium::span<const uint8_t>, DataVector<uint8_t>> src_data;
+  absl::variant<pdfium::raw_span<const uint8_t>, DataVector<uint8_t>> src_data;
   pdfium::span<const uint8_t> src_span;
   if (m_pStream->IsMemoryBased()) {
     src_span = m_pStream->GetInMemoryRawData();
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 73db636..d435150 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -13,6 +13,7 @@
 
 #include "core/fxcrt/bytestring.h"
 #include "core/fxcrt/data_vector.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "third_party/abseil-cpp/absl/types/variant.h"
@@ -63,7 +64,7 @@
   RetainPtr<const CPDF_Dictionary> m_pImageParam;
   // Needs to outlive `m_Data` when the data is not owned.
   RetainPtr<const CPDF_Stream> const m_pStream;
-  absl::variant<pdfium::span<const uint8_t>, DataVector<uint8_t>> m_Data;
+  absl::variant<pdfium::raw_span<const uint8_t>, DataVector<uint8_t>> m_Data;
 };
 
 #endif  // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_
diff --git a/core/fxcodec/basic/basicmodule.cpp b/core/fxcodec/basic/basicmodule.cpp
index a8ad12e..062c8dd 100644
--- a/core/fxcodec/basic/basicmodule.cpp
+++ b/core/fxcodec/basic/basicmodule.cpp
@@ -16,6 +16,7 @@
 #include "core/fxcrt/fx_memory_wrappers.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/numerics/safe_conversions.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span_util.h"
 
 namespace fxcodec {
@@ -44,7 +45,7 @@
   void UpdateOperator(uint8_t used_bytes);
 
   DataVector<uint8_t> m_Scanline;
-  pdfium::span<const uint8_t> m_SrcBuf;
+  pdfium::raw_span<const uint8_t> m_SrcBuf;
   size_t m_dwLineBytes = 0;
   size_t m_SrcOffset = 0;
   bool m_bEOD = false;
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index 8420dc0..77801d7 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -22,6 +22,7 @@
 #include "core/fxcrt/fx_2d_size.h"
 #include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/numerics/safe_conversions.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/span_util.h"
 #include "core/fxge/calculate_pitch.h"
@@ -495,7 +496,7 @@
   bool m_bByteAlign = false;
   const bool m_bEndOfLine;
   const bool m_bBlack;
-  const pdfium::span<const uint8_t> m_SrcSpan;
+  const pdfium::raw_span<const uint8_t> m_SrcSpan;
   DataVector<uint8_t> m_ScanlineBuf;
   DataVector<uint8_t> m_RefBuf;
 };
@@ -707,7 +708,7 @@
   // Must outlive `m_RefLineSpan`.
   const DataVector<uint8_t> m_InitialRefLine;
   DataVector<uint8_t> m_LineBuf;
-  pdfium::span<const uint8_t> m_RefLineSpan;
+  pdfium::raw_span<const uint8_t> m_RefLineSpan;
 };
 
 FaxEncoder::FaxEncoder(RetainPtr<const CFX_DIBBase> src)
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index 6f25759..ecfc41c 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -24,6 +24,7 @@
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/notreached.h"
 #include "core/fxcrt/numerics/safe_conversions.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/span_util.h"
 #include "core/fxge/calculate_pitch.h"
@@ -131,7 +132,7 @@
   void DecodeString(uint32_t code);
   void ExpandDestBuf(uint32_t additional_size);
 
-  pdfium::span<const uint8_t> const src_span_;
+  pdfium::raw_span<const uint8_t> const src_span_;
   std::unique_ptr<uint8_t, FxFreeDeleter> dest_buf_;
   uint32_t src_bit_pos_ = 0;
   uint32_t dest_buf_size_ = 0;  // Actual allocated size.
@@ -641,7 +642,7 @@
 
  protected:
   std::unique_ptr<z_stream, FlateDeleter> m_pFlate;
-  const pdfium::span<const uint8_t> m_SrcBuf;
+  const pdfium::raw_span<const uint8_t> m_SrcBuf;
   DataVector<uint8_t> m_Scanline;
 };
 
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h
index f6e2541..cc61dd1 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.h
+++ b/core/fxcodec/jbig2/JBig2_BitStream.h
@@ -7,6 +7,7 @@
 #ifndef CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
 #define CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 
@@ -46,7 +47,7 @@
   void AdvanceBit();
   uint32_t LengthInBits() const;
 
-  const pdfium::span<const uint8_t> m_Span;
+  const pdfium::raw_span<const uint8_t> m_Span;
   uint32_t m_dwByteIdx = 0;
   uint32_t m_dwBitIdx = 0;
   const uint64_t m_Key;
diff --git a/core/fxcodec/jbig2/jbig2_decoder.h b/core/fxcodec/jbig2/jbig2_decoder.h
index 868f1d1..bdaa5ef 100644
--- a/core/fxcodec/jbig2/jbig2_decoder.h
+++ b/core/fxcodec/jbig2/jbig2_decoder.h
@@ -10,6 +10,7 @@
 #include <memory>
 
 #include "core/fxcodec/fx_codec_def.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr_exclusion.h"
 
@@ -28,8 +29,8 @@
   uint32_t m_height = 0;
   uint64_t m_nGlobalKey = 0;
   uint64_t m_nSrcKey = 0;
-  pdfium::span<const uint8_t> m_pGlobalSpan;
-  pdfium::span<const uint8_t> m_pSrcSpan;
+  pdfium::raw_span<const uint8_t> m_pGlobalSpan;
+  pdfium::raw_span<const uint8_t> m_pSrcSpan;
   UNOWNED_PTR_EXCLUSION uint8_t* m_dest_buf = nullptr;
   uint32_t m_dest_pitch = 0;
   std::unique_ptr<CJBig2_Context> m_pContext;
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index ea1b32f..81c408f 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -22,6 +22,7 @@
 #include "core/fxcrt/check_op.h"
 #include "core/fxcrt/data_vector.h"
 #include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxge/dib/cfx_dibbase.h"
 #include "core/fxge/dib/fx_dib.h"
 
@@ -157,7 +158,7 @@
   jpeg_decompress_struct m_Cinfo;
   jpeg_error_mgr m_Jerr;
   jpeg_source_mgr m_Src;
-  pdfium::span<const uint8_t> m_SrcSpan;
+  pdfium::raw_span<const uint8_t> m_SrcSpan;
   DataVector<uint8_t> m_ScanlineBuf;
   bool m_bInited = false;
   bool m_bStarted = false;
diff --git a/core/fxcodec/jpx/cjpx_decoder.h b/core/fxcodec/jpx/cjpx_decoder.h
index f4db416..aaf5301 100644
--- a/core/fxcodec/jpx/cjpx_decoder.h
+++ b/core/fxcodec/jpx/cjpx_decoder.h
@@ -11,6 +11,7 @@
 
 #include <memory>
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr.h"
 
@@ -79,7 +80,7 @@
             uint8_t resolution_levels_to_skip);
 
   const ColorSpaceOption m_ColorSpaceOption;
-  pdfium::span<const uint8_t> m_SrcData;
+  pdfium::raw_span<const uint8_t> m_SrcData;
   UnownedPtr<opj_image_t> m_Image;
   UnownedPtr<opj_codec_t> m_Codec;
   std::unique_ptr<DecodeData> m_DecodeData;
diff --git a/core/fxcodec/scanlinedecoder.h b/core/fxcodec/scanlinedecoder.h
index 482a279..d836b47 100644
--- a/core/fxcodec/scanlinedecoder.h
+++ b/core/fxcodec/scanlinedecoder.h
@@ -9,6 +9,7 @@
 
 #include <stdint.h>
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 
 class PauseIndicatorIface;
@@ -49,7 +50,7 @@
   int m_bpc;
   uint32_t m_Pitch;
   int m_NextLine = -1;
-  pdfium::span<uint8_t> m_pLastScanline;
+  pdfium::raw_span<uint8_t> m_pLastScanline;
 };
 
 }  // namespace fxcodec
diff --git a/core/fxcrt/cfx_bitstream.h b/core/fxcrt/cfx_bitstream.h
index 186b79a..0502b89 100644
--- a/core/fxcrt/cfx_bitstream.h
+++ b/core/fxcrt/cfx_bitstream.h
@@ -10,6 +10,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 
 class CFX_BitStream {
@@ -33,7 +34,7 @@
  private:
   size_t m_BitPos = 0;
   const size_t m_BitSize;
-  pdfium::span<const uint8_t> const m_pData;
+  pdfium::raw_span<const uint8_t> const m_pData;
 };
 
 #endif  // CORE_FXCRT_CFX_BITSTREAM_H_
diff --git a/core/fxcrt/cfx_read_only_span_stream.h b/core/fxcrt/cfx_read_only_span_stream.h
index 5b786b2..b66e6e3 100644
--- a/core/fxcrt/cfx_read_only_span_stream.h
+++ b/core/fxcrt/cfx_read_only_span_stream.h
@@ -8,6 +8,7 @@
 #define CORE_FXCRT_CFX_READ_ONLY_SPAN_STREAM_H_
 
 #include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 
@@ -24,7 +25,7 @@
   explicit CFX_ReadOnlySpanStream(pdfium::span<const uint8_t> span);
   ~CFX_ReadOnlySpanStream() override;
 
-  const pdfium::span<const uint8_t> span_;
+  const pdfium::raw_span<const uint8_t> span_;
 };
 
 #endif  // CORE_FXCRT_CFX_READ_ONLY_SPAN_STREAM_H_
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index 341b34a..0730ae7 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -16,6 +16,7 @@
 
 #include "core/fxcrt/fx_memcpy_wrappers.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 
 namespace fxcrt {
@@ -266,7 +267,7 @@
   }
 
  protected:
-  pdfium::span<const UnsignedType> m_Span;
+  pdfium::raw_span<const UnsignedType> m_Span;
 
  private:
   void* operator new(size_t) throw() { return nullptr; }
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 4b9f7e4..ad40331 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -17,6 +17,7 @@
 #include "core/fxcrt/data_vector.h"
 #include "core/fxcrt/fx_codepage_forward.h"
 #include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr_exclusion.h"
@@ -124,7 +125,7 @@
   FontType GetFontType() const { return m_FontType; }
   void SetFontType(FontType type) { m_FontType = type; }
   uint64_t GetObjectTag() const { return m_ObjectTag; }
-  pdfium::span<uint8_t> GetFontSpan() const { return m_FontData; }
+  pdfium::raw_span<uint8_t> GetFontSpan() const { return m_FontData; }
   std::unique_ptr<CFX_Path> LoadGlyphPathImpl(uint32_t glyph_index,
                                               int dest_width) const;
   int GetGlyphWidthImpl(uint32_t glyph_index, int dest_width, int weight) const;
@@ -157,7 +158,7 @@
   mutable RetainPtr<CFX_GlyphCache> m_GlyphCache;
   std::unique_ptr<CFX_SubstFont> m_pSubstFont;
   DataVector<uint8_t> m_FontDataAllocation;
-  pdfium::span<uint8_t> m_FontData;
+  pdfium::raw_span<uint8_t> m_FontData;
   FontType m_FontType = FontType::kUnknown;
   uint64_t m_ObjectTag = 0;
   bool m_bVertical = false;
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
index 17eccad..2b3ab92 100644
--- a/core/fxge/dib/cstretchengine.h
+++ b/core/fxge/dib/cstretchengine.h
@@ -14,8 +14,8 @@
 #include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
-#include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "core/fxge/dib/fx_dib.h"
 
@@ -142,7 +142,7 @@
   const int m_SrcBpp;
   const bool m_bHasAlpha;
   RetainPtr<const CFX_DIBBase> const m_pSource;
-  pdfium::span<const uint32_t> m_pSrcPalette;
+  pdfium::raw_span<const uint32_t> m_pSrcPalette;
   const int m_SrcWidth;
   const int m_SrcHeight;
   UnownedPtr<ScanlineComposerIface> const m_pDestBitmap;
diff --git a/core/fxge/win32/cwin32_platform.cpp b/core/fxge/win32/cwin32_platform.cpp
index 31b1d33..5b6a4bc 100644
--- a/core/fxge/win32/cwin32_platform.cpp
+++ b/core/fxge/win32/cwin32_platform.cpp
@@ -15,6 +15,7 @@
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/numerics/safe_conversions.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/win/scoped_select_object.h"
 #include "core/fxcrt/win/win_util.h"
@@ -25,7 +26,7 @@
 
 struct Variant {
   const char* m_pFaceName;
-  pdfium::span<const char> m_pVariantName;
+  pdfium::raw_span<const char> m_pVariantName;
 };
 
 constexpr Variant kVariantNames[] = {
diff --git a/testing/test_loader.h b/testing/test_loader.h
index 680092c..ee0c821 100644
--- a/testing/test_loader.h
+++ b/testing/test_loader.h
@@ -7,6 +7,7 @@
 
 #include <stdint.h>
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 
 class TestLoader {
@@ -19,7 +20,7 @@
                       unsigned long size);
 
  private:
-  const pdfium::span<const uint8_t> m_Span;
+  const pdfium::raw_span<const uint8_t> m_Span;
 };
 
 #endif  // TESTING_TEST_LOADER_H_
diff --git a/xfa/fgas/crt/cfgas_stringformatter.h b/xfa/fgas/crt/cfgas_stringformatter.h
index c7d9b56..6d6442c 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.h
+++ b/xfa/fgas/crt/cfgas_stringformatter.h
@@ -9,6 +9,7 @@
 
 #include <vector>
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/widestring.h"
 #include "xfa/fgas/crt/locale_iface.h"
@@ -83,8 +84,11 @@
                                  WideString* wsDatePattern,
                                  WideString* wsTimePattern) const;
 
-  const WideString m_wsPattern;                   // keep pattern string alive.
-  const pdfium::span<const wchar_t> m_spPattern;  // span into |m_wsPattern|.
+  // keep pattern string alive.
+  const WideString m_wsPattern;
+
+  // span into `m_wsPattern`.
+  const pdfium::raw_span<const wchar_t> m_spPattern;
 };
 
 #endif  // XFA_FGAS_CRT_CFGAS_STRINGFORMATTER_H_
diff --git a/xfa/fxfa/formcalc/cxfa_fmlexer.h b/xfa/fxfa/formcalc/cxfa_fmlexer.h
index 926d1ba..03f6d05 100644
--- a/xfa/fxfa/formcalc/cxfa_fmlexer.h
+++ b/xfa/fxfa/formcalc/cxfa_fmlexer.h
@@ -7,6 +7,7 @@
 #ifndef XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
 #define XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
 
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/widestring.h"
 #include "v8/include/cppgc/macros.h"
 
@@ -118,7 +119,7 @@
 
   void RaiseError() { m_bLexerError = true; }
 
-  pdfium::span<const wchar_t> m_spInput;
+  pdfium::raw_span<const wchar_t> m_spInput;
   size_t m_nCursor = 0;
   bool m_bLexerError = false;
 };
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index ff996b7..6fa6672 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -16,6 +16,7 @@
 
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/mask.h"
+#include "core/fxcrt/raw_span.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 #include "core/fxcrt/unowned_ptr.h"
@@ -526,8 +527,8 @@
   bool m_bIsNull = true;
   bool m_bPreNull = true;
   bool is_widget_ready_ = false;
-  const pdfium::span<const PropertyData> m_Properties;
-  const pdfium::span<const AttributeData> m_Attributes;
+  const pdfium::raw_span<const PropertyData> m_Properties;
+  const pdfium::raw_span<const AttributeData> m_Attributes;
   const Mask<XFA_XDPPACKET> m_ValidPackets;
   UnownedPtr<CFX_XMLNode> xml_node_;
   const XFA_PacketType m_ePacket;