Convert to absl::optional, part 1.

Search and replace. Then clang-format. Leave the headers alone for now.

Bug: pdfium:1726
Change-Id: I14612c871e16dd2fc0c69555171a55b71fa937cd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85517
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 10ed004..8740268 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -479,7 +479,8 @@
   }
 
   ByteString name;
-  Optional<ByteString> maybe_name = m_pObjHolder->GraphicsMapSearch(graphD);
+  absl::optional<ByteString> maybe_name =
+      m_pObjHolder->GraphicsMapSearch(graphD);
   if (maybe_name.has_value()) {
     name = std::move(maybe_name.value());
   } else {
@@ -516,7 +517,7 @@
   defaultGraphics.strokeAlpha = 1.0f;
   defaultGraphics.blendType = BlendMode::kNormal;
 
-  Optional<ByteString> maybe_name =
+  absl::optional<ByteString> maybe_name =
       m_pObjHolder->GraphicsMapSearch(defaultGraphics);
   if (maybe_name.has_value())
     return maybe_name.value();
@@ -560,7 +561,7 @@
   data.baseFont = pFont->GetBaseFontName();
 
   ByteString dictName;
-  Optional<ByteString> maybe_name = m_pObjHolder->FontsMapSearch(data);
+  absl::optional<ByteString> maybe_name = m_pObjHolder->FontsMapSearch(data);
   if (maybe_name.has_value()) {
     dictName = std::move(maybe_name.value());
   } else {
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index b948e60..9e9c02c 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -60,7 +60,7 @@
 
 uint32_t CFX_CTTGSUBTable::GetVerticalGlyph(uint32_t glyphnum) const {
   for (uint32_t item : m_featureSet) {
-    Optional<uint32_t> result =
+    absl::optional<uint32_t> result =
         GetVerticalGlyphSub(FeatureList[item], glyphnum);
     if (result.has_value())
       return result.value();
@@ -68,7 +68,7 @@
   return 0;
 }
 
-Optional<uint32_t> CFX_CTTGSUBTable::GetVerticalGlyphSub(
+absl::optional<uint32_t> CFX_CTTGSUBTable::GetVerticalGlyphSub(
     const TFeatureRecord& feature,
     uint32_t glyphnum) const {
   for (int index : feature.LookupListIndices) {
@@ -76,7 +76,7 @@
       continue;
     if (LookupList[index].LookupType != 1)
       continue;
-    Optional<uint32_t> result =
+    absl::optional<uint32_t> result =
         GetVerticalGlyphSub2(LookupList[index], glyphnum);
     if (result.has_value())
       return result.value();
@@ -84,7 +84,7 @@
   return absl::nullopt;
 }
 
-Optional<uint32_t> CFX_CTTGSUBTable::GetVerticalGlyphSub2(
+absl::optional<uint32_t> CFX_CTTGSUBTable::GetVerticalGlyphSub2(
     const TLookup& lookup,
     uint32_t glyphnum) const {
   for (const auto& subTable : lookup.SubTables) {
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.h b/core/fpdfapi/font/cfx_cttgsubtable.h
index 6dc9860..2534112 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.h
+++ b/core/fpdfapi/font/cfx_cttgsubtable.h
@@ -137,10 +137,10 @@
   std::unique_ptr<TSubTable1> ParseSingleSubstFormat1(FT_Bytes raw);
   std::unique_ptr<TSubTable2> ParseSingleSubstFormat2(FT_Bytes raw);
 
-  Optional<uint32_t> GetVerticalGlyphSub(const TFeatureRecord& feature,
-                                         uint32_t glyphnum) const;
-  Optional<uint32_t> GetVerticalGlyphSub2(const TLookup& lookup,
-                                          uint32_t glyphnum) const;
+  absl::optional<uint32_t> GetVerticalGlyphSub(const TFeatureRecord& feature,
+                                               uint32_t glyphnum) const;
+  absl::optional<uint32_t> GetVerticalGlyphSub2(const TLookup& lookup,
+                                                uint32_t glyphnum) const;
   int GetCoverageIndex(TCoverageFormatBase* Coverage, uint32_t g) const;
 
   uint8_t GetUInt8(FT_Bytes& p) const;
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 706903e8..8f0a5fc 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -115,7 +115,7 @@
       return;
 
     if (m_CodeSeq % 2) {
-      Optional<CPDF_CMap::CodeRange> range =
+      absl::optional<CPDF_CMap::CodeRange> range =
           GetCodeRange(m_LastWord.AsStringView(), word);
       if (range.has_value())
         m_PendingRanges.push_back(range.value());
@@ -164,7 +164,7 @@
 }
 
 // static
-Optional<CPDF_CMap::CodeRange> CPDF_CMapParser::GetCodeRange(
+absl::optional<CPDF_CMap::CodeRange> CPDF_CMapParser::GetCodeRange(
     ByteStringView first,
     ByteStringView second) {
   if (first.IsEmpty() || first[0] != '<')
diff --git a/core/fpdfapi/font/cpdf_cmapparser.h b/core/fpdfapi/font/cpdf_cmapparser.h
index b2454af..4635212 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.h
+++ b/core/fpdfapi/font/cpdf_cmapparser.h
@@ -43,8 +43,9 @@
   void HandleCodeSpaceRange(ByteStringView word);
 
   static uint32_t GetCode(ByteStringView word);
-  static Optional<CPDF_CMap::CodeRange> GetCodeRange(ByteStringView first,
-                                                     ByteStringView second);
+  static absl::optional<CPDF_CMap::CodeRange> GetCodeRange(
+      ByteStringView first,
+      ByteStringView second);
 
   Status m_Status = kStart;
   int m_CodeSeq = 0;
diff --git a/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp b/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp
index da654f3..cb2a619 100644
--- a/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp
@@ -37,7 +37,7 @@
 }
 
 TEST(cpdf_cmapparser, GetCodeRange) {
-  Optional<CPDF_CMap::CodeRange> range;
+  absl::optional<CPDF_CMap::CodeRange> range;
 
   // Must start with a <
   range = CPDF_CMapParser::GetCodeRange("", "");
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 389af8a..f8c8a28 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -279,7 +279,7 @@
 RetainPtr<CPDF_Font> CPDF_Font::GetStockFont(CPDF_Document* pDoc,
                                              ByteStringView name) {
   ByteString fontname(name);
-  Optional<CFX_FontMapper::StandardFont> font_id =
+  absl::optional<CFX_FontMapper::StandardFont> font_id =
       CFX_FontMapper::GetStandardFontName(&fontname);
   if (!font_id.has_value())
     return nullptr;
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 722726c..160d497 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -42,7 +42,7 @@
     virtual void ParseContentForType3Char(CPDF_Type3Char* pChar) = 0;
     virtual bool HasPageObjects() const = 0;
     virtual CFX_FloatRect CalcBoundingBox() const = 0;
-    virtual Optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
+    virtual absl::optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
     GetBitmapAndMatrixFromSoleImageOfForm() const = 0;
   };
 
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index d2dcb73..348cdb8 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -72,7 +72,7 @@
 }
 
 // static
-Optional<uint32_t> CPDF_ToUnicodeMap::StringToCode(ByteStringView str) {
+absl::optional<uint32_t> CPDF_ToUnicodeMap::StringToCode(ByteStringView str) {
   size_t len = str.GetLength();
   if (len <= 2 || str[0] != '<' || str[len - 1] != '>')
     return absl::nullopt;
@@ -86,7 +86,7 @@
     if (!code.IsValid())
       return absl::nullopt;
   }
-  return Optional<uint32_t>(code.ValueOrDie());
+  return absl::optional<uint32_t>(code.ValueOrDie());
 }
 
 // static
@@ -148,7 +148,7 @@
     if (word.IsEmpty() || word == "endbfchar")
       return;
 
-    Optional<uint32_t> code = StringToCode(word);
+    absl::optional<uint32_t> code = StringToCode(word);
     if (!code.has_value())
       return;
 
@@ -162,12 +162,12 @@
     if (lowcode_str.IsEmpty() || lowcode_str == "endbfrange")
       return;
 
-    Optional<uint32_t> lowcode_opt = StringToCode(lowcode_str);
+    absl::optional<uint32_t> lowcode_opt = StringToCode(lowcode_str);
     if (!lowcode_opt.has_value())
       return;
 
     ByteStringView highcode_str = pParser->GetWord();
-    Optional<uint32_t> highcode_opt = StringToCode(highcode_str);
+    absl::optional<uint32_t> highcode_opt = StringToCode(highcode_str);
     if (!highcode_opt.has_value())
       return;
 
@@ -184,7 +184,7 @@
 
     WideString destcode = StringToWideString(start);
     if (destcode.GetLength() == 1) {
-      Optional<uint32_t> value_or_error = StringToCode(start);
+      absl::optional<uint32_t> value_or_error = StringToCode(start);
       if (!value_or_error.has_value())
         return;
 
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.h b/core/fpdfapi/font/cpdf_tounicodemap.h
index 5c719dd..bd6f075 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.h
+++ b/core/fpdfapi/font/cpdf_tounicodemap.h
@@ -28,7 +28,7 @@
   friend class cpdf_tounicodemap_StringToCode_Test;
   friend class cpdf_tounicodemap_StringToWideString_Test;
 
-  static Optional<uint32_t> StringToCode(ByteStringView str);
+  static absl::optional<uint32_t> StringToCode(ByteStringView str);
   static WideString StringToWideString(ByteStringView str);
 
   void Load(const CPDF_Stream* pStream);
diff --git a/core/fpdfapi/font/cpdf_type1font.h b/core/fpdfapi/font/cpdf_type1font.h
index 0fa90cc..a0094a7 100644
--- a/core/fpdfapi/font/cpdf_type1font.h
+++ b/core/fpdfapi/font/cpdf_type1font.h
@@ -48,7 +48,7 @@
   uint16_t m_ExtGID[kInternalTableSize];
 #endif
 
-  Optional<CFX_FontMapper::StandardFont> m_Base14Font;
+  absl::optional<CFX_FontMapper::StandardFont> m_Base14Font;
 };
 
 #endif  // CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index e58ed3c..95a09f8 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -182,7 +182,7 @@
   if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0))
     return false;
 
-  const Optional<uint32_t> maybe_size =
+  const absl::optional<uint32_t> maybe_size =
       fxcodec::CalculatePitch8(m_bpc, m_nComponents, m_Width);
   if (!maybe_size.has_value())
     return false;
@@ -205,7 +205,7 @@
   else
     m_Format = MakeRGBFormat(CalculateBitsPerPixel(m_bpc, m_nComponents));
 
-  Optional<uint32_t> pitch =
+  absl::optional<uint32_t> pitch =
       fxcodec::CalculatePitch32(GetBppFromFormat(m_Format), m_Width);
   if (!pitch.has_value())
     return false;
@@ -234,7 +234,7 @@
     m_Format = MakeRGBFormat(CalculateBitsPerPixel(m_bpc, m_nComponents));
   }
 
-  Optional<uint32_t> pitch =
+  absl::optional<uint32_t> pitch =
       fxcodec::CalculatePitch32(GetBppFromFormat(m_Format), m_Width);
   if (!pitch.has_value())
     return false;
@@ -286,7 +286,7 @@
   if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0))
     return LoadState::kFail;
 
-  const Optional<uint32_t> maybe_size =
+  const absl::optional<uint32_t> maybe_size =
       fxcodec::CalculatePitch8(m_bpc, m_nComponents, m_Width);
   if (!maybe_size.has_value())
     return LoadState::kFail;
@@ -394,7 +394,7 @@
 
 bool CPDF_DIB::LoadColorInfo(const CPDF_Dictionary* pFormResources,
                              const CPDF_Dictionary* pPageResources) {
-  Optional<DecoderArray> decoder_array = GetDecoderArray(m_pDict.Get());
+  absl::optional<DecoderArray> decoder_array = GetDecoderArray(m_pDict.Get());
   if (!decoder_array.has_value())
     return false;
 
@@ -551,11 +551,11 @@
   if (!m_pDecoder)
     return LoadState::kFail;
 
-  const Optional<uint32_t> requested_pitch =
+  const absl::optional<uint32_t> requested_pitch =
       fxcodec::CalculatePitch8(m_bpc, m_nComponents, m_Width);
   if (!requested_pitch.has_value())
     return LoadState::kFail;
-  const Optional<uint32_t> provided_pitch = fxcodec::CalculatePitch8(
+  const absl::optional<uint32_t> provided_pitch = fxcodec::CalculatePitch8(
       m_pDecoder->GetBPC(), m_pDecoder->CountComps(), m_pDecoder->GetWidth());
   if (!provided_pitch.has_value())
     return LoadState::kFail;
@@ -572,7 +572,8 @@
   if (m_pDecoder)
     return true;
 
-  Optional<JpegModule::ImageInfo> info_opt = JpegModule::LoadInfo(src_span);
+  absl::optional<JpegModule::ImageInfo> info_opt =
+      JpegModule::LoadInfo(src_span);
   if (!info_opt.has_value())
     return false;
 
@@ -1077,7 +1078,7 @@
   if (m_bpc == 0)
     return pdfium::span<const uint8_t>();
 
-  const Optional<uint32_t> src_pitch =
+  const absl::optional<uint32_t> src_pitch =
       fxcodec::CalculatePitch8(m_bpc, m_nComponents, m_Width);
   if (!src_pitch.has_value())
     return pdfium::span<const uint8_t>();
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 3aff7b4..889f760 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -460,7 +460,7 @@
     const ByteString& fontName,
     const CPDF_FontEncoding* pEncoding) {
   ByteString mutable_name(fontName);
-  Optional<CFX_FontMapper::StandardFont> font_id =
+  absl::optional<CFX_FontMapper::StandardFont> font_id =
       CFX_FontMapper::GetStandardFontName(&mutable_name);
   if (!font_id.has_value())
     return nullptr;
diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp
index 9d95c4d..5e4176c 100644
--- a/core/fpdfapi/page/cpdf_form.cpp
+++ b/core/fpdfapi/page/cpdf_form.cpp
@@ -106,7 +106,7 @@
   return m_pFormStream.Get();
 }
 
-Optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
+absl::optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
 CPDF_Form::GetBitmapAndMatrixFromSoleImageOfForm() const {
   if (GetPageObjectCount() != 1)
     return absl::nullopt;
diff --git a/core/fpdfapi/page/cpdf_form.h b/core/fpdfapi/page/cpdf_form.h
index 0731713..9de2c5e 100644
--- a/core/fpdfapi/page/cpdf_form.h
+++ b/core/fpdfapi/page/cpdf_form.h
@@ -42,7 +42,7 @@
   void ParseContentForType3Char(CPDF_Type3Char* pType3Char) override;
   bool HasPageObjects() const override;
   CFX_FloatRect CalcBoundingBox() const override;
-  Optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
+  absl::optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
   GetBitmapAndMatrixFromSoleImageOfForm() const override;
 
   void ParseContent();
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp
index da75360..9973b04 100644
--- a/core/fpdfapi/page/cpdf_function.cpp
+++ b/core/fpdfapi/page/cpdf_function.cpp
@@ -126,8 +126,9 @@
   return true;
 }
 
-Optional<uint32_t> CPDF_Function::Call(pdfium::span<const float> inputs,
-                                       pdfium::span<float> results) const {
+absl::optional<uint32_t> CPDF_Function::Call(
+    pdfium::span<const float> inputs,
+    pdfium::span<float> results) const {
   if (m_nInputs != inputs.size())
     return absl::nullopt;
 
diff --git a/core/fpdfapi/page/cpdf_function.h b/core/fpdfapi/page/cpdf_function.h
index 7b6fcc3..bb2c899 100644
--- a/core/fpdfapi/page/cpdf_function.h
+++ b/core/fpdfapi/page/cpdf_function.h
@@ -34,8 +34,8 @@
 
   virtual ~CPDF_Function();
 
-  Optional<uint32_t> Call(pdfium::span<const float> inputs,
-                          pdfium::span<float> results) const;
+  absl::optional<uint32_t> Call(pdfium::span<const float> inputs,
+                                pdfium::span<float> results) const;
   uint32_t CountInputs() const { return m_nInputs; }
   uint32_t CountOutputs() const { return m_nOutputs; }
   float GetDomain(int i) const { return m_Domains[i]; }
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 1187149..10fe87f 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -83,7 +83,8 @@
 
 RetainPtr<CPDF_Dictionary> CPDF_Image::InitJPEG(
     pdfium::span<uint8_t> src_span) {
-  Optional<JpegModule::ImageInfo> info_opt = JpegModule::LoadInfo(src_span);
+  absl::optional<JpegModule::ImageInfo> info_opt =
+      JpegModule::LoadInfo(src_span);
   if (!info_opt.has_value())
     return nullptr;
 
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 60ea128..bc22a47 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -99,7 +99,7 @@
   return box;
 }
 
-Optional<CFX_PointF> CPDF_Page::DeviceToPage(
+absl::optional<CFX_PointF> CPDF_Page::DeviceToPage(
     const FX_RECT& rect,
     int rotate,
     const CFX_PointF& device_point) const {
@@ -107,7 +107,7 @@
   return page2device.GetInverse().Transform(device_point);
 }
 
-Optional<CFX_PointF> CPDF_Page::PageToDevice(
+absl::optional<CFX_PointF> CPDF_Page::PageToDevice(
     const FX_RECT& rect,
     int rotate,
     const CFX_PointF& page_point) const {
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 96eb568..ad627e7 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -59,11 +59,11 @@
   float GetPageWidth() const override;
   float GetPageHeight() const override;
   CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const override;
-  Optional<CFX_PointF> DeviceToPage(
+  absl::optional<CFX_PointF> DeviceToPage(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& device_point) const override;
-  Optional<CFX_PointF> PageToDevice(
+  absl::optional<CFX_PointF> PageToDevice(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& page_point) const override;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index 4e9563a..671a497 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -84,7 +84,7 @@
   return dirty_streams;
 }
 
-Optional<ByteString> CPDF_PageObjectHolder::GraphicsMapSearch(
+absl::optional<ByteString> CPDF_PageObjectHolder::GraphicsMapSearch(
     const GraphicsData& gd) {
   auto it = m_GraphicsMap.find(gd);
   if (it == m_GraphicsMap.end())
@@ -98,7 +98,8 @@
   m_GraphicsMap[gd] = str;
 }
 
-Optional<ByteString> CPDF_PageObjectHolder::FontsMapSearch(const FontData& fd) {
+absl::optional<ByteString> CPDF_PageObjectHolder::FontsMapSearch(
+    const FontData& fd) {
   auto it = m_FontsMap.find(fd);
   if (it == m_FontsMap.end())
     return absl::nullopt;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 91b148b..608833a 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -101,10 +101,10 @@
   bool HasDirtyStreams() const { return !m_DirtyStreams.empty(); }
   std::set<int32_t> TakeDirtyStreams();
 
-  Optional<ByteString> GraphicsMapSearch(const GraphicsData& gd);
+  absl::optional<ByteString> GraphicsMapSearch(const GraphicsData& gd);
   void GraphicsMapInsert(const GraphicsData& gd, const ByteString& str);
 
-  Optional<ByteString> FontsMapSearch(const FontData& fd);
+  absl::optional<ByteString> FontsMapSearch(const FontData& fd);
   void FontsMapInsert(const FontData& fd, const ByteString& str);
 
  protected:
diff --git a/core/fpdfapi/page/cpdf_stitchfunc.cpp b/core/fpdfapi/page/cpdf_stitchfunc.cpp
index 737ff5f..5b922f7 100644
--- a/core/fpdfapi/page/cpdf_stitchfunc.cpp
+++ b/core/fpdfapi/page/cpdf_stitchfunc.cpp
@@ -65,7 +65,7 @@
 
   // Check sub-functions.
   {
-    Optional<uint32_t> nOutputs;
+    absl::optional<uint32_t> nOutputs;
     for (uint32_t i = 0; i < nSubs; ++i) {
       const CPDF_Object* pSub = pFunctionsArray->GetDirectObjectAt(i);
       if (pSub == pObj)
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index 31c59c5..8f33307 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -54,7 +54,8 @@
   if (width <= 0 || height <= 0)
     return FX_INVALID_OFFSET;
 
-  Optional<uint32_t> maybe_size = fxcodec::CalculatePitch8(bpc, ncomps, width);
+  absl::optional<uint32_t> maybe_size =
+      fxcodec::CalculatePitch8(bpc, ncomps, width);
   if (!maybe_size.has_value())
     return FX_INVALID_OFFSET;
 
@@ -164,7 +165,7 @@
     nComponents = pCS ? pCS->CountComponents() : 3;
     bpc = pDict->GetIntegerFor("BitsPerComponent");
   }
-  Optional<uint32_t> maybe_size =
+  absl::optional<uint32_t> maybe_size =
       fxcodec::CalculatePitch8(bpc, nComponents, width);
   if (!maybe_size.has_value())
     return nullptr;
diff --git a/core/fpdfapi/page/ipdf_page.h b/core/fpdfapi/page/ipdf_page.h
index 9b28559..825bf1d 100644
--- a/core/fpdfapi/page/ipdf_page.h
+++ b/core/fpdfapi/page/ipdf_page.h
@@ -35,12 +35,12 @@
   virtual CFX_Matrix GetDisplayMatrix(const FX_RECT& rect,
                                       int iRotate) const = 0;
 
-  virtual Optional<CFX_PointF> DeviceToPage(
+  virtual absl::optional<CFX_PointF> DeviceToPage(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& device_point) const = 0;
 
-  virtual Optional<CFX_PointF> PageToDevice(
+  virtual absl::optional<CFX_PointF> PageToDevice(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& page_point) const = 0;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 0319bcc..705f07b 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -491,7 +491,8 @@
     return kDataAvailable;
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
-  const Optional<FX_FILESIZE> header_offset = GetHeaderOffset(GetValidator());
+  const absl::optional<FX_FILESIZE> header_offset =
+      GetHeaderOffset(GetValidator());
   if (GetValidator()->has_read_problems())
     return kDataNotAvailable;
 
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 5bc621a..7ef9ed2 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -120,7 +120,7 @@
 
 bool CPDF_Parser::InitSyntaxParser(
     const RetainPtr<CPDF_ReadValidator>& validator) {
-  const Optional<FX_FILESIZE> header_offset = GetHeaderOffset(validator);
+  const absl::optional<FX_FILESIZE> header_offset = GetHeaderOffset(validator);
   if (!header_offset.has_value())
     return false;
   if (validator->GetSize() < header_offset.value() + kPDFHeaderSize)
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index c97ea77..d2ef844 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -136,7 +136,7 @@
   std::unique_ptr<uint8_t, FxFreeDeleter> pDecodedData;
   uint32_t dwDecodedSize = 0;
 
-  Optional<std::vector<std::pair<ByteString, const CPDF_Object*>>>
+  absl::optional<std::vector<std::pair<ByteString, const CPDF_Object*>>>
       decoder_array = GetDecoderArray(m_pStream->GetDict());
   if (!decoder_array.has_value() || decoder_array.value().empty() ||
       !PDF_DataDecode({pSrcData.Get(), dwSrcSize}, estimated_size, bImageAcc,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 632ebfa..8dfded4 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -366,7 +366,7 @@
                                        estimated_size, dest_buf, dest_size);
 }
 
-Optional<DecoderArray> GetDecoderArray(const CPDF_Dictionary* pDict) {
+absl::optional<DecoderArray> GetDecoderArray(const CPDF_Dictionary* pDict) {
   const CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter");
   if (!pFilter)
     return DecoderArray();
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index f16e53a..01c2807 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -82,7 +82,7 @@
 // array.
 // Otherwise, returns a vector of decoders.
 using DecoderArray = std::vector<std::pair<ByteString, const CPDF_Object*>>;
-Optional<DecoderArray> GetDecoderArray(const CPDF_Dictionary* pDict);
+absl::optional<DecoderArray> GetDecoderArray(const CPDF_Dictionary* pDict);
 
 bool PDF_DataDecode(pdfium::span<const uint8_t> src_span,
                     uint32_t estimated_size,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index f0660e6..86f704e 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -119,7 +119,7 @@
   {
     // Treat no filter as an empty filter array.
     auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     ASSERT_TRUE(decoder_array.has_value());
     EXPECT_TRUE(decoder_array.value().empty());
   }
@@ -127,14 +127,14 @@
     // Wrong filter type.
     auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
     dict->SetNewFor<CPDF_String>("Filter", "RL", false);
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     EXPECT_FALSE(decoder_array.has_value());
   }
   {
     // Filter name.
     auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
     dict->SetNewFor<CPDF_Name>("Filter", "RL");
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     ASSERT_TRUE(decoder_array.has_value());
     ASSERT_EQ(1u, decoder_array.value().size());
     EXPECT_EQ("RL", decoder_array.value()[0].first);
@@ -143,7 +143,7 @@
     // Empty filter array.
     auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
     dict->SetNewFor<CPDF_Array>("Filter");
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     ASSERT_TRUE(decoder_array.has_value());
     EXPECT_TRUE(decoder_array.value().empty());
   }
@@ -152,7 +152,7 @@
     auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
     auto* filter_array = dict->SetNewFor<CPDF_Array>("Filter");
     filter_array->AppendNew<CPDF_Name>("FooBar");
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     ASSERT_TRUE(decoder_array.has_value());
     ASSERT_EQ(1u, decoder_array.value().size());
     EXPECT_EQ("FooBar", decoder_array.value()[0].first);
@@ -163,7 +163,7 @@
     auto* filter_array = dict->SetNewFor<CPDF_Array>("Filter");
     filter_array->AppendNew<CPDF_Name>("AHx");
     filter_array->AppendNew<CPDF_Name>("LZWDecode");
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     ASSERT_TRUE(decoder_array.has_value());
     ASSERT_EQ(2u, decoder_array.value().size());
     EXPECT_EQ("AHx", decoder_array.value()[0].first);
@@ -175,7 +175,7 @@
     auto* invalid_filter_array = dict->SetNewFor<CPDF_Array>("Filter");
     invalid_filter_array->AppendNew<CPDF_Name>("DCTDecode");
     invalid_filter_array->AppendNew<CPDF_Name>("CCITTFaxDecode");
-    Optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
+    absl::optional<DecoderArray> decoder_array = GetDecoderArray(dict.Get());
     EXPECT_FALSE(decoder_array.has_value());
   }
 }
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 09c3017..36dcc17 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -74,7 +74,7 @@
     'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
     'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'};
 
-Optional<FX_FILESIZE> GetHeaderOffset(
+absl::optional<FX_FILESIZE> GetHeaderOffset(
     const RetainPtr<IFX_SeekableReadStream>& pFile) {
   static constexpr size_t kBufSize = 4;
   uint8_t buf[kBufSize];
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 41f0fd8..a88a880 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -42,7 +42,7 @@
 // On success, return a positive offset value to the PDF header. If the header
 // cannot be found, or if there is an error reading from |pFile|, then return
 // nullopt.
-Optional<FX_FILESIZE> GetHeaderOffset(
+absl::optional<FX_FILESIZE> GetHeaderOffset(
     const RetainPtr<IFX_SeekableReadStream>& pFile);
 
 int32_t GetDirectInteger(const CPDF_Dictionary* pDict, const ByteString& key);
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 7cb7e25..d19a424 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -423,7 +423,7 @@
       return false;
     }
 
-    Optional<FX_RECT> image_rect = GetUnitRect();
+    absl::optional<FX_RECT> image_rect = GetUnitRect();
     if (!image_rect.has_value())
       return false;
 
@@ -435,7 +435,7 @@
     return true;
   }
 
-  Optional<FX_RECT> image_rect = GetUnitRect();
+  absl::optional<FX_RECT> image_rect = GetUnitRect();
   if (!image_rect.has_value())
     return false;
 
@@ -517,7 +517,7 @@
     return false;
   }
 
-  Optional<FX_RECT> image_rect = GetUnitRect();
+  absl::optional<FX_RECT> image_rect = GetUnitRect();
   if (!image_rect.has_value())
     return false;
 
@@ -594,7 +594,7 @@
 }
 
 void CPDF_ImageRenderer::HandleFilters() {
-  Optional<DecoderArray> decoder_array =
+  absl::optional<DecoderArray> decoder_array =
       GetDecoderArray(m_pImageObject->GetImage()->GetStream()->GetDict());
   if (!decoder_array.has_value())
     return;
@@ -607,7 +607,7 @@
   }
 }
 
-Optional<FX_RECT> CPDF_ImageRenderer::GetUnitRect() const {
+absl::optional<FX_RECT> CPDF_ImageRenderer::GetUnitRect() const {
   CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
   FX_RECT image_rect = image_rect_f.GetOuterRect();
   if (!image_rect.Valid())
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h
index d51e5f3..f0d5273 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.h
+++ b/core/fpdfapi/render/cpdf_imagerenderer.h
@@ -73,7 +73,7 @@
                           const FX_RECT& rect) const;
   const CPDF_RenderOptions& GetRenderOptions() const;
   void HandleFilters();
-  Optional<FX_RECT> GetUnitRect() const;
+  absl::optional<FX_RECT> GetUnitRect() const;
   bool GetDimensionsFromUnitRect(const FX_RECT& rect,
                                  int* left,
                                  int* top,
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index 63f719a..a43adb6 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -74,7 +74,7 @@
     for (const auto& func : funcs) {
       if (!func)
         continue;
-      Optional<uint32_t> nresults =
+      absl::optional<uint32_t> nresults =
           func->Call(pdfium::make_span(&input, 1), result_span);
       if (nresults.has_value())
         result_span = result_span.subspan(nresults.value());
@@ -301,7 +301,7 @@
       for (const auto& func : funcs) {
         if (!func)
           continue;
-        Optional<uint32_t> nresults = func->Call(input, result_span);
+        absl::optional<uint32_t> nresults = func->Call(input, result_span);
         if (nresults.has_value())
           result_span = result_span.subspan(nresults.value());
       }
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 394f709..ea0f3c7 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -947,7 +947,7 @@
           if (!glyph.m_pGlyph)
             continue;
 
-          Optional<CFX_Point> point = glyph.GetOrigin({0, 0});
+          absl::optional<CFX_Point> point = glyph.GetOrigin({0, 0});
           if (!point.has_value())
             continue;
 
@@ -1063,7 +1063,7 @@
     if (!glyph.m_pGlyph || !glyph.m_pGlyph->GetBitmap()->IsMaskFormat())
       continue;
 
-    Optional<CFX_Point> point = glyph.GetOrigin({rect.left, rect.top});
+    absl::optional<CFX_Point> point = glyph.GetOrigin({rect.left, rect.top});
     if (!point.has_value())
       continue;
 
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index 37f5c43..b6a4474 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -45,7 +45,7 @@
     int32_t height = bitmap_rect.Height();
     // Set to 0 to make CalculatePitchAndSize() calculate it.
     constexpr uint32_t kNoPitch = 0;
-    Optional<CFX_DIBitmap::PitchAndSize> pitch_size =
+    absl::optional<CFX_DIBitmap::PitchAndSize> pitch_size =
         CFX_DIBitmap::CalculatePitchAndSize(width, height, dibFormat, kNoPitch);
     if (!pitch_size.has_value())
       return false;
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 4fea331..84ee9f8 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -140,7 +140,7 @@
   return result;
 }
 
-Optional<WideString> CPDF_Action::MaybeGetJavaScript() const {
+absl::optional<WideString> CPDF_Action::MaybeGetJavaScript() const {
   const CPDF_Object* pObject = GetJavaScriptObject();
   if (!pObject)
     return absl::nullopt;
diff --git a/core/fpdfdoc/cpdf_action.h b/core/fpdfdoc/cpdf_action.h
index d60b901..127d7ec 100644
--- a/core/fpdfdoc/cpdf_action.h
+++ b/core/fpdfdoc/cpdf_action.h
@@ -60,7 +60,7 @@
   std::vector<const CPDF_Object*> GetAllFields() const;
 
   // Differentiates between empty JS entry and no JS entry.
-  Optional<WideString> MaybeGetJavaScript() const;
+  absl::optional<WideString> MaybeGetJavaScript() const;
 
   // Returns empty string for empty JS entry and no JS entry.
   WideString GetJavaScript() const;
diff --git a/core/fpdfdoc/cpdf_bafontmap.cpp b/core/fpdfdoc/cpdf_bafontmap.cpp
index 57b4968..f2dd5de 100644
--- a/core/fpdfdoc/cpdf_bafontmap.cpp
+++ b/core/fpdfdoc/cpdf_bafontmap.cpp
@@ -250,7 +250,7 @@
 
   CPDF_DefaultAppearance appearance(sDA);
   float font_size;
-  Optional<ByteString> font = appearance.GetFont(&font_size);
+  absl::optional<ByteString> font = appearance.GetFont(&font_size);
   *sAlias = font.value_or(ByteString());
 
   CPDF_Dictionary* pFontDict = nullptr;
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index 3904bf9..f5e57bc 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -63,7 +63,7 @@
 
 CPDF_DefaultAppearance::~CPDF_DefaultAppearance() = default;
 
-Optional<ByteString> CPDF_DefaultAppearance::GetFont(float* fFontSize) {
+absl::optional<ByteString> CPDF_DefaultAppearance::GetFont(float* fFontSize) {
   *fFontSize = 0.0f;
   if (m_csDA.IsEmpty())
     return absl::nullopt;
@@ -78,7 +78,7 @@
   return PDF_NameDecode(csFontNameTag.AsStringView());
 }
 
-Optional<CFX_Color> CPDF_DefaultAppearance::GetColor() const {
+absl::optional<CFX_Color> CPDF_DefaultAppearance::GetColor() const {
   if (m_csDA.IsEmpty())
     return absl::nullopt;
 
@@ -104,8 +104,9 @@
   return absl::nullopt;
 }
 
-Optional<CFX_Color::TypeAndARGB> CPDF_DefaultAppearance::GetColorARGB() const {
-  Optional<CFX_Color> maybe_color = GetColor();
+absl::optional<CFX_Color::TypeAndARGB> CPDF_DefaultAppearance::GetColorARGB()
+    const {
+  absl::optional<CFX_Color> maybe_color = GetColor();
   if (!maybe_color.has_value())
     return absl::nullopt;
 
diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h
index ede49e3..3dff73a 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/core/fpdfdoc/cpdf_defaultappearance.h
@@ -20,10 +20,10 @@
   CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA);
   ~CPDF_DefaultAppearance();
 
-  Optional<ByteString> GetFont(float* fFontSize);
+  absl::optional<ByteString> GetFont(float* fFontSize);
 
-  Optional<CFX_Color> GetColor() const;
-  Optional<CFX_Color::TypeAndARGB> GetColorARGB() const;
+  absl::optional<CFX_Color> GetColor() const;
+  absl::optional<CFX_Color::TypeAndARGB> GetColorARGB() const;
 
   bool FindTagParamFromStartForTesting(CPDF_SimpleParser* parser,
                                        ByteStringView token,
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 16c95da..55f2f64 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -187,7 +187,7 @@
   return CPDF_DefaultAppearance(pObj->GetString());
 }
 
-Optional<WideString> CPDF_FormControl::GetDefaultControlFontName() const {
+absl::optional<WideString> CPDF_FormControl::GetDefaultControlFontName() const {
   RetainPtr<CPDF_Font> pFont = GetDefaultControlFont();
   if (!pFont)
     return absl::nullopt;
@@ -198,7 +198,7 @@
 RetainPtr<CPDF_Font> CPDF_FormControl::GetDefaultControlFont() const {
   float fFontSize;
   CPDF_DefaultAppearance cDA = GetDefaultAppearance();
-  Optional<ByteString> csFontNameTag = cDA.GetFont(&fFontSize);
+  absl::optional<ByteString> csFontNameTag = cDA.GetFont(&fFontSize);
   if (!csFontNameTag.has_value() || csFontNameTag->IsEmpty())
     return nullptr;
 
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index c05acbb..a68f8ad 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -82,7 +82,7 @@
   int GetTextPosition() const;
   CPDF_DefaultAppearance GetDefaultAppearance() const;
 
-  Optional<WideString> GetDefaultControlFontName() const;
+  absl::optional<WideString> GetDefaultControlFontName() const;
   int GetControlAlignment() const;
 
   ByteString GetOnStateName() const;
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 40e550c..61f64bc 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -50,7 +50,7 @@
 }  // namespace
 
 // static
-Optional<FormFieldType> CPDF_FormField::IntToFormFieldType(int value) {
+absl::optional<FormFieldType> CPDF_FormField::IntToFormFieldType(int value) {
   if (value >= static_cast<int>(FormFieldType::kUnknown) &&
       value < static_cast<int>(kFormFieldTypeCount)) {
     return static_cast<FormFieldType>(value);
@@ -856,7 +856,7 @@
     return;
 
   CPDF_DefaultAppearance appearance(DA);
-  Optional<ByteString> font_name = appearance.GetFont(&m_FontSize);
+  absl::optional<ByteString> font_name = appearance.GetFont(&m_FontSize);
   if (!font_name.has_value())
     return;
 
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 036fa3d..31665eb 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -73,7 +73,7 @@
   CPDF_FormField(CPDF_InteractiveForm* pForm, CPDF_Dictionary* pDict);
   ~CPDF_FormField();
 
-  static Optional<FormFieldType> IntToFormFieldType(int value);
+  static absl::optional<FormFieldType> IntToFormFieldType(int value);
 
   static const CPDF_Object* GetFieldAttr(const CPDF_Dictionary* pFieldDict,
                                          const ByteString& name);
diff --git a/core/fpdfdoc/cpdf_generateap.cpp b/core/fpdfdoc/cpdf_generateap.cpp
index 5ab2e0f..d5e4d54 100644
--- a/core/fpdfdoc/cpdf_generateap.cpp
+++ b/core/fpdfdoc/cpdf_generateap.cpp
@@ -937,7 +937,7 @@
   CPDF_DefaultAppearance appearance(DA);
 
   float fFontSize = 0;
-  Optional<ByteString> font = appearance.GetFont(&fFontSize);
+  absl::optional<ByteString> font = appearance.GetFont(&fFontSize);
   if (!font.has_value())
     return;
 
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index 9e90b92..2558ada 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -78,7 +78,7 @@
 
 CPDF_PageLabel::~CPDF_PageLabel() = default;
 
-Optional<WideString> CPDF_PageLabel::GetLabel(int nPage) const {
+absl::optional<WideString> CPDF_PageLabel::GetLabel(int nPage) const {
   if (!m_pDocument)
     return absl::nullopt;
 
diff --git a/core/fpdfdoc/cpdf_pagelabel.h b/core/fpdfdoc/cpdf_pagelabel.h
index 5a883de..59f7210 100644
--- a/core/fpdfdoc/cpdf_pagelabel.h
+++ b/core/fpdfdoc/cpdf_pagelabel.h
@@ -18,7 +18,7 @@
   explicit CPDF_PageLabel(CPDF_Document* pDocument);
   ~CPDF_PageLabel();
 
-  Optional<WideString> GetLabel(int nPage) const;
+  absl::optional<WideString> GetLabel(int nPage) const;
 
  private:
   UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index 55156db..acba28d 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -40,7 +40,7 @@
   return pDict ? pDict->GetStringFor("Duplex") : ByteString("None");
 }
 
-Optional<ByteString> CPDF_ViewerPreferences::GenericName(
+absl::optional<ByteString> CPDF_ViewerPreferences::GenericName(
     const ByteString& bsKey) const {
   const CPDF_Dictionary* pDict = GetViewerPreferences();
   if (!pDict)
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.h b/core/fpdfdoc/cpdf_viewerpreferences.h
index a27d482..1cf685f 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.h
+++ b/core/fpdfdoc/cpdf_viewerpreferences.h
@@ -29,7 +29,7 @@
   ByteString Duplex() const;
 
   // Gets the entry for |bsKey|.
-  Optional<ByteString> GenericName(const ByteString& bsKey) const;
+  absl::optional<ByteString> GenericName(const ByteString& bsKey) const;
 
  private:
   CPDF_Dictionary* GetViewerPreferences() const;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index c64dce5..190f488 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -610,7 +610,7 @@
 
 void CPDF_TextPage::AppendGeneratedCharacter(wchar_t unicode,
                                              const CFX_Matrix& formMatrix) {
-  Optional<CharInfo> pGenerateChar = GenerateCharInfo(unicode);
+  absl::optional<CharInfo> pGenerateChar = GenerateCharInfo(unicode);
   if (!pGenerateChar.has_value())
     return;
 
@@ -967,7 +967,7 @@
       case GenerateCharacter::kNone:
         break;
       case GenerateCharacter::kSpace: {
-        Optional<CharInfo> pGenerateChar = GenerateCharInfo(L' ');
+        absl::optional<CharInfo> pGenerateChar = GenerateCharInfo(L' ');
         if (pGenerateChar.has_value()) {
           if (!form_matrix.IsIdentity())
             pGenerateChar->m_Matrix = form_matrix;
@@ -1408,7 +1408,7 @@
   return false;
 }
 
-Optional<CPDF_TextPage::CharInfo> CPDF_TextPage::GenerateCharInfo(
+absl::optional<CPDF_TextPage::CharInfo> CPDF_TextPage::GenerateCharInfo(
     wchar_t unicode) {
   const CharInfo* pPrevCharInfo = GetPrevCharInfo();
   if (!pPrevCharInfo)
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index ddc9413..9a914e4 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -114,7 +114,7 @@
   GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj,
                                         const CFX_Matrix& formMatrix);
   const CharInfo* GetPrevCharInfo() const;
-  Optional<CharInfo> GenerateCharInfo(wchar_t unicode);
+  absl::optional<CharInfo> GenerateCharInfo(wchar_t unicode);
   bool IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
                              const CPDF_PageObjectHolder* pObjList,
                              CPDF_PageObjectHolder::const_iterator iter) const;
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 6d3b586..74df306 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -91,8 +91,8 @@
   return wsLower;
 }
 
-Optional<WideString> ExtractSubString(const wchar_t* lpszFullString,
-                                      int iSubString) {
+absl::optional<WideString> ExtractSubString(const wchar_t* lpszFullString,
+                                            int iSubString) {
   DCHECK(lpszFullString);
 
   while (iSubString--) {
@@ -129,7 +129,7 @@
 
   int index = 0;
   while (1) {
-    Optional<WideString> word = ExtractSubString(findwhat.c_str(), index);
+    absl::optional<WideString> word = ExtractSubString(findwhat.c_str(), index);
     if (!word.has_value())
       break;
 
@@ -176,7 +176,7 @@
     const CPDF_TextPage* pTextPage,
     const WideString& findwhat,
     const Options& options,
-    Optional<size_t> startPos) {
+    absl::optional<size_t> startPos) {
   std::vector<WideString> findwhat_array =
       ExtractFindWhat(GetStringCase(findwhat, options.bMatchCase));
   auto find = pdfium::WrapUnique(
@@ -189,7 +189,7 @@
     const CPDF_TextPage* pTextPage,
     const std::vector<WideString>& findwhat_array,
     const Options& options,
-    Optional<size_t> startPos)
+    absl::optional<size_t> startPos)
     : m_pTextPage(pTextPage),
       m_strText(GetStringCase(pTextPage->GetAllPageText(), options.bMatchCase)),
       m_csFindWhatArray(findwhat_array),
@@ -219,7 +219,7 @@
     return false;
 
   int nCount = fxcrt::CollectionSize<int>(m_csFindWhatArray);
-  Optional<size_t> nResultPos = 0;
+  absl::optional<size_t> nResultPos = 0;
   size_t nStartPos = m_findNextStart.value();
   bool bSpaceStart = false;
   for (int iWord = 0; iWord < nCount; iWord++) {
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index 1e6e6ac..fccda08 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -31,7 +31,7 @@
       const CPDF_TextPage* pTextPage,
       const WideString& findwhat,
       const Options& options,
-      Optional<size_t> startPos);
+      absl::optional<size_t> startPos);
 
   ~CPDF_TextPageFind();
 
@@ -44,7 +44,7 @@
   CPDF_TextPageFind(const CPDF_TextPage* pTextPage,
                     const std::vector<WideString>& findwhat_array,
                     const Options& options,
-                    Optional<size_t> startPos);
+                    absl::optional<size_t> startPos);
 
   // Should be called immediately after construction.
   bool FindFirst();
@@ -54,8 +54,8 @@
   UnownedPtr<const CPDF_TextPage> const m_pTextPage;
   const WideString m_strText;
   const std::vector<WideString> m_csFindWhatArray;
-  Optional<size_t> m_findNextStart;
-  Optional<size_t> m_findPreStart;
+  absl::optional<size_t> m_findNextStart;
+  absl::optional<size_t> m_findPreStart;
   int m_resStart = 0;
   int m_resEnd = -1;
   const Options m_options;
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
index 3b9070c..f945dda 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
@@ -227,7 +227,7 @@
     default:
       return BmpDecoder::Status::kFail;
   }
-  Optional<uint32_t> stride = CalculatePitch32(bit_counts_, width_);
+  absl::optional<uint32_t> stride = CalculatePitch32(bit_counts_, width_);
   if (!stride.has_value())
     return BmpDecoder::Status::kFail;
 
diff --git a/core/fxcodec/fx_codec.cpp b/core/fxcodec/fx_codec.cpp
index 13aea98..5649bb6 100644
--- a/core/fxcodec/fx_codec.cpp
+++ b/core/fxcodec/fx_codec.cpp
@@ -70,16 +70,16 @@
   return CalculatePitch32Safely(bpp, width).ValueOrDie();
 }
 
-Optional<uint32_t> CalculatePitch8(uint32_t bpc,
-                                   uint32_t components,
-                                   int width) {
+absl::optional<uint32_t> CalculatePitch8(uint32_t bpc,
+                                         uint32_t components,
+                                         int width) {
   FX_SAFE_UINT32 pitch = CalculatePitch8Safely(bpc, components, width);
   if (!pitch.IsValid())
     return absl::nullopt;
   return pitch.ValueOrDie();
 }
 
-Optional<uint32_t> CalculatePitch32(int bpp, int width) {
+absl::optional<uint32_t> CalculatePitch32(int bpp, int width) {
   FX_SAFE_UINT32 pitch = CalculatePitch32Safely(bpp, width);
   if (!pitch.IsValid())
     return absl::nullopt;
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 379314b..a116f74 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -30,10 +30,10 @@
 
 uint32_t CalculatePitch8OrDie(uint32_t bpc, uint32_t components, int width);
 uint32_t CalculatePitch32OrDie(int bpp, int width);
-Optional<uint32_t> CalculatePitch8(uint32_t bpc,
-                                   uint32_t components,
-                                   int width);
-Optional<uint32_t> CalculatePitch32(int bpp, int width);
+absl::optional<uint32_t> CalculatePitch8(uint32_t bpc,
+                                         uint32_t components,
+                                         int width);
+absl::optional<uint32_t> CalculatePitch32(int bpp, int width);
 
 }  // namespace fxcodec
 
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index 8af7119..5236f42 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -18,7 +18,7 @@
 
 namespace {
 
-Optional<uint32_t> CheckTRDDimension(uint32_t dimension, int32_t delta) {
+absl::optional<uint32_t> CheckTRDDimension(uint32_t dimension, int32_t delta) {
   FX_SAFE_UINT32 result = dimension;
   result += delta;
   if (!result.IsValid())
@@ -26,9 +26,9 @@
   return result.ValueOrDie();
 }
 
-Optional<int32_t> CheckTRDReferenceDimension(int32_t dimension,
-                                             uint32_t shift,
-                                             int32_t offset) {
+absl::optional<int32_t> CheckTRDReferenceDimension(int32_t dimension,
+                                                   uint32_t shift,
+                                                   int32_t offset) {
   FX_SAFE_INT32 result = offset;
   result += dimension >> shift;
   if (!result.IsValid())
@@ -160,14 +160,14 @@
         if (!IBOI)
           return nullptr;
 
-        Optional<uint32_t> WOI = CheckTRDDimension(IBOI->width(), RDWI);
-        Optional<uint32_t> HOI = CheckTRDDimension(IBOI->height(), RDHI);
+        absl::optional<uint32_t> WOI = CheckTRDDimension(IBOI->width(), RDWI);
+        absl::optional<uint32_t> HOI = CheckTRDDimension(IBOI->height(), RDHI);
         if (!WOI.has_value() || !HOI.has_value())
           return nullptr;
 
-        Optional<int32_t> GRREFERENCEDX =
+        absl::optional<int32_t> GRREFERENCEDX =
             CheckTRDReferenceDimension(RDWI, 2, RDXI);
-        Optional<int32_t> GRREFERENCEDY =
+        absl::optional<int32_t> GRREFERENCEDY =
             CheckTRDReferenceDimension(RDHI, 2, RDYI);
         if (!GRREFERENCEDX.has_value() || !GRREFERENCEDY.has_value())
           return nullptr;
@@ -340,14 +340,14 @@
         if (!IBOI)
           return nullptr;
 
-        Optional<uint32_t> WOI = CheckTRDDimension(IBOI->width(), RDWI);
-        Optional<uint32_t> HOI = CheckTRDDimension(IBOI->height(), RDHI);
+        absl::optional<uint32_t> WOI = CheckTRDDimension(IBOI->width(), RDWI);
+        absl::optional<uint32_t> HOI = CheckTRDDimension(IBOI->height(), RDHI);
         if (!WOI.has_value() || !HOI.has_value())
           return nullptr;
 
-        Optional<int32_t> GRREFERENCEDX =
+        absl::optional<int32_t> GRREFERENCEDX =
             CheckTRDReferenceDimension(RDWI, 1, RDXI);
-        Optional<int32_t> GRREFERENCEDY =
+        absl::optional<int32_t> GRREFERENCEDY =
             CheckTRDReferenceDimension(RDHI, 1, RDYI);
         if (!GRREFERENCEDX.has_value() || !GRREFERENCEDY.has_value())
           return nullptr;
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index c561325..621b7cc 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -192,7 +192,7 @@
   m_bInited = true;
 
   if (setjmp(m_JmpBuf) == -1) {
-    Optional<size_t> known_bad_header_offset;
+    absl::optional<size_t> known_bad_header_offset;
     if (bAcceptKnownBadHeader) {
       for (size_t offset : kKnownBadHeaderWithInvalidHeightByteOffsetStarts) {
         if (HasKnownBadHeaderWithInvalidHeight(offset)) {
@@ -398,7 +398,7 @@
 }
 
 // static
-Optional<JpegModule::ImageInfo> JpegModule::LoadInfo(
+absl::optional<JpegModule::ImageInfo> JpegModule::LoadInfo(
     pdfium::span<const uint8_t> src_span) {
   ImageInfo info;
   if (!JpegLoadInfo(src_span, &info))
diff --git a/core/fxcodec/jpeg/jpegmodule.h b/core/fxcodec/jpeg/jpegmodule.h
index 6ee7675..67f0986 100644
--- a/core/fxcodec/jpeg/jpegmodule.h
+++ b/core/fxcodec/jpeg/jpegmodule.h
@@ -42,7 +42,8 @@
       int nComps,
       bool ColorTransform);
 
-  static Optional<ImageInfo> LoadInfo(pdfium::span<const uint8_t> src_span);
+  static absl::optional<ImageInfo> LoadInfo(
+      pdfium::span<const uint8_t> src_span);
 
 #if defined(OS_WIN)
   static bool JpegEncode(const RetainPtr<CFX_DIBBase>& pSource,
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index 44a5da8..70a950f 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -59,7 +59,7 @@
   return stream;
 }
 
-Optional<OpjImageRgbData> alloc_rgb(size_t size) {
+absl::optional<OpjImageRgbData> alloc_rgb(size_t size) {
   OpjImageRgbData data;
   data.r.reset(static_cast<int*>(opj_image_data_alloc(size)));
   if (!data.r)
@@ -114,7 +114,7 @@
   if (!y || !cb || !cr)
     return;
 
-  Optional<OpjImageRgbData> data = alloc_rgb(max_size.ValueOrDie());
+  absl::optional<OpjImageRgbData> data = alloc_rgb(max_size.ValueOrDie());
   if (!data.has_value())
     return;
 
@@ -179,7 +179,7 @@
   if (!y || !cb || !cr)
     return;
 
-  Optional<OpjImageRgbData> data = alloc_rgb(safe_size.ValueOrDie());
+  absl::optional<OpjImageRgbData> data = alloc_rgb(safe_size.ValueOrDie());
   if (!data.has_value())
     return;
 
@@ -316,7 +316,7 @@
   if (!y || !cb || !cr)
     return;
 
-  Optional<OpjImageRgbData> data = alloc_rgb(max_size.ValueOrDie());
+  absl::optional<OpjImageRgbData> data = alloc_rgb(max_size.ValueOrDie());
   if (!data.has_value())
     return;
 
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index f1c7184..d717394 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -683,7 +683,7 @@
 
   // Set to 0 to make CalculatePitchAndSize() calculate it.
   constexpr uint32_t kNoPitch = 0;
-  Optional<CFX_DIBitmap::PitchAndSize> needed_data =
+  absl::optional<CFX_DIBitmap::PitchAndSize> needed_data =
       CFX_DIBitmap::CalculatePitchAndSize(m_SrcWidth, m_SrcHeight, format,
                                           kNoPitch);
   if (!needed_data.has_value()) {
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index 2b67694..1dd99cc 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -530,7 +530,7 @@
   return new_length;
 }
 
-Optional<size_t> ByteString::Find(char ch, size_t start) const {
+absl::optional<size_t> ByteString::Find(char ch, size_t start) const {
   if (!m_pData)
     return absl::nullopt;
 
@@ -539,11 +539,13 @@
 
   const char* pStr = static_cast<const char*>(
       memchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start));
-  return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+  return pStr ? absl::optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
               : absl::nullopt;
 }
 
-Optional<size_t> ByteString::Find(ByteStringView subStr, size_t start) const {
+absl::optional<size_t> ByteString::Find(ByteStringView subStr,
+                                        size_t start) const {
   if (!m_pData)
     return absl::nullopt;
 
@@ -553,11 +555,12 @@
   const char* pStr =
       FX_strstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
                 subStr.unterminated_c_str(), subStr.GetLength());
-  return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+  return pStr ? absl::optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
               : absl::nullopt;
 }
 
-Optional<size_t> ByteString::ReverseFind(char ch) const {
+absl::optional<size_t> ByteString::ReverseFind(char ch) const {
   if (!m_pData)
     return absl::nullopt;
 
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index 12195b5..6d0b7b0 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -171,9 +171,9 @@
   ByteString First(size_t count) const;
   ByteString Last(size_t count) const;
 
-  Optional<size_t> Find(ByteStringView subStr, size_t start = 0) const;
-  Optional<size_t> Find(char ch, size_t start = 0) const;
-  Optional<size_t> ReverseFind(char ch) const;
+  absl::optional<size_t> Find(ByteStringView subStr, size_t start = 0) const;
+  absl::optional<size_t> Find(char ch, size_t start = 0) const;
+  absl::optional<size_t> ReverseFind(char ch) const;
 
   bool Contains(ByteStringView lpszSub, size_t start = 0) const {
     return Find(lpszSub, start).has_value();
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index 7b201c1..0be68b9 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -707,7 +707,7 @@
   EXPECT_FALSE(empty_string.Find('\0').has_value());
 
   ByteString single_string("a");
-  Optional<size_t> result = single_string.Find('a');
+  absl::optional<size_t> result = single_string.Find('a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.Find('b').has_value());
@@ -755,7 +755,7 @@
   EXPECT_FALSE(empty_string.ReverseFind('\0').has_value());
 
   ByteString single_string("a");
-  Optional<size_t> result = single_string.ReverseFind('a');
+  absl::optional<size_t> result = single_string.ReverseFind('a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.ReverseFind('b').has_value());
@@ -1274,7 +1274,7 @@
   EXPECT_FALSE(empty_string.Find('\0').has_value());
 
   ByteStringView single_string("a");
-  Optional<size_t> result = single_string.Find('a');
+  absl::optional<size_t> result = single_string.Find('a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.Find('b').has_value());
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp
index 637331c..482fa61 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.cpp
+++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp
@@ -25,7 +25,7 @@
   return false;
 }
 
-Optional<WideString> CFX_CSSComputedStyle::GetLastFontFamily() const {
+absl::optional<WideString> CFX_CSSComputedStyle::GetLastFontFamily() const {
   if (!m_InheritedData.m_pFontFamily ||
       m_InheritedData.m_pFontFamily->values().empty()) {
     return absl::nullopt;
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index 921c66c..04b118a 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -61,7 +61,7 @@
 
   CONSTRUCT_VIA_MAKE_RETAIN;
 
-  Optional<WideString> GetLastFontFamily() const;
+  absl::optional<WideString> GetLastFontFamily() const;
   uint16_t GetFontWeight() const;
   CFX_CSSFontVariant GetFontVariant() const;
   CFX_CSSFontStyle GetFontStyle() const;
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index e27f43a..3fcc18e 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -36,7 +36,7 @@
   std::vector<StrType> result;
   StringViewTemplate<typename StrType::CharType> remaining(that.span());
   while (1) {
-    Optional<size_t> index = remaining.Find(ch);
+    absl::optional<size_t> index = remaining.Find(ch);
     if (!index.has_value())
       break;
     result.emplace_back(remaining.First(index.value()));
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index dd7383c..e06af6d 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -189,11 +189,12 @@
     return static_cast<CharType>(m_Span[index]);
   }
 
-  Optional<size_t> Find(CharType ch) const {
+  absl::optional<size_t> Find(CharType ch) const {
     const auto* found = reinterpret_cast<const UnsignedType*>(FXSYS_chr(
         reinterpret_cast<const CharType*>(m_Span.data()), ch, m_Span.size()));
 
-    return found ? Optional<size_t>(found - m_Span.data()) : absl::nullopt;
+    return found ? absl::optional<size_t>(found - m_Span.data())
+                 : absl::nullopt;
   }
 
   bool Contains(CharType ch) const { return Find(ch).has_value(); }
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 79989b4..21d1422 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -58,8 +58,8 @@
   return nullptr;
 }
 
-Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
-                                       va_list argList) {
+absl::optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
+                                             va_list argList) {
   size_t nMaxLen = 0;
   for (const wchar_t* pStr = pFormat; *pStr != 0; pStr++) {
     if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
@@ -250,9 +250,9 @@
 }
 
 // Returns string unless we ran out of space.
-Optional<WideString> TryVSWPrintf(size_t size,
-                                  const wchar_t* pFormat,
-                                  va_list argList) {
+absl::optional<WideString> TryVSWPrintf(size_t size,
+                                        const wchar_t* pFormat,
+                                        va_list argList) {
   if (!size)
     return absl::nullopt;
 
@@ -304,7 +304,7 @@
 
   while (maxLen < 32 * 1024) {
     va_copy(argListCopy, argList);
-    Optional<WideString> ret =
+    absl::optional<WideString> ret =
         TryVSWPrintf(static_cast<size_t>(maxLen), format, argListCopy);
     va_end(argListCopy);
     if (ret.has_value())
@@ -759,7 +759,7 @@
   return new_length;
 }
 
-Optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
+absl::optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
   if (!m_pData)
     return absl::nullopt;
 
@@ -768,11 +768,13 @@
 
   const wchar_t* pStr =
       wmemchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start);
-  return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+  return pStr ? absl::optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
               : absl::nullopt;
 }
 
-Optional<size_t> WideString::Find(WideStringView subStr, size_t start) const {
+absl::optional<size_t> WideString::Find(WideStringView subStr,
+                                        size_t start) const {
   if (!m_pData)
     return absl::nullopt;
 
@@ -782,11 +784,12 @@
   const wchar_t* pStr =
       FX_wcsstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
                 subStr.unterminated_c_str(), subStr.GetLength());
-  return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+  return pStr ? absl::optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
               : absl::nullopt;
 }
 
-Optional<size_t> WideString::ReverseFind(wchar_t ch) const {
+absl::optional<size_t> WideString::ReverseFind(wchar_t ch) const {
   if (!m_pData)
     return absl::nullopt;
 
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index a8706e6..f310b34 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -188,9 +188,9 @@
 
   int GetInteger() const;
 
-  Optional<size_t> Find(WideStringView subStr, size_t start = 0) const;
-  Optional<size_t> Find(wchar_t ch, size_t start = 0) const;
-  Optional<size_t> ReverseFind(wchar_t ch) const;
+  absl::optional<size_t> Find(WideStringView subStr, size_t start = 0) const;
+  absl::optional<size_t> Find(wchar_t ch, size_t start = 0) const;
+  absl::optional<size_t> ReverseFind(wchar_t ch) const;
 
   bool Contains(WideStringView lpszSub, size_t start = 0) const {
     return Find(lpszSub, start).has_value();
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 3c11909..8b7f2ec 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -714,7 +714,7 @@
   EXPECT_FALSE(empty_string.Find(L'\0').has_value());
 
   WideString single_string(L"a");
-  Optional<size_t> result = single_string.Find(L'a');
+  absl::optional<size_t> result = single_string.Find(L'a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.Find(L'b').has_value());
@@ -761,7 +761,7 @@
   EXPECT_FALSE(empty_string.ReverseFind(L'\0').has_value());
 
   WideString single_string(L"a");
-  Optional<size_t> result = single_string.ReverseFind(L'a');
+  absl::optional<size_t> result = single_string.ReverseFind(L'a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.ReverseFind(L'b').has_value());
@@ -1474,7 +1474,7 @@
   EXPECT_FALSE(empty_string.Find(L'\0').has_value());
 
   WideStringView single_string(L"a");
-  Optional<size_t> result = single_string.Find(L'a');
+  absl::optional<size_t> result = single_string.Find(L'a');
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(0u, result.value());
   EXPECT_FALSE(single_string.Find(L'b').has_value());
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index a62a307..67a7106 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1135,7 +1135,7 @@
     m_pClipRgn = std::make_unique<CFX_ClipRgn>(
         GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
   }
-  Optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pObject2Device);
+  absl::optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pObject2Device);
   if (maybe_rectf.has_value()) {
     CFX_FloatRect& rectf = maybe_rectf.value();
     rectf.Intersect(
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 0cc6794..11a28ac 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -51,7 +51,7 @@
 
 bool FindFamilyNameMatch(ByteStringView family_name,
                          const ByteString& installed_font_name) {
-  Optional<size_t> result = installed_font_name.Find(family_name, 0);
+  absl::optional<size_t> result = installed_font_name.Find(family_name, 0);
   if (!result.has_value())
     return false;
 
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 4004d43..bc52064 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -422,7 +422,7 @@
   return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face->GetRec()), descender);
 }
 
-Optional<FX_RECT> CFX_Font::GetGlyphBBox(uint32_t glyph_index) {
+absl::optional<FX_RECT> CFX_Font::GetGlyphBBox(uint32_t glyph_index) {
   if (!m_Face)
     return absl::nullopt;
 
@@ -570,7 +570,7 @@
   return ByteString();
 }
 
-Optional<FX_RECT> CFX_Font::GetRawBBox() const {
+absl::optional<FX_RECT> CFX_Font::GetRawBBox() const {
   if (!m_Face)
     return absl::nullopt;
 
@@ -580,8 +580,8 @@
                  FXFT_Get_Face_yMax(m_Face->GetRec()));
 }
 
-Optional<FX_RECT> CFX_Font::GetBBox() const {
-  Optional<FX_RECT> result = GetRawBBox();
+absl::optional<FX_RECT> CFX_Font::GetBBox() const {
+  absl::optional<FX_RECT> result = GetRawBBox();
   if (!result.has_value())
     return result;
 
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 2b21c93..9184a44 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -107,7 +107,7 @@
   int GetGlyphWidth(uint32_t glyph_index);
   int GetAscent() const;
   int GetDescent() const;
-  Optional<FX_RECT> GetGlyphBBox(uint32_t glyph_index);
+  absl::optional<FX_RECT> GetGlyphBBox(uint32_t glyph_index);
   bool IsItalic() const;
   bool IsBold() const;
   bool IsFixedWidth() const;
@@ -119,10 +119,10 @@
   bool IsTTFont() const;
 
   // Raw bounding box.
-  Optional<FX_RECT> GetRawBBox() const;
+  absl::optional<FX_RECT> GetRawBBox() const;
 
   // Bounding box adjusted for font units.
-  Optional<FX_RECT> GetBBox() const;
+  absl::optional<FX_RECT> GetBBox() const;
 
   bool IsEmbedded() const { return m_bEmbedded; }
   uint8_t* GetSubData() const { return m_pGsubData.get(); }
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 401e598..ad7f291 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -378,7 +378,7 @@
   if (iBaseFont < kNumStandardFonts) {
     if (m_FoxitFaces[iBaseFont])
       return m_FoxitFaces[iBaseFont];
-    Optional<pdfium::span<const uint8_t>> font_data =
+    absl::optional<pdfium::span<const uint8_t>> font_data =
         m_pFontMgr->GetBuiltinFont(iBaseFont);
     if (font_data.has_value()) {
       m_FoxitFaces[iBaseFont] =
@@ -442,7 +442,7 @@
   bool bHasComma = false;
   bool bHasHyphen = false;
   {
-    Optional<size_t> pos = SubstName.Find(",");
+    absl::optional<size_t> pos = SubstName.Find(",");
     if (pos.has_value()) {
       family = SubstName.First(pos.value());
       GetStandardFontName(&family);
@@ -471,7 +471,7 @@
   } else {
     iBaseFont = kNumStandardFonts;
     if (!bHasComma) {
-      Optional<size_t> pos = family.ReverseFind('-');
+      absl::optional<size_t> pos = family.ReverseFind('-');
       if (pos.has_value()) {
         style = family.Last(family.GetLength() - (pos.value() + 1));
         family = family.First(pos.value());
@@ -568,7 +568,7 @@
         bItalic = italic_angle != 0;
         weight = old_weight;
       }
-      Optional<size_t> pos = SubstName.Find("Narrow");
+      absl::optional<size_t> pos = SubstName.Find("Narrow");
       if (pos.has_value() && pos.value() != 0)
         family = kNarrowFamily;
       pos = SubstName.Find("Condensed");
@@ -710,7 +710,7 @@
 }
 
 #if defined(OS_WIN)
-Optional<ByteString> CFX_FontMapper::InstalledFontNameStartingWith(
+absl::optional<ByteString> CFX_FontMapper::InstalledFontNameStartingWith(
     const ByteString& name) const {
   for (const auto& thisname : m_InstalledTTFonts) {
     if (thisname.First(name.GetLength()) == name)
@@ -719,7 +719,7 @@
   return absl::nullopt;
 }
 
-Optional<ByteString> CFX_FontMapper::LocalizedFontNameStartingWith(
+absl::optional<ByteString> CFX_FontMapper::LocalizedFontNameStartingWith(
     const ByteString& name) const {
   for (const auto& thispair : m_LocalizedTTFonts) {
     if (thispair.first.First(name.GetLength()) == name)
@@ -823,8 +823,8 @@
 }
 
 // static
-Optional<CFX_FontMapper::StandardFont> CFX_FontMapper::GetStandardFontName(
-    ByteString* name) {
+absl::optional<CFX_FontMapper::StandardFont>
+CFX_FontMapper::GetStandardFontName(ByteString* name) {
   const auto* end = std::end(kAltFontNames);
   const auto* found =
       std::lower_bound(std::begin(kAltFontNames), end, name->c_str(),
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index 7d0ea7b..3e6161c 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -47,7 +47,7 @@
   explicit CFX_FontMapper(CFX_FontMgr* mgr);
   ~CFX_FontMapper();
 
-  static Optional<StandardFont> GetStandardFontName(ByteString* name);
+  static absl::optional<StandardFont> GetStandardFontName(ByteString* name);
   static bool IsStandardFontName(const ByteString& name);
   static bool IsSymbolicFont(StandardFont font);
   static bool IsFixedFont(StandardFont font);
@@ -75,9 +75,9 @@
   bool HasLocalizedFont(ByteStringView name) const;
 
 #if defined(OS_WIN)
-  Optional<ByteString> InstalledFontNameStartingWith(
+  absl::optional<ByteString> InstalledFontNameStartingWith(
       const ByteString& name) const;
-  Optional<ByteString> LocalizedFontNameStartingWith(
+  absl::optional<ByteString> LocalizedFontNameStartingWith(
       const ByteString& name) const;
 #endif  // defined(OS_WIN)
 
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index 705f202..91a6238 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -160,7 +160,7 @@
 }
 
 // static
-Optional<pdfium::span<const uint8_t>> CFX_FontMgr::GetBuiltinFont(
+absl::optional<pdfium::span<const uint8_t>> CFX_FontMgr::GetBuiltinFont(
     size_t index) {
   if (index < pdfium::size(kFoxitFonts)) {
     return pdfium::make_span(kFoxitFonts[index].m_pFontData,
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 5b99f41..4863208 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -45,7 +45,8 @@
     ObservedPtr<CFX_Face> m_TTCFaces[16];
   };
 
-  static Optional<pdfium::span<const uint8_t>> GetBuiltinFont(size_t index);
+  static absl::optional<pdfium::span<const uint8_t>> GetBuiltinFont(
+      size_t index);
 
   CFX_FontMgr();
   ~CFX_FontMgr();
diff --git a/core/fxge/cfx_path.cpp b/core/fxge/cfx_path.cpp
index 8bfbc9a..182f07b 100644
--- a/core/fxge/cfx_path.cpp
+++ b/core/fxge/cfx_path.cpp
@@ -390,7 +390,8 @@
   return IsRectImpl(m_Points);
 }
 
-Optional<CFX_FloatRect> CFX_Path::GetRect(const CFX_Matrix* matrix) const {
+absl::optional<CFX_FloatRect> CFX_Path::GetRect(
+    const CFX_Matrix* matrix) const {
   bool do_normalize = PathPointsNeedNormalization(m_Points);
   std::vector<Point> normalized;
   if (do_normalize)
diff --git a/core/fxge/cfx_path.h b/core/fxge/cfx_path.h
index 2b2dffc..10c7476 100644
--- a/core/fxge/cfx_path.h
+++ b/core/fxge/cfx_path.h
@@ -57,7 +57,7 @@
 
   void Transform(const CFX_Matrix& matrix);
   bool IsRect() const;
-  Optional<CFX_FloatRect> GetRect(const CFX_Matrix* matrix) const;
+  absl::optional<CFX_FloatRect> GetRect(const CFX_Matrix* matrix) const;
 
   void Append(const CFX_Path& src, const CFX_Matrix* matrix);
   void AppendFloatRect(const CFX_FloatRect& rect);
diff --git a/core/fxge/cfx_path_unittest.cpp b/core/fxge/cfx_path_unittest.cpp
index b601079..b839441 100644
--- a/core/fxge/cfx_path_unittest.cpp
+++ b/core/fxge/cfx_path_unittest.cpp
@@ -11,7 +11,7 @@
   path.AppendRect(/*left=*/1, /*bottom=*/2, /*right=*/3, /*top=*/5);
   EXPECT_EQ(5u, path.GetPoints().size());
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   ASSERT_TRUE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(1, 2, 3, 5), rect.value());
   EXPECT_EQ(CFX_FloatRect(1, 2, 3, 5), path.GetBoundingBox());
@@ -70,7 +70,7 @@
 
   const CFX_Matrix kShearMatrix(1, 2, 0, 1, 0, 0);
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(&kShearMatrix);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(&kShearMatrix);
   EXPECT_FALSE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(1, 2, 3, 5), path.GetBoundingBox());
 
@@ -147,7 +147,7 @@
   EXPECT_EQ(CFX_Path::Point::Type::kLine, path.GetType(3));
   EXPECT_FALSE(path.IsClosingFigure(3));
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   ASSERT_TRUE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 1, 1), rect.value());
 
@@ -199,7 +199,7 @@
   EXPECT_EQ(CFX_Path::Point::Type::kLine, path.GetType(4));
   EXPECT_FALSE(path.IsClosingFigure(4));
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   ASSERT_TRUE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 2, 1), rect.value());
 
@@ -222,7 +222,7 @@
   path.AppendPoint({0, 1}, CFX_Path::Point::Type::kLine);
   path.AppendPoint({0, 0}, CFX_Path::Point::Type::kLine);
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   ASSERT_TRUE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 2, 1), rect.value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 2, 1), path.GetBoundingBox());
@@ -256,7 +256,7 @@
   path.AppendPoint({0, 1}, CFX_Path::Point::Type::kLine);
   path.AppendPoint({0, 0.1f}, CFX_Path::Point::Type::kLine);
   EXPECT_FALSE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   EXPECT_FALSE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 2, 1), path.GetBoundingBox());
 
@@ -341,7 +341,7 @@
   path.AppendPoint({0, 1}, CFX_Path::Point::Type::kLine);
   path.AppendPoint({0, 0}, CFX_Path::Point::Type::kLine);
   EXPECT_TRUE(path.IsRect());
-  Optional<CFX_FloatRect> rect = path.GetRect(nullptr);
+  absl::optional<CFX_FloatRect> rect = path.GetRect(nullptr);
   ASSERT_TRUE(rect.has_value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 0, 1), rect.value());
   EXPECT_EQ(CFX_FloatRect(0, 0, 0, 1), path.GetBoundingBox());
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 6912633..4d3457c 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -646,7 +646,7 @@
   }
 
   if (stroke_alpha == 0 && !fill_options.rect_aa) {
-    Optional<CFX_FloatRect> maybe_rect_f = pPath->GetRect(pObject2Device);
+    absl::optional<CFX_FloatRect> maybe_rect_f = pPath->GetRect(pObject2Device);
     if (maybe_rect_f.has_value()) {
       const CFX_FloatRect& rect_f = maybe_rect_f.value();
       FX_RECT rect_i = rect_f.GetOuterRect();
@@ -1143,7 +1143,8 @@
       if (!glyph.m_pGlyph)
         continue;
 
-      Optional<CFX_Point> point = glyph.GetOrigin({pixel_left, pixel_top});
+      absl::optional<CFX_Point> point =
+          glyph.GetOrigin({pixel_left, pixel_top});
       if (!point.has_value())
         continue;
 
@@ -1183,7 +1184,7 @@
     if (!glyph.m_pGlyph)
       continue;
 
-    Optional<CFX_Point> point = glyph.GetOrigin({pixel_left, pixel_top});
+    absl::optional<CFX_Point> point = glyph.GetOrigin({pixel_left, pixel_top});
     if (!point.has_value())
       continue;
 
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index a9e0742..96e3d49 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -38,7 +38,7 @@
   m_Height = 0;
   m_Pitch = 0;
 
-  Optional<PitchAndSize> pitch_size =
+  absl::optional<PitchAndSize> pitch_size =
       CalculatePitchAndSize(width, height, format, pitch);
   if (!pitch_size.has_value())
     return false;
@@ -683,7 +683,7 @@
 }
 
 // static
-Optional<CFX_DIBitmap::PitchAndSize> CFX_DIBitmap::CalculatePitchAndSize(
+absl::optional<CFX_DIBitmap::PitchAndSize> CFX_DIBitmap::CalculatePitchAndSize(
     int width,
     int height,
     FXDIB_Format format,
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h
index 032b888..4487c84 100644
--- a/core/fxge/dib/cfx_dibitmap.h
+++ b/core/fxge/dib/cfx_dibitmap.h
@@ -100,10 +100,10 @@
   // If |pitch| is non-zero, then that be used as the actual pitch.
   // The actual pitch will be used to calculate the size.
   // Returns the calculated pitch and size on success, or nullopt on failure.
-  static Optional<PitchAndSize> CalculatePitchAndSize(int width,
-                                                      int height,
-                                                      FXDIB_Format format,
-                                                      uint32_t pitch);
+  static absl::optional<PitchAndSize> CalculatePitchAndSize(int width,
+                                                            int height,
+                                                            FXDIB_Format format,
+                                                            uint32_t pitch);
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   void PreMultiply();
diff --git a/core/fxge/dib/cfx_dibitmap_unittest.cpp b/core/fxge/dib/cfx_dibitmap_unittest.cpp
index 3260a74..b7a80d5 100644
--- a/core/fxge/dib/cfx_dibitmap_unittest.cpp
+++ b/core/fxge/dib/cfx_dibitmap_unittest.cpp
@@ -17,7 +17,7 @@
 
 TEST(CFX_DIBitmap, CalculatePitchAndSizeGood) {
   // Simple case with no provided pitch.
-  Optional<CFX_DIBitmap::PitchAndSize> result =
+  absl::optional<CFX_DIBitmap::PitchAndSize> result =
       CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kArgb, 0);
   ASSERT_TRUE(result.has_value());
   EXPECT_EQ(400u, result.value().pitch);
@@ -83,7 +83,7 @@
 
 TEST(CFX_DIBitmap, CalculatePitchAndSizeBoundary) {
   // Test boundary condition for pitch overflow.
-  Optional<CFX_DIBitmap::PitchAndSize> result =
+  absl::optional<CFX_DIBitmap::PitchAndSize> result =
       CFX_DIBitmap::CalculatePitchAndSize(536870908, 4, FXDIB_Format::k8bppRgb,
                                           0);
   ASSERT_TRUE(result);
diff --git a/core/fxge/fx_font.cpp b/core/fxge/fx_font.cpp
index 9ea7201..beccd2e 100644
--- a/core/fxge/fx_font.cpp
+++ b/core/fxge/fx_font.cpp
@@ -40,7 +40,7 @@
     if (!glyph.m_pGlyph)
       continue;
 
-    Optional<CFX_Point> point = glyph.GetOrigin({0, 0});
+    absl::optional<CFX_Point> point = glyph.GetOrigin({0, 0});
     if (!point.has_value())
       continue;
 
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 49875bb..cd2a6bf 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1058,7 +1058,7 @@
     Dump(__func__);
     SkPath skClipPath;
     if (pPath->GetPoints().size() == 5 || pPath->GetPoints().size() == 4) {
-      Optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pMatrix);
+      absl::optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pMatrix);
       if (maybe_rectf.has_value()) {
         CFX_FloatRect& rectf = maybe_rectf.value();
         rectf.Intersect(CFX_FloatRect(
@@ -1994,7 +1994,7 @@
   }
 #endif
   if (pPath->GetPoints().size() == 5 || pPath->GetPoints().size() == 4) {
-    Optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(deviceMatrix);
+    absl::optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(deviceMatrix);
     if (maybe_rectf.has_value()) {
       CFX_FloatRect& rectf = maybe_rectf.value();
       rectf.Intersect(CFX_FloatRect(0, 0,
diff --git a/core/fxge/text_glyph_pos.cpp b/core/fxge/text_glyph_pos.cpp
index d5bb26b..c24e52e 100644
--- a/core/fxge/text_glyph_pos.cpp
+++ b/core/fxge/text_glyph_pos.cpp
@@ -15,7 +15,8 @@
 
 TextGlyphPos::~TextGlyphPos() = default;
 
-Optional<CFX_Point> TextGlyphPos::GetOrigin(const CFX_Point& offset) const {
+absl::optional<CFX_Point> TextGlyphPos::GetOrigin(
+    const CFX_Point& offset) const {
   FX_SAFE_INT32 left = m_Origin.x;
   left += m_pGlyph->left();
   left -= offset.x;
diff --git a/core/fxge/text_glyph_pos.h b/core/fxge/text_glyph_pos.h
index be7ced2..aa794fa 100644
--- a/core/fxge/text_glyph_pos.h
+++ b/core/fxge/text_glyph_pos.h
@@ -20,7 +20,7 @@
   TextGlyphPos(const TextGlyphPos&);
   ~TextGlyphPos();
 
-  Optional<CFX_Point> GetOrigin(const CFX_Point& offset) const;
+  absl::optional<CFX_Point> GetOrigin(const CFX_Point& offset) const;
 
   UnownedPtr<const CFX_GlyphBitmap> m_pGlyph;
   CFX_Point m_Origin;
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index f9cabfc..5228b2c 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -44,7 +44,7 @@
                     FT_FSTYPE_BITMAP_EMBEDDING_ONLY)) == 0;
 }
 
-Optional<ByteString> GenerateType42SfntData(
+absl::optional<ByteString> GenerateType42SfntData(
     const ByteString& psname,
     pdfium::span<const uint8_t> font_data) {
   if (font_data.empty())
@@ -169,7 +169,7 @@
   const ByteString psname = font->GetPsName();
   DCHECK(!psname.IsEmpty());
 
-  Optional<ByteString> sfnt_data =
+  absl::optional<ByteString> sfnt_data =
       GenerateType42SfntData(psname, font->GetFontSpan());
   if (!sfnt_data.has_value())
     return ByteString();
@@ -195,7 +195,7 @@
 
   UnownedPtr<CFX_Font> const font;
   const uint32_t glyph_index;
-  Optional<std::array<float, 4>> adjust_matrix;
+  absl::optional<std::array<float, 4>> adjust_matrix;
 };
 
 CFX_PSRenderer::CFX_PSRenderer(CFX_PSFontTracker* font_tracker,
@@ -893,7 +893,7 @@
 }
 
 // static
-Optional<ByteString> CFX_PSRenderer::GenerateType42SfntDataForTesting(
+absl::optional<ByteString> CFX_PSRenderer::GenerateType42SfntDataForTesting(
     const ByteString& psname,
     pdfium::span<const uint8_t> font_data) {
   return GenerateType42SfntData(psname, font_data);
diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h
index 67efeca..d8f51ee 100644
--- a/core/fxge/win32/cfx_psrenderer.h
+++ b/core/fxge/win32/cfx_psrenderer.h
@@ -111,7 +111,7 @@
                 float font_size,
                 uint32_t color);
 
-  static Optional<ByteString> GenerateType42SfntDataForTesting(
+  static absl::optional<ByteString> GenerateType42SfntDataForTesting(
       const ByteString& psname,
       pdfium::span<const uint8_t> font_data);
 
@@ -160,7 +160,7 @@
   bool m_bInited = false;
   bool m_bGraphStateSet = false;
   bool m_bColorSet = false;
-  Optional<RenderingLevel> m_Level;
+  absl::optional<RenderingLevel> m_Level;
   uint32_t m_LastColor = 0;
   FX_RECT m_ClipBox;
   CFX_GraphStateData m_CurGraphState;
diff --git a/core/fxge/win32/cfx_psrenderer_unittest.cpp b/core/fxge/win32/cfx_psrenderer_unittest.cpp
index 3b53aeb..96c6265 100644
--- a/core/fxge/win32/cfx_psrenderer_unittest.cpp
+++ b/core/fxge/win32/cfx_psrenderer_unittest.cpp
@@ -9,7 +9,7 @@
 #include "third_party/base/span.h"
 
 TEST(PSRendererTest, GenerateType42SfntData) {
-  Optional<ByteString> result;
+  absl::optional<ByteString> result;
 
   result = CFX_PSRenderer::GenerateType42SfntDataForTesting("empty", {});
   EXPECT_FALSE(result.has_value());
diff --git a/core/fxge/win32/cgdi_device_driver.cpp b/core/fxge/win32/cgdi_device_driver.cpp
index 7379598..a8b8382 100644
--- a/core/fxge/win32/cgdi_device_driver.cpp
+++ b/core/fxge/win32/cgdi_device_driver.cpp
@@ -671,7 +671,7 @@
     const CFX_Path* pPath,
     const CFX_Matrix* pMatrix,
     const CFX_FillRenderOptions& fill_options) {
-  Optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pMatrix);
+  absl::optional<CFX_FloatRect> maybe_rectf = pPath->GetRect(pMatrix);
   if (maybe_rectf.has_value()) {
     FX_RECT rect = maybe_rectf.value().GetOuterRect();
     // Can easily apply base clip to protect against wildly large rectangular
diff --git a/core/fxge/win32/cgdi_device_driver.h b/core/fxge/win32/cgdi_device_driver.h
index de16a15..659cf3d 100644
--- a/core/fxge/win32/cgdi_device_driver.h
+++ b/core/fxge/win32/cgdi_device_driver.h
@@ -72,7 +72,7 @@
   int m_nBitsPerPixel;
   const DeviceType m_DeviceType;
   int m_RenderCaps;
-  Optional<FX_RECT> m_BaseClipBox;
+  absl::optional<FX_RECT> m_BaseClipBox;
 };
 
 #endif  // CORE_FXGE_WIN32_CGDI_DEVICE_DRIVER_H_
diff --git a/core/fxge/win32/cgdi_plus_ext.cpp b/core/fxge/win32/cgdi_plus_ext.cpp
index 3b1e9e6..601d8ab 100644
--- a/core/fxge/win32/cgdi_plus_ext.cpp
+++ b/core/fxge/win32/cgdi_plus_ext.cpp
@@ -372,7 +372,7 @@
   return pPen;
 }
 
-Optional<std::pair<size_t, size_t>> IsSmallTriangle(
+absl::optional<std::pair<size_t, size_t>> IsSmallTriangle(
     pdfium::span<const Gdiplus::PointF> points,
     const CFX_Matrix* pMatrix) {
   static constexpr size_t kPairs[3][2] = {{1, 2}, {0, 2}, {0, 1}};
diff --git a/core/fxge/win32/cwin32_platform.cpp b/core/fxge/win32/cwin32_platform.cpp
index 9269b8f..f426df3 100644
--- a/core/fxge/win32/cwin32_platform.cpp
+++ b/core/fxge/win32/cwin32_platform.cpp
@@ -209,12 +209,12 @@
   if (!m_pMapper)
     return name;
 
-  Optional<ByteString> maybe_installed =
+  absl::optional<ByteString> maybe_installed =
       m_pMapper->InstalledFontNameStartingWith(name);
   if (maybe_installed.has_value())
     return maybe_installed.value();
 
-  Optional<ByteString> maybe_localized =
+  absl::optional<ByteString> maybe_localized =
       m_pMapper->LocalizedFontNameStartingWith(name);
   if (maybe_localized.has_value())
     return maybe_localized.value();
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
index c2a2887..8d1966f 100644
--- a/fpdfsdk/cpdfsdk_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -1114,7 +1114,7 @@
   pImageDict->SetNewFor<CPDF_String>("Name", name, false);
 }
 
-Optional<CheckStyle> CheckStyleFromCaption(const WideString& caption) {
+absl::optional<CheckStyle> CheckStyleFromCaption(const WideString& caption) {
   if (caption.IsEmpty())
     return absl::nullopt;
 
@@ -1202,12 +1202,12 @@
 
   CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
   CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
-  Optional<CFX_Color> color = da.GetColor();
+  absl::optional<CFX_Color> color = da.GetColor();
   CFX_Color crText = color.value_or(CFX_Color(CFX_Color::Type::kGray, 0));
 
   float fFontSize;
   ByteString csNameTag;
-  Optional<ByteString> font = da.GetFont(&fFontSize);
+  absl::optional<ByteString> font = da.GetFont(&fFontSize);
   if (font.has_value())
     csNameTag = font.value();
   else
@@ -1353,7 +1353,7 @@
 
   CFX_FloatRect rcWindow = widget_->GetRotatedRect();
   CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
-  Optional<CFX_Color> color = pControl->GetDefaultAppearance().GetColor();
+  absl::optional<CFX_Color> color = pControl->GetDefaultAppearance().GetColor();
   CFX_Color crText = color.value_or(CFX_Color());
 
   CheckStyle nStyle = CheckStyleFromCaption(pControl->GetNormalCaption())
@@ -1432,7 +1432,7 @@
 
   CFX_FloatRect rcWindow = widget_->GetRotatedRect();
   CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
-  Optional<CFX_Color> color = pControl->GetDefaultAppearance().GetColor();
+  absl::optional<CFX_Color> color = pControl->GetDefaultAppearance().GetColor();
   CFX_Color crText = color.value_or(CFX_Color());
   CheckStyle nStyle = CheckStyleFromCaption(pControl->GetNormalCaption())
                           .value_or(CheckStyle::kCircle);
@@ -1518,7 +1518,7 @@
     widget_->SetAppStateOff();
 }
 
-void CPDFSDK_AppStream::SetAsComboBox(Optional<WideString> sValue) {
+void CPDFSDK_AppStream::SetAsComboBox(absl::optional<WideString> sValue) {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CPDF_FormField* pField = pControl->GetField();
   std::ostringstream sBody;
@@ -1674,7 +1674,7 @@
         ByteString());
 }
 
-void CPDFSDK_AppStream::SetAsTextField(Optional<WideString> sValue) {
+void CPDFSDK_AppStream::SetAsTextField(absl::optional<WideString> sValue) {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CPDF_FormField* pField = pControl->GetField();
   std::ostringstream sBody;
diff --git a/fpdfsdk/cpdfsdk_appstream.h b/fpdfsdk/cpdfsdk_appstream.h
index 3e6709e..2f5da3a 100644
--- a/fpdfsdk/cpdfsdk_appstream.h
+++ b/fpdfsdk/cpdfsdk_appstream.h
@@ -24,9 +24,9 @@
   void SetAsPushButton();
   void SetAsCheckBox();
   void SetAsRadioButton();
-  void SetAsComboBox(Optional<WideString> sValue);
+  void SetAsComboBox(absl::optional<WideString> sValue);
   void SetAsListBox();
-  void SetAsTextField(Optional<WideString> sValue);
+  void SetAsTextField(absl::optional<WideString> sValue);
 
  private:
   void AddImage(const ByteString& sAPType, CPDF_Stream* pImage);
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index cfbb422..d4b3634 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -421,7 +421,7 @@
   CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   DCHECK(pWidget);
 
-  Optional<WideString> sValue =
+  absl::optional<WideString> sValue =
       m_pInteractiveForm->OnFormat(pWidget->GetFormField());
   if (!pAnnot)
     return;
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 938cb6a..357fc76 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -279,13 +279,13 @@
     IJS_Runtime::ScopedEventContext pContext(pRuntime);
     pContext->OnField_Calculate(pFormField, pField, &sValue, &bRC);
 
-    Optional<IJS_Runtime::JS_Error> err = pContext->RunScript(csJS);
+    absl::optional<IJS_Runtime::JS_Error> err = pContext->RunScript(csJS);
     if (!err.has_value() && bRC && sValue != sOldValue)
       pField->SetValue(sValue, NotificationOption::kNotify);
   }
 }
 
-Optional<WideString> CPDFSDK_InteractiveForm::OnFormat(
+absl::optional<WideString> CPDFSDK_InteractiveForm::OnFormat(
     CPDF_FormField* pFormField) {
   if (!m_pFormFillEnv->IsJSPlatformPresent())
     return absl::nullopt;
@@ -307,7 +307,7 @@
       if (!script.IsEmpty()) {
         IJS_Runtime::ScopedEventContext pContext(pRuntime);
         pContext->OnField_Format(pFormField, &sValue);
-        Optional<IJS_Runtime::JS_Error> err = pContext->RunScript(script);
+        absl::optional<IJS_Runtime::JS_Error> err = pContext->RunScript(script);
         if (!err.has_value())
           return sValue;
       }
@@ -318,7 +318,7 @@
 
 void CPDFSDK_InteractiveForm::ResetFieldAppearance(
     CPDF_FormField* pFormField,
-    Optional<WideString> sValue) {
+    absl::optional<WideString> sValue) {
   for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
     CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
     DCHECK(pFormCtrl);
diff --git a/fpdfsdk/cpdfsdk_interactiveform.h b/fpdfsdk/cpdfsdk_interactiveform.h
index d4c5bda..14aeb08 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.h
+++ b/fpdfsdk/cpdfsdk_interactiveform.h
@@ -60,10 +60,10 @@
   bool OnKeyStrokeCommit(CPDF_FormField* pFormField, const WideString& csValue);
   bool OnValidate(CPDF_FormField* pFormField, const WideString& csValue);
   void OnCalculate(CPDF_FormField* pFormField);
-  Optional<WideString> OnFormat(CPDF_FormField* pFormField);
+  absl::optional<WideString> OnFormat(CPDF_FormField* pFormField);
 
   void ResetFieldAppearance(CPDF_FormField* pFormField,
-                            Optional<WideString> sValue);
+                            absl::optional<WideString> sValue);
   void UpdateField(CPDF_FormField* pFormField);
 
   bool DoAction_Hide(const CPDF_Action& action);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 64ba361..b1c1b62 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -429,7 +429,7 @@
 }
 #endif  // PDF_ENABLE_XFA
 
-Optional<FX_COLORREF> CPDFSDK_Widget::GetFillColor() const {
+absl::optional<FX_COLORREF> CPDFSDK_Widget::GetFillColor() const {
   CFX_Color::TypeAndARGB type_argb_pair =
       GetFormControl()->GetColorARGB(pdfium::appearance::kBG);
 
@@ -439,7 +439,7 @@
   return ArgbToColorRef(type_argb_pair.argb);
 }
 
-Optional<FX_COLORREF> CPDFSDK_Widget::GetBorderColor() const {
+absl::optional<FX_COLORREF> CPDFSDK_Widget::GetBorderColor() const {
   CFX_Color::TypeAndARGB type_argb_pair =
       GetFormControl()->GetColorARGB(pdfium::appearance::kBC);
   if (type_argb_pair.color_type == CFX_Color::Type::kTransparent)
@@ -448,9 +448,10 @@
   return ArgbToColorRef(type_argb_pair.argb);
 }
 
-Optional<FX_COLORREF> CPDFSDK_Widget::GetTextColor() const {
+absl::optional<FX_COLORREF> CPDFSDK_Widget::GetTextColor() const {
   CPDF_DefaultAppearance da = GetFormControl()->GetDefaultAppearance();
-  Optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair = da.GetColorARGB();
+  absl::optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
+      da.GetColorARGB();
 
   if (!maybe_type_argb_pair.has_value())
     return absl::nullopt;
@@ -618,7 +619,7 @@
 }
 #endif  // PDF_ENABLE_XFA
 
-void CPDFSDK_Widget::ResetAppearance(Optional<WideString> sValue,
+void CPDFSDK_Widget::ResetAppearance(absl::optional<WideString> sValue,
                                      ValueChanged bValueChanged) {
   SetAppModified();
 
@@ -653,7 +654,7 @@
   m_pAnnot->ClearCachedAP();
 }
 
-Optional<WideString> CPDFSDK_Widget::OnFormat() {
+absl::optional<WideString> CPDFSDK_Widget::OnFormat() {
   CPDF_FormField* pFormField = GetFormField();
   DCHECK(pFormField);
   return m_pInteractiveForm->OnFormat(pFormField);
@@ -781,7 +782,8 @@
 
 CFX_Color CPDFSDK_Widget::GetTextPWLColor() const {
   CPDF_FormControl* pFormCtrl = GetFormControl();
-  Optional<CFX_Color> crText = pFormCtrl->GetDefaultAppearance().GetColor();
+  absl::optional<CFX_Color> crText =
+      pFormCtrl->GetDefaultAppearance().GetColor();
   return crText.value_or(CFX_Color(CFX_Color::Type::kGray, 0));
 }
 
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index 9b32489..1267799 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -62,9 +62,9 @@
   int GetFieldFlags() const;
   int GetRotate() const;
 
-  Optional<FX_COLORREF> GetFillColor() const;
-  Optional<FX_COLORREF> GetBorderColor() const;
-  Optional<FX_COLORREF> GetTextColor() const;
+  absl::optional<FX_COLORREF> GetFillColor() const;
+  absl::optional<FX_COLORREF> GetBorderColor() const;
+  absl::optional<FX_COLORREF> GetTextColor() const;
   float GetFontSize() const;
 
   int GetSelectedIndex(int nIndex) const;
@@ -95,10 +95,11 @@
   void ResetXFAAppearance(ValueChanged bValueChanged);
 #endif  // PDF_ENABLE_XFA
 
-  void ResetAppearance(Optional<WideString> sValue, ValueChanged bValueChanged);
+  void ResetAppearance(absl::optional<WideString> sValue,
+                       ValueChanged bValueChanged);
   void ResetFieldAppearance();
   void UpdateField();
-  Optional<WideString> OnFormat();
+  absl::optional<WideString> OnFormat();
 
   bool OnAAction(CPDF_AAction::AActionType type,
                  CFFL_FieldAction* data,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 1be3709..1df9bee 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -217,7 +217,7 @@
   if (fieldType == FormFieldType::kTextField ||
       fieldType == FormFieldType::kComboBox) {
     ObservedPtr<CPDFSDK_Annot> pObserved(pWidget);
-    Optional<WideString> sValue = pWidget->OnFormat();
+    absl::optional<WideString> sValue = pWidget->OnFormat();
     if (!pObserved)
       return;
 
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index 603552d..f944901 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -306,7 +306,7 @@
   if (dwFieldFlag & pdfium::form_flags::kReadOnly)
     dwCreateFlags |= PWS_READONLY;
 
-  Optional<FX_COLORREF> color = m_pWidget->GetFillColor();
+  absl::optional<FX_COLORREF> color = m_pWidget->GetFillColor();
   if (color.has_value())
     cp.sBackgroundColor = CFX_Color(color.value());
   color = m_pWidget->GetBorderColor();
diff --git a/fpdfsdk/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
index 02b481c..bcd3ca3 100644
--- a/fpdfsdk/fpdf_dataavail_embeddertest.cpp
+++ b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
@@ -300,7 +300,7 @@
   // Map "Info" to an object within the first section without breaking
   // linearization.
   ByteString data(loader.file_contents(), loader.file_length());
-  Optional<size_t> index = data.Find("/Info 27 0 R");
+  absl::optional<size_t> index = data.Find("/Info 27 0 R");
   ASSERT_TRUE(index);
   memcpy(loader.file_contents() + *index, "/Info 29 0 R", 12);
 
@@ -327,7 +327,7 @@
   TestAsyncLoader loader("linearized.pdf");
   // Map "Info" to an invalid object without breaking linearization.
   ByteString data(loader.file_contents(), loader.file_length());
-  Optional<size_t> index = data.Find("/Info 27 0 R");
+  absl::optional<size_t> index = data.Find("/Info 27 0 R");
   ASSERT_TRUE(index);
   memcpy(loader.file_contents() + *index, "/Info 99 0 R", 12);
 
@@ -353,7 +353,7 @@
   TestAsyncLoader loader("linearized.pdf");
   // Break the "Info" parameter without breaking linearization.
   ByteString data(loader.file_contents(), loader.file_length());
-  Optional<size_t> index = data.Find("/Info 27 0 R");
+  absl::optional<size_t> index = data.Find("/Info 27 0 R");
   ASSERT_TRUE(index);
   memcpy(loader.file_contents() + *index, "/I_fo 27 0 R", 12);
 
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 3bed946..459f8d5 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -492,7 +492,7 @@
 
   // CPDF_PageLabel can deal with NULL |document|.
   CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document));
-  Optional<WideString> str = label.GetLabel(page_index);
+  absl::optional<WideString> str = label.GetLabel(page_index);
   return str.has_value()
              ? Utf16EncodeMaybeCopyAndReturnLength(str.value(), buffer, buflen)
              : 0;
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 0d07c2f..d238e4a 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -707,7 +707,7 @@
   if (!pForm)
     return;
 
-  Optional<FormFieldType> cast_input =
+  absl::optional<FormFieldType> cast_input =
       CPDF_FormField::IntToFormFieldType(fieldType);
   if (!cast_input.has_value())
     return;
diff --git a/fpdfsdk/fpdf_javascript.cpp b/fpdfsdk/fpdf_javascript.cpp
index 44f4d59..e333bfa 100644
--- a/fpdfsdk/fpdf_javascript.cpp
+++ b/fpdfsdk/fpdf_javascript.cpp
@@ -48,7 +48,7 @@
   if (action.GetType() != CPDF_Action::Type::kJavaScript)
     return nullptr;
 
-  Optional<WideString> script = action.MaybeGetJavaScript();
+  absl::optional<WideString> script = action.MaybeGetJavaScript();
   if (!script.has_value())
     return nullptr;
 
diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp
index d6012d7..f01bdf7 100644
--- a/fpdfsdk/fpdf_save.cpp
+++ b/fpdfsdk/fpdf_save.cpp
@@ -151,7 +151,7 @@
 bool DoDocSave(FPDF_DOCUMENT document,
                FPDF_FILEWRITE* pFileWrite,
                FPDF_DWORD flags,
-               Optional<int> version) {
+               absl::optional<int> version) {
   CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pPDFDoc)
     return 0;
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index d0b0f50..10a82ff 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -385,7 +385,7 @@
   options.bConsecutive = !!(flags & FPDF_CONSECUTIVE);
   auto find = CPDF_TextPageFind::Create(
       textpage, WideStringFromFPDFWideString(findwhat), options,
-      start_index >= 0 ? Optional<size_t>(start_index) : absl::nullopt);
+      start_index >= 0 ? absl::optional<size_t>(start_index) : absl::nullopt);
 
   // Caller takes ownership.
   return FPDFSchHandleFromCPDFTextPageFind(find.release());
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 1b359f6..c061b76 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -765,7 +765,7 @@
 
   IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
   const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
-  Optional<CFX_PointF> pos =
+  absl::optional<CFX_PointF> pos =
       pPage->DeviceToPage(rect, rotate, CFX_PointF(device_x, device_y));
   if (!pos.has_value())
     return false;
@@ -791,7 +791,8 @@
   IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
   const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
   CFX_PointF page_point(static_cast<float>(page_x), static_cast<float>(page_y));
-  Optional<CFX_PointF> pos = pPage->PageToDevice(rect, rotate, page_point);
+  absl::optional<CFX_PointF> pos =
+      pPage->PageToDevice(rect, rotate, page_point);
   if (!pos.has_value())
     return false;
 
@@ -1023,7 +1024,7 @@
     return 0;
 
   CPDF_ViewerPreferences viewRef(pDoc);
-  Optional<ByteString> bsVal = viewRef.GenericName(key);
+  absl::optional<ByteString> bsVal = viewRef.GenericName(key);
   if (!bsVal.has_value())
     return 0;
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index b329fcf..e1320b9 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -174,7 +174,7 @@
   return 0.0f;
 }
 
-Optional<CFX_PointF> CPDFXFA_Page::DeviceToPage(
+absl::optional<CFX_PointF> CPDFXFA_Page::DeviceToPage(
     const FX_RECT& rect,
     int rotate,
     const CFX_PointF& device_point) const {
@@ -186,7 +186,7 @@
   return page2device.GetInverse().Transform(device_point);
 }
 
-Optional<CFX_PointF> CPDFXFA_Page::PageToDevice(
+absl::optional<CFX_PointF> CPDFXFA_Page::PageToDevice(
     const FX_RECT& rect,
     int rotate,
     const CFX_PointF& page_point) const {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index a43b744..83495a9 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -32,11 +32,11 @@
   float GetPageWidth() const override;
   float GetPageHeight() const override;
   CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const override;
-  Optional<CFX_PointF> DeviceToPage(
+  absl::optional<CFX_PointF> DeviceToPage(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& device_point) const override;
-  Optional<CFX_PointF> PageToDevice(
+  absl::optional<CFX_PointF> PageToDevice(
       const FX_RECT& rect,
       int rotate,
       const CFX_PointF& page_point) const override;
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index 5395913..732f615 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -73,7 +73,7 @@
   return m_expTable[a];
 }
 
-Optional<int32_t> CBC_ReedSolomonGF256::Inverse(int32_t a) {
+absl::optional<int32_t> CBC_ReedSolomonGF256::Inverse(int32_t a) {
   if (a == 0)
     return absl::nullopt;
   return m_expTable[255 - m_logTable[a]];
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
index 30f5524..10c3926 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
@@ -25,7 +25,7 @@
                                                           int32_t coefficient);
   static int32_t AddOrSubtract(int32_t a, int32_t b);
   int32_t Exp(int32_t a);
-  Optional<int32_t> Inverse(int32_t a);
+  absl::optional<int32_t> Inverse(int32_t a);
   int32_t Multiply(int32_t a, int32_t b);
   void Init();
 
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index c4fa16a..7b2d3ac 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -152,7 +152,7 @@
     return nullptr;
 
   int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
-  Optional<int32_t> inverseDenominatorLeadingTeam =
+  absl::optional<int32_t> inverseDenominatorLeadingTeam =
       m_field->Inverse(denominatorLeadingTerm);
   if (!inverseDenominatorLeadingTeam.has_value())
     return nullptr;
diff --git a/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
index 58f3cd0..6fd6182 100644
--- a/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
@@ -31,10 +31,10 @@
 
 namespace {
 
-Optional<wchar_t> EncodeASCIIDigits(wchar_t digit1, wchar_t digit2) {
+absl::optional<wchar_t> EncodeASCIIDigits(wchar_t digit1, wchar_t digit2) {
   if (!FXSYS_IsDecimalDigit(digit1) || !FXSYS_IsDecimalDigit(digit2)) {
     // This could potentially return 0 as a sentinel value. Then this function
-    // can just return wchar_t instead of Optional<wchar_t>.
+    // can just return wchar_t instead of absl::optional<wchar_t>.
     return absl::nullopt;
   }
   return static_cast<wchar_t>((digit1 - 48) * 10 + (digit2 - 48) + 130);
@@ -67,7 +67,7 @@
 bool CBC_ASCIIEncoder::Encode(CBC_EncoderContext* context) {
   size_t n = DetermineConsecutiveDigitCount(context->m_msg, context->m_pos);
   if (n >= 2) {
-    Optional<wchar_t> code = EncodeASCIIDigits(
+    absl::optional<wchar_t> code = EncodeASCIIDigits(
         context->m_msg[context->m_pos], context->m_msg[context->m_pos + 1]);
     if (!code.has_value())
       return false;
diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp
index 7effff7..0a1f6b3 100644
--- a/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/fxbarcode/pdf417/BC_PDF417.cpp
@@ -366,7 +366,7 @@
   if (errorCorrectionCodeWords < 0)
     return false;
 
-  Optional<WideString> high_level =
+  absl::optional<WideString> high_level =
       CBC_PDF417HighLevelEncoder::EncodeHighLevel(msg);
   if (!high_level.has_value())
     return false;
@@ -391,8 +391,9 @@
     sb += (wchar_t)900;
 
   WideString dataCodewords(sb);
-  Optional<WideString> ec = CBC_PDF417ErrorCorrection::GenerateErrorCorrection(
-      dataCodewords, errorCorrectionLevel);
+  absl::optional<WideString> ec =
+      CBC_PDF417ErrorCorrection::GenerateErrorCorrection(dataCodewords,
+                                                         errorCorrectionLevel);
   if (!ec.has_value())
     return false;
 
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
index 987dccb..f522cb9 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
@@ -133,7 +133,7 @@
 }
 
 // static
-Optional<WideString> CBC_PDF417ErrorCorrection::GenerateErrorCorrection(
+absl::optional<WideString> CBC_PDF417ErrorCorrection::GenerateErrorCorrection(
     const WideString& dataCodewords,
     int32_t errorCorrectionLevel) {
   int32_t k = GetErrorCorrectionCodewordCount(errorCorrectionLevel);
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
index f5aa898..2a3d50b 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
@@ -18,7 +18,7 @@
   ~CBC_PDF417ErrorCorrection() = delete;
 
   static int32_t GetErrorCorrectionCodewordCount(int32_t errorCorrectionLevel);
-  static Optional<WideString> GenerateErrorCorrection(
+  static absl::optional<WideString> GenerateErrorCorrection(
       const WideString& dataCodewords,
       int32_t errorCorrectionLevel);
 };
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index 856cbb1..501e593 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -76,7 +76,7 @@
 }  // namespace
 
 // static
-Optional<WideString> CBC_PDF417HighLevelEncoder::EncodeHighLevel(
+absl::optional<WideString> CBC_PDF417HighLevelEncoder::EncodeHighLevel(
     WideStringView msg) {
   const ByteString bytes = FX_UTF8Encode(msg);
   size_t len = bytes.GetLength();
@@ -114,7 +114,7 @@
         textSubMode = EncodeText(result, p, t, textSubMode, &sb);
         p += t;
       } else {
-        Optional<size_t> b =
+        absl::optional<size_t> b =
             DetermineConsecutiveBinaryCount(result, bytes.raw_span(), p);
         if (!b.has_value())
           return absl::nullopt;
@@ -351,7 +351,8 @@
   return idx - startpos;
 }
 
-Optional<size_t> CBC_PDF417HighLevelEncoder::DetermineConsecutiveBinaryCount(
+absl::optional<size_t>
+CBC_PDF417HighLevelEncoder::DetermineConsecutiveBinaryCount(
     WideString msg,
     pdfium::span<const uint8_t> bytes,
     size_t startpos) {
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 22060f9..97edbc4 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -17,7 +17,7 @@
   CBC_PDF417HighLevelEncoder() = delete;
   ~CBC_PDF417HighLevelEncoder() = delete;
 
-  static Optional<WideString> EncodeHighLevel(WideStringView msg);
+  static absl::optional<WideString> EncodeHighLevel(WideStringView msg);
 
  private:
   enum class EncodingMode { kUnknown = 0, kText, kByte, kNumeric };
@@ -40,7 +40,7 @@
                             WideString* sb);
   static size_t DetermineConsecutiveDigitCount(WideString msg, size_t startpos);
   static size_t DetermineConsecutiveTextCount(WideString msg, size_t startpos);
-  static Optional<size_t> DetermineConsecutiveBinaryCount(
+  static absl::optional<size_t> DetermineConsecutiveBinaryCount(
       WideString msg,
       pdfium::span<const uint8_t> bytes,
       size_t startpos);
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index 7f75536..03380a2d 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -44,7 +44,7 @@
     const EncodeHighLevelCase& testcase = kEncodeHighLevelCases[i];
     WideStringView input(testcase.input);
     WideString expected(testcase.expected, testcase.expected_length);
-    Optional<WideString> result =
+    absl::optional<WideString> result =
         CBC_PDF417HighLevelEncoder::EncodeHighLevel(input);
     ASSERT_TRUE(result.has_value());
     EXPECT_EQ(expected, result.value()) << " for case number " << i;
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 07241f3..45ccaaa 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -252,7 +252,7 @@
          CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(matrix);
 }
 
-Optional<int32_t> ChooseMaskPattern(
+absl::optional<int32_t> ChooseMaskPattern(
     CBC_QRCoderBitVector* bits,
     const CBC_QRCoderErrorCorrectionLevel* ecLevel,
     int32_t version,
@@ -453,7 +453,7 @@
 
   auto matrix = std::make_unique<CBC_CommonByteMatrix>(
       qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth());
-  Optional<int32_t> maskPattern = ChooseMaskPattern(
+  absl::optional<int32_t> maskPattern = ChooseMaskPattern(
       &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get());
   if (!maskPattern.has_value())
     return false;
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp
index 26e30bf..cc1084f 100644
--- a/fxjs/cfx_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -257,7 +257,7 @@
   bool ret;
   {
     // Span can't outlive call to BufferDone().
-    Optional<pdfium::span<uint8_t>> buffer = m_pDelegate->LoadBuffer();
+    absl::optional<pdfium::span<uint8_t>> buffer = m_pDelegate->LoadBuffer();
     if (!buffer.has_value() || buffer.value().empty())
       return false;
 
diff --git a/fxjs/cfx_globaldata.h b/fxjs/cfx_globaldata.h
index 5d260c7..40e5548 100644
--- a/fxjs/cfx_globaldata.h
+++ b/fxjs/cfx_globaldata.h
@@ -23,7 +23,7 @@
     virtual ~Delegate() = default;
 
     virtual bool StoreBuffer(pdfium::span<const uint8_t> pBuffer) = 0;
-    virtual Optional<pdfium::span<uint8_t>> LoadBuffer() = 0;
+    virtual absl::optional<pdfium::span<uint8_t>> LoadBuffer() = 0;
     virtual void BufferDone() = 0;
   };
 
diff --git a/fxjs/cfx_globaldata_unittest.cpp b/fxjs/cfx_globaldata_unittest.cpp
index 24c080a..99dbccf 100644
--- a/fxjs/cfx_globaldata_unittest.cpp
+++ b/fxjs/cfx_globaldata_unittest.cpp
@@ -21,7 +21,7 @@
         buffer.begin(), buffer.end());
     return true;
   }
-  Optional<pdfium::span<uint8_t>> LoadBuffer() override {
+  absl::optional<pdfium::span<uint8_t>> LoadBuffer() override {
     return pdfium::span<uint8_t>(last_buffer_);
   }
   void BufferDone() override {
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index af68a2e..9f15613 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -562,7 +562,7 @@
   GetIsolate()->SetData(g_embedderDataSlot, nullptr);
 }
 
-Optional<IJS_Runtime::JS_Error> CFXJS_Engine::Execute(
+absl::optional<IJS_Runtime::JS_Error> CFXJS_Engine::Execute(
     const WideString& script) {
   v8::Isolate::Scope isolate_scope(GetIsolate());
   v8::TryCatch try_catch(GetIsolate());
diff --git a/fxjs/cfxjs_engine.h b/fxjs/cfxjs_engine.h
index 4f1c08e..45dc664 100644
--- a/fxjs/cfxjs_engine.h
+++ b/fxjs/cfxjs_engine.h
@@ -120,7 +120,7 @@
   void ReleaseEngine();
 
   // Called after FXJS_InitializeEngine call made.
-  Optional<IJS_Runtime::JS_Error> Execute(const WideString& script);
+  absl::optional<IJS_Runtime::JS_Error> Execute(const WideString& script);
 
   v8::Local<v8::Object> GetThisObj();
   v8::Local<v8::Object> NewFXJSBoundObject(uint32_t nObjDefnID,
diff --git a/fxjs/cfxjs_engine_embeddertest.cpp b/fxjs/cfxjs_engine_embeddertest.cpp
index abeb64d..5763f4d 100644
--- a/fxjs/cfxjs_engine_embeddertest.cpp
+++ b/fxjs/cfxjs_engine_embeddertest.cpp
@@ -35,7 +35,8 @@
   v8::HandleScope handle_scope(isolate());
   v8::Context::Scope context_scope(GetV8Context());
 
-  Optional<IJS_Runtime::JS_Error> err = engine()->Execute(WideString(kScript1));
+  absl::optional<IJS_Runtime::JS_Error> err =
+      engine()->Execute(WideString(kScript1));
   EXPECT_FALSE(err);
   CheckAssignmentInEngineContext(engine(), kExpected1);
 }
@@ -52,7 +53,7 @@
 
   v8::Context::Scope context_scope(GetV8Context());
   {
-    Optional<IJS_Runtime::JS_Error> err =
+    absl::optional<IJS_Runtime::JS_Error> err =
         engine()->Execute(WideString(kScript0));
     EXPECT_FALSE(err);
     CheckAssignmentInEngineContext(engine(), kExpected0);
@@ -60,7 +61,8 @@
   {
     // engine1 executing in engine1's context doesn't affect main.
     v8::Context::Scope context_scope1(engine1.GetV8Context());
-    Optional<IJS_Runtime::JS_Error> err = engine1.Execute(WideString(kScript1));
+    absl::optional<IJS_Runtime::JS_Error> err =
+        engine1.Execute(WideString(kScript1));
     EXPECT_FALSE(err);
     CheckAssignmentInEngineContext(engine(), kExpected0);
     CheckAssignmentInEngineContext(&engine1, kExpected1);
@@ -68,7 +70,8 @@
   {
     // engine1 executing in engine2's context doesn't affect engine1.
     v8::Context::Scope context_scope2(engine2.GetV8Context());
-    Optional<IJS_Runtime::JS_Error> err = engine1.Execute(WideString(kScript2));
+    absl::optional<IJS_Runtime::JS_Error> err =
+        engine1.Execute(WideString(kScript2));
     EXPECT_FALSE(err);
     CheckAssignmentInEngineContext(engine(), kExpected0);
     CheckAssignmentInEngineContext(&engine1, kExpected1);
@@ -83,7 +86,7 @@
   v8::HandleScope handle_scope(isolate());
   v8::Context::Scope context_scope(GetV8Context());
 
-  Optional<IJS_Runtime::JS_Error> err =
+  absl::optional<IJS_Runtime::JS_Error> err =
       engine()->Execute(L"functoon(x) { return x+1; }");
   EXPECT_TRUE(err);
   EXPECT_STREQ(L"SyntaxError: Unexpected token '{'", err->exception.c_str());
@@ -96,7 +99,7 @@
   v8::HandleScope handle_scope(isolate());
   v8::Context::Scope context_scope(GetV8Context());
 
-  Optional<IJS_Runtime::JS_Error> err =
+  absl::optional<IJS_Runtime::JS_Error> err =
       engine()->Execute(L"let a = 3;\nundefined.colour");
   EXPECT_TRUE(err);
   EXPECT_EQ(
diff --git a/fxjs/cfxjs_engine_unittest.cpp b/fxjs/cfxjs_engine_unittest.cpp
index 0470a78..496aead 100644
--- a/fxjs/cfxjs_engine_unittest.cpp
+++ b/fxjs/cfxjs_engine_unittest.cpp
@@ -84,7 +84,7 @@
     EXPECT_FALSE(temp_destroyed);
   }
 
-  Optional<IJS_Runtime::JS_Error> err = engine()->Execute(L"gc();");
+  absl::optional<IJS_Runtime::JS_Error> err = engine()->Execute(L"gc();");
   EXPECT_FALSE(err);
 
   EXPECT_TRUE(perm_created);
diff --git a/fxjs/cjs_event_context.cpp b/fxjs/cjs_event_context.cpp
index da8b8ee..888d429 100644
--- a/fxjs/cjs_event_context.cpp
+++ b/fxjs/cjs_event_context.cpp
@@ -22,7 +22,7 @@
 
 CJS_EventContext::~CJS_EventContext() = default;
 
-Optional<IJS_Runtime::JS_Error> CJS_EventContext::RunScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_EventContext::RunScript(
     const WideString& script) {
   v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
   v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
@@ -44,7 +44,7 @@
         1, 1, JSGetStringFromID(JSMessage::kDuplicateEventError));
   }
 
-  Optional<IJS_Runtime::JS_Error> err;
+  absl::optional<IJS_Runtime::JS_Error> err;
   if (script.GetLength() > 0)
     err = m_pRuntime->ExecuteScript(script);
 
diff --git a/fxjs/cjs_event_context.h b/fxjs/cjs_event_context.h
index b911fc2..6c07e44 100644
--- a/fxjs/cjs_event_context.h
+++ b/fxjs/cjs_event_context.h
@@ -47,7 +47,8 @@
   ~CJS_EventContext() override;
 
   // IJS_EventContext
-  Optional<IJS_Runtime::JS_Error> RunScript(const WideString& script) override;
+  absl::optional<IJS_Runtime::JS_Error> RunScript(
+      const WideString& script) override;
   void OnDoc_Open(const WideString& strTargetName) override;
   void OnDoc_WillPrint() override;
   void OnDoc_DidPrint() override;
diff --git a/fxjs/cjs_event_context_stub.cpp b/fxjs/cjs_event_context_stub.cpp
index d19c6eb..e5b6f30 100644
--- a/fxjs/cjs_event_context_stub.cpp
+++ b/fxjs/cjs_event_context_stub.cpp
@@ -10,7 +10,7 @@
 
 CJS_EventContextStub::~CJS_EventContextStub() = default;
 
-Optional<IJS_Runtime::JS_Error> CJS_EventContextStub::RunScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_EventContextStub::RunScript(
     const WideString& script) {
   return IJS_Runtime::JS_Error(1, 1, L"JavaScript support not present");
 }
diff --git a/fxjs/cjs_event_context_stub.h b/fxjs/cjs_event_context_stub.h
index 44d4a85..72d9613 100644
--- a/fxjs/cjs_event_context_stub.h
+++ b/fxjs/cjs_event_context_stub.h
@@ -15,7 +15,8 @@
   ~CJS_EventContextStub() override;
 
   // IJS_EventContext:
-  Optional<IJS_Runtime::JS_Error> RunScript(const WideString& script) override;
+  absl::optional<IJS_Runtime::JS_Error> RunScript(
+      const WideString& script) override;
 
   void OnDoc_Open(const WideString& strTargetName) override {}
   void OnDoc_WillPrint() override {}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index a2974e4..ba447b1 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -63,7 +63,7 @@
     if (IsComboBoxOrTextField(pFormField)) {
       for (auto& pObserved : widgets) {
         if (pObserved) {
-          Optional<WideString> sValue =
+          absl::optional<WideString> sValue =
               ToCPDFSDKWidget(pObserved.Get())->OnFormat();
           if (pObserved) {  // Not redundant, may be clobbered by OnFormat.
             auto* pWidget = ToCPDFSDKWidget(pObserved.Get());
@@ -121,7 +121,7 @@
       FormFieldType fieldType = pWidget->GetFieldType();
       if (fieldType == FormFieldType::kComboBox ||
           fieldType == FormFieldType::kTextField) {
-        Optional<WideString> sValue = pWidget->OnFormat();
+        absl::optional<WideString> sValue = pWidget->OnFormat();
         if (!observed_widget)
           return;
         pWidget->ResetAppearance(sValue, CPDFSDK_Widget::kValueUnchanged);
@@ -151,7 +151,7 @@
   int control_index;
 };
 
-Optional<FieldNameData> ParseFieldName(const WideString& field_name) {
+absl::optional<FieldNameData> ParseFieldName(const WideString& field_name) {
   auto reverse_it = field_name.rbegin();
   while (reverse_it != field_name.rend()) {
     if (*reverse_it == L'.')
@@ -655,7 +655,7 @@
   swFieldNameTemp.Replace(L"..", L".");
 
   if (pForm->CountFields(swFieldNameTemp) <= 0) {
-    Optional<FieldNameData> parsed_data = ParseFieldName(swFieldNameTemp);
+    absl::optional<FieldNameData> parsed_data = ParseFieldName(swFieldNameTemp);
     if (!parsed_data.has_value())
       return false;
 
@@ -1918,7 +1918,7 @@
     return CJS_Result::Failure(JSMessage::kBadObjectError);
 
   CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance();
-  Optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
+  absl::optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
       FieldAppearance.GetColorARGB();
 
   CFX_Color crRet;
@@ -1969,7 +1969,8 @@
     return CJS_Result::Failure(JSMessage::kObjectTypeError);
   }
 
-  Optional<WideString> wsFontName = pFormControl->GetDefaultControlFontName();
+  absl::optional<WideString> wsFontName =
+      pFormControl->GetDefaultControlFontName();
   if (!wsFontName.has_value())
     return CJS_Result::Failure(JSMessage::kBadObjectError);
 
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index dc481c4..beb1bde 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -209,9 +209,9 @@
   str->Replace(L",", L".");
 }
 
-Optional<double> ApplyNamedOperation(const wchar_t* sFunction,
-                                     double dValue1,
-                                     double dValue2) {
+absl::optional<double> ApplyNamedOperation(const wchar_t* sFunction,
+                                           double dValue1,
+                                           double dValue2) {
   if (FXSYS_wcsicmp(sFunction, L"AVG") == 0 ||
       FXSYS_wcsicmp(sFunction, L"SUM") == 0) {
     return dValue1 + dValue2;
@@ -840,7 +840,7 @@
   strValue.ReleaseBuffer(szNewSize);
 
   // for processing separator style
-  Optional<size_t> mark_pos = strValue.Find('.');
+  absl::optional<size_t> mark_pos = strValue.Find('.');
   if (mark_pos.has_value()) {
     char mark = DecimalMarkForStyle(iSepStyle);
     if (mark != '.')
@@ -1245,7 +1245,8 @@
   if (isnan(arg1) || isnan(arg2))
     return CJS_Result::Failure(JSMessage::kValueError);
 
-  Optional<double> result = ApplyNamedOperation(sFunction.c_str(), arg1, arg2);
+  absl::optional<double> result =
+      ApplyNamedOperation(sFunction.c_str(), arg1, arg2);
   if (!result.has_value())
     return CJS_Result::Failure(JSMessage::kValueError);
 
@@ -1344,7 +1345,7 @@
            wcscmp(sFunction.c_str(), L"MAX") == 0)) {
         dValue = dTemp;
       }
-      Optional<double> dResult =
+      absl::optional<double> dResult =
           ApplyNamedOperation(sFunction.c_str(), dValue, dTemp);
       if (!dResult.has_value())
         return CJS_Result::Failure(JSMessage::kValueError);
diff --git a/fxjs/cjs_result.h b/fxjs/cjs_result.h
index f639842..1f1a215 100644
--- a/fxjs/cjs_result.h
+++ b/fxjs/cjs_result.h
@@ -50,7 +50,7 @@
   explicit CJS_Result(const WideString&);     // Error with custom message.
   explicit CJS_Result(JSMessage id);          // Error with stock message.
 
-  Optional<WideString> error_;
+  absl::optional<WideString> error_;
   v8::Local<v8::Value> return_;
 };
 
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index d73744c..91d2499 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -166,7 +166,7 @@
   return m_pFormFillEnv.Get();
 }
 
-Optional<IJS_Runtime::JS_Error> CJS_Runtime::ExecuteScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_Runtime::ExecuteScript(
     const WideString& script) {
   return Execute(script);
 }
diff --git a/fxjs/cjs_runtime.h b/fxjs/cjs_runtime.h
index d95cb26..d36fe9f 100644
--- a/fxjs/cjs_runtime.h
+++ b/fxjs/cjs_runtime.h
@@ -34,7 +34,7 @@
   IJS_EventContext* NewEventContext() override;
   void ReleaseEventContext(IJS_EventContext* pContext) override;
   CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
-  Optional<IJS_Runtime::JS_Error> ExecuteScript(
+  absl::optional<IJS_Runtime::JS_Error> ExecuteScript(
       const WideString& script) override;
 
   CJS_EventContext* GetCurrentEventContext() const;
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp
index 39600fa..5ba2b9f 100644
--- a/fxjs/cjs_runtimestub.cpp
+++ b/fxjs/cjs_runtimestub.cpp
@@ -29,7 +29,7 @@
   return nullptr;
 }
 
-Optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
+absl::optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
     const WideString& script) {
   return absl::nullopt;
 }
diff --git a/fxjs/cjs_runtimestub.h b/fxjs/cjs_runtimestub.h
index 2b5e713..eda8a87 100644
--- a/fxjs/cjs_runtimestub.h
+++ b/fxjs/cjs_runtimestub.h
@@ -27,7 +27,7 @@
   void ReleaseEventContext(IJS_EventContext* pContext) override;
   CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
 
-  Optional<IJS_Runtime::JS_Error> ExecuteScript(
+  absl::optional<IJS_Runtime::JS_Error> ExecuteScript(
       const WideString& script) override;
 
  private:
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 8a346d1..0a27b57 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -112,7 +112,8 @@
   {
     size_t offset = 0;
     while (true) {
-      Optional<size_t> offset_end = unsafe_fmt_string.Find(L"%", offset + 1);
+      absl::optional<size_t> offset_end =
+          unsafe_fmt_string.Find(L"%", offset + 1);
       if (!offset_end.has_value()) {
         unsafe_conversion_specifiers.push_back(
             unsafe_fmt_string.Last(unsafe_fmt_string.GetLength() - offset));
diff --git a/fxjs/ijs_event_context.h b/fxjs/ijs_event_context.h
index f142ebc..7f4d7f3 100644
--- a/fxjs/ijs_event_context.h
+++ b/fxjs/ijs_event_context.h
@@ -20,7 +20,7 @@
  public:
   virtual ~IJS_EventContext() = default;
 
-  virtual Optional<IJS_Runtime::JS_Error> RunScript(
+  virtual absl::optional<IJS_Runtime::JS_Error> RunScript(
       const WideString& script) = 0;
 
   virtual void OnDoc_Open(const WideString& strTargetName) = 0;
diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h
index 4ce4acd..ed9b701 100644
--- a/fxjs/ijs_runtime.h
+++ b/fxjs/ijs_runtime.h
@@ -57,7 +57,7 @@
   virtual IJS_EventContext* NewEventContext() = 0;
   virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0;
   virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0;
-  virtual Optional<JS_Error> ExecuteScript(const WideString& script) = 0;
+  virtual absl::optional<JS_Error> ExecuteScript(const WideString& script) = 0;
 
  protected:
   IJS_Runtime() = default;
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 42c95da..82594ca 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -161,7 +161,7 @@
       m_FM2JSContext = std::make_unique<CFXJSE_FormCalcContext>(
           GetIsolate(), m_JsContext.get(), m_pDocument.Get());
     }
-    Optional<CFX_WideTextBuf> wsJavaScript =
+    absl::optional<CFX_WideTextBuf> wsJavaScript =
         CFXJSE_FormCalcContext::Translate(m_pDocument->GetHeap(), wsScript);
     if (!wsJavaScript.has_value()) {
       hRetValue->SetUndefined(GetIsolate());
@@ -189,7 +189,7 @@
   if (!refNode)
     return false;
 
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
       ResolveObjects(refNode, propname, dwFlag);
   if (!maybeResult.has_value())
     return false;
@@ -216,7 +216,7 @@
   if (!refNode)
     return false;
 
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
       ResolveObjects(refNode, propname, dwFlag);
   if (!maybeResult.has_value())
     return false;
@@ -404,7 +404,7 @@
                                          &pReturnValue)) {
     return pReturnValue;
   }
-  Optional<XFA_SCRIPTATTRIBUTEINFO> info = XFA_GetScriptAttributeByName(
+  absl::optional<XFA_SCRIPTATTRIBUTEINFO> info = XFA_GetScriptAttributeByName(
       pObject->GetElementType(), wsPropName.AsStringView());
   if (info.has_value()) {
     (*info.value().callback)(pIsolate, pObject->JSObject(), &pReturnValue,
@@ -442,7 +442,7 @@
   CXFA_Object* pObject = pScriptContext->GetVariablesThis(pOriginalObject);
   WideString wsPropName = WideString::FromUTF8(szPropName);
   WideStringView wsPropNameView = wsPropName.AsStringView();
-  Optional<XFA_SCRIPTATTRIBUTEINFO> info =
+  absl::optional<XFA_SCRIPTATTRIBUTEINFO> info =
       XFA_GetScriptAttributeByName(pObject->GetElementType(), wsPropNameView);
   if (info.has_value()) {
     CJX_Object* jsObject = pObject->JSObject();
@@ -501,7 +501,7 @@
     return FXJSE_ClassPropType::kMethod;
 
   if (bQueryIn) {
-    Optional<XFA_SCRIPTATTRIBUTEINFO> maybe_info =
+    absl::optional<XFA_SCRIPTATTRIBUTEINFO> maybe_info =
         XFA_GetScriptAttributeByName(eType, wsPropName.AsStringView());
     if (!maybe_info.has_value())
       return FXJSE_ClassPropType::kNone;
@@ -580,7 +580,7 @@
   if (!pTextNode)
     return false;
 
-  Optional<WideString> wsScript =
+  absl::optional<WideString> wsScript =
       pTextNode->JSObject()->TryCData(XFA_Attribute::Value, true);
   if (!wsScript.has_value())
     return false;
@@ -657,14 +657,14 @@
   fxv8::ReentrantDeleteObjectPropertyHelper(GetIsolate(), pObject, "Date");
 }
 
-Optional<CFXJSE_Engine::ResolveResult> CFXJSE_Engine::ResolveObjects(
+absl::optional<CFXJSE_Engine::ResolveResult> CFXJSE_Engine::ResolveObjects(
     CXFA_Object* refObject,
     WideStringView wsExpression,
     Mask<XFA_ResolveFlag> dwStyles) {
   return ResolveObjectsWithBindNode(refObject, wsExpression, dwStyles, nullptr);
 }
 
-Optional<CFXJSE_Engine::ResolveResult>
+absl::optional<CFXJSE_Engine::ResolveResult>
 CFXJSE_Engine::ResolveObjectsWithBindNode(CXFA_Object* refObject,
                                           WideStringView wsExpression,
                                           Mask<XFA_ResolveFlag> dwStyles,
diff --git a/fxjs/xfa/cfxjse_engine.h b/fxjs/xfa/cfxjse_engine.h
index d07c799..acbddf6 100644
--- a/fxjs/xfa/cfxjse_engine.h
+++ b/fxjs/xfa/cfxjse_engine.h
@@ -116,11 +116,11 @@
                  CFXJSE_Value* pRetValue,
                  CXFA_Object* pThisObject);
 
-  Optional<ResolveResult> ResolveObjects(CXFA_Object* refObject,
-                                         WideStringView wsExpression,
-                                         Mask<XFA_ResolveFlag> dwStyles);
+  absl::optional<ResolveResult> ResolveObjects(CXFA_Object* refObject,
+                                               WideStringView wsExpression,
+                                               Mask<XFA_ResolveFlag> dwStyles);
 
-  Optional<ResolveResult> ResolveObjectsWithBindNode(
+  absl::optional<ResolveResult> ResolveObjectsWithBindNode(
       CXFA_Object* refObject,
       WideStringView wsExpression,
       Mask<XFA_ResolveFlag> dwStyles,
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index e51d699..0569736 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -1447,8 +1447,8 @@
   return fxv8::ReentrantToDoubleHelper(pIsolate, extracted);
 }
 
-Optional<double> ExtractDouble(v8::Isolate* pIsolate,
-                               v8::Local<v8::Value> src) {
+absl::optional<double> ExtractDouble(v8::Isolate* pIsolate,
+                                     v8::Local<v8::Value> src) {
   if (src.IsEmpty())
     return 0.0;
 
@@ -1559,7 +1559,7 @@
     return v8::Local<v8::Value>();
 
   CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
       pScriptContext->ResolveObjects(
           pScriptContext->GetThisObject(),
           WideString::FromUTF8(bsAccessorName).AsStringView(),
@@ -1575,7 +1575,7 @@
       maybeResult.value().objects.front().Get());
 }
 
-Optional<CFXJSE_Engine::ResolveResult> ResolveObjects(
+absl::optional<CFXJSE_Engine::ResolveResult> ResolveObjects(
     CFXJSE_HostObject* pHostObject,
     v8::Local<v8::Value> pRefValue,
     ByteStringView bsSomExp,
@@ -1602,7 +1602,7 @@
       if (bHasNoResolveName) {
         WideString wsName;
         if (CXFA_Node* pXFANode = pNode->AsNode()) {
-          Optional<WideString> ret =
+          absl::optional<WideString> ret =
               pXFANode->JSObject()->TryAttribute(XFA_Attribute::Name, false);
           if (ret.has_value())
             wsName = ret.value();
@@ -1829,8 +1829,10 @@
     return;
   }
 
-  Optional<double> maybe_dividend = ExtractDouble(info.GetIsolate(), info[0]);
-  Optional<double> maybe_divisor = ExtractDouble(info.GetIsolate(), info[1]);
+  absl::optional<double> maybe_dividend =
+      ExtractDouble(info.GetIsolate(), info[0]);
+  absl::optional<double> maybe_divisor =
+      ExtractDouble(info.GetIsolate(), info[1]);
   if (!maybe_dividend.has_value() || !maybe_divisor.has_value()) {
     pContext->ThrowArgumentMismatchException();
     return;
@@ -1863,7 +1865,8 @@
     return;
   }
 
-  Optional<double> maybe_value = ExtractDouble(info.GetIsolate(), info[0]);
+  absl::optional<double> maybe_value =
+      ExtractDouble(info.GetIsolate(), info[0]);
   if (!maybe_value.has_value()) {
     pContext->ThrowArgumentMismatchException();
     return;
@@ -1876,7 +1879,7 @@
       info.GetReturnValue().SetNull();
       return;
     }
-    Optional<double> maybe_precision =
+    absl::optional<double> maybe_precision =
         ExtractDouble(info.GetIsolate(), info[1]);
     if (!maybe_precision.has_value()) {
       pContext->ThrowArgumentMismatchException();
@@ -3301,8 +3304,9 @@
   }
 
   WideString wsCalcScript = WideString::FromUTF8(bsUtf8Script.AsStringView());
-  Optional<CFX_WideTextBuf> wsJavaScriptBuf = CFXJSE_FormCalcContext::Translate(
-      pContext->GetDocument()->GetHeap(), wsCalcScript.AsStringView());
+  absl::optional<CFX_WideTextBuf> wsJavaScriptBuf =
+      CFXJSE_FormCalcContext::Translate(pContext->GetDocument()->GetHeap(),
+                                        wsCalcScript.AsStringView());
   if (!wsJavaScriptBuf.has_value()) {
     pContext->ThrowCompilerErrorException();
     return;
@@ -5110,8 +5114,9 @@
   }
 
   WideString wsCalcScript = WideString::FromUTF8(bsArg.AsStringView());
-  Optional<CFX_WideTextBuf> wsJavaScriptBuf = CFXJSE_FormCalcContext::Translate(
-      pContext->GetDocument()->GetHeap(), wsCalcScript.AsStringView());
+  absl::optional<CFX_WideTextBuf> wsJavaScriptBuf =
+      CFXJSE_FormCalcContext::Translate(pContext->GetDocument()->GetHeap(),
+                                        wsCalcScript.AsStringView());
   if (!wsJavaScriptBuf.has_value()) {
     pContext->ThrowCompilerErrorException();
     return;
@@ -5291,7 +5296,7 @@
   return bsSomExp;
 }
 
-Optional<CFX_WideTextBuf> CFXJSE_FormCalcContext::Translate(
+absl::optional<CFX_WideTextBuf> CFXJSE_FormCalcContext::Translate(
     cppgc::Heap* pHeap,
     WideStringView wsFormcalc) {
   if (wsFormcalc.IsEmpty())
@@ -5304,7 +5309,7 @@
     return absl::nullopt;
 
   CXFA_FMToJavaScriptDepth::Reset();
-  Optional<CFX_WideTextBuf> wsJavaScript = ast->ToJavaScript();
+  absl::optional<CFX_WideTextBuf> wsJavaScript = ast->ToJavaScript();
   if (!wsJavaScript.has_value())
     return absl::nullopt;
 
@@ -5379,7 +5384,7 @@
     for (uint32_t i = 2; i < iLength; i++) {
       v8::Local<v8::Value> hJSObjValue =
           fxv8::ReentrantGetArrayElementHelper(info.GetIsolate(), arr, i);
-      Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+      absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
           ResolveObjects(pThis, hJSObjValue, bsSomExp.AsStringView(),
                          bDotAccessor, bHasNoResolveName);
       if (maybeResult.has_value()) {
@@ -5409,7 +5414,7 @@
     return;
   }
 
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult;
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult;
   ByteString bsAccessorName =
       fxv8::ReentrantToByteStringHelper(info.GetIsolate(), info[1]);
   if (fxv8::IsObject(argAccessor) ||
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index ba79645..304359a 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -270,8 +270,8 @@
                                           int32_t iIndexFlags,
                                           int32_t iIndexValue,
                                           bool bIsStar);
-  static Optional<CFX_WideTextBuf> Translate(cppgc::Heap* pHeap,
-                                             WideStringView wsFormcalc);
+  static absl::optional<CFX_WideTextBuf> Translate(cppgc::Heap* pHeap,
+                                                   WideStringView wsFormcalc);
 
   v8::Local<v8::Value> GlobalPropertyGetter();
   v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); }
diff --git a/fxjs/xfa/cfxjse_mapmodule.cpp b/fxjs/xfa/cfxjse_mapmodule.cpp
index e2344082..dbd6fed 100644
--- a/fxjs/xfa/cfxjse_mapmodule.cpp
+++ b/fxjs/xfa/cfxjse_mapmodule.cpp
@@ -32,21 +32,21 @@
   m_MeasurementMap[key] = measurement;
 }
 
-Optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
+absl::optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
   auto it = m_ValueMap.find(key);
   if (it == m_ValueMap.end())
     return absl::nullopt;
   return it->second;
 }
 
-Optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
+absl::optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
   auto it = m_StringMap.find(key);
   if (it == m_StringMap.end())
     return absl::nullopt;
   return it->second;
 }
 
-Optional<CXFA_Measurement> CFXJSE_MapModule::GetMeasurement(
+absl::optional<CXFA_Measurement> CFXJSE_MapModule::GetMeasurement(
     uint32_t key) const {
   auto it = m_MeasurementMap.find(key);
   if (it == m_MeasurementMap.end())
diff --git a/fxjs/xfa/cfxjse_mapmodule.h b/fxjs/xfa/cfxjse_mapmodule.h
index ce8fa07..ff641c5 100644
--- a/fxjs/xfa/cfxjse_mapmodule.h
+++ b/fxjs/xfa/cfxjse_mapmodule.h
@@ -27,9 +27,9 @@
   void SetValue(uint32_t key, int32_t value);
   void SetString(uint32_t key, const WideString& wsString);
   void SetMeasurement(uint32_t key, const CXFA_Measurement& measurement);
-  Optional<int32_t> GetValue(uint32_t key) const;
-  Optional<WideString> GetString(uint32_t key) const;
-  Optional<CXFA_Measurement> GetMeasurement(uint32_t key) const;
+  absl::optional<int32_t> GetValue(uint32_t key) const;
+  absl::optional<WideString> GetString(uint32_t key) const;
+  absl::optional<CXFA_Measurement> GetMeasurement(uint32_t key) const;
   bool HasKey(uint32_t key) const;
   void RemoveKey(uint32_t key);
   void MergeDataFrom(const CFXJSE_MapModule* pSrc);
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index 3bcf9f3..243cb9e 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -241,7 +241,7 @@
     CXFA_Object* curNode,
     CFXJSE_Engine::ResolveResult* rnd,
     WideStringView strAttr) {
-  Optional<XFA_SCRIPTATTRIBUTEINFO> info =
+  absl::optional<XFA_SCRIPTATTRIBUTEINFO> info =
       XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr);
   if (!info.has_value())
     return false;
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index 4ebf524..20634e1 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -111,7 +111,7 @@
   if (!node->IsWidgetReady())
     return CJS_Result::Success(runtime->NewNull());
 
-  Optional<WideString> value = node->GetChoiceListItem(iIndex, true);
+  absl::optional<WideString> value = node->GetChoiceListItem(iIndex, true);
   if (!value.has_value())
     return CJS_Result::Success(runtime->NewNull());
 
@@ -177,7 +177,7 @@
   if (!node->IsWidgetReady())
     return CJS_Result::Success(runtime->NewNull());
 
-  Optional<WideString> value = node->GetChoiceListItem(iIndex, false);
+  absl::optional<WideString> value = node->GetChoiceListItem(iIndex, false);
   if (!value.has_value())
     return CJS_Result::Success(runtime->NewNull());
 
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index ace4931..972b6dc 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -142,7 +142,8 @@
     return;
   }
 
-  Optional<WideString> checksum = TryAttribute(XFA_Attribute::Checksum, false);
+  absl::optional<WideString> checksum =
+      TryAttribute(XFA_Attribute::Checksum, false);
   *pValue = fxv8::NewStringHelper(
       pIsolate,
       checksum.has_value() ? checksum.value().ToUTF8().AsStringView() : "");
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 8fec287..3a24157 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -295,7 +295,7 @@
     constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
                                               XFA_ResolveFlag::kParent,
                                               XFA_ResolveFlag::kSiblings};
-    Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+    absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
         pScriptContext->ResolveObjects(
             pObject, runtime->ToWideString(params[0]).AsStringView(), kFlags);
     if (!maybeResult.has_value() ||
@@ -381,7 +381,7 @@
     constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
                                               XFA_ResolveFlag::kParent,
                                               XFA_ResolveFlag::kSiblings};
-    Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+    absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
         pScriptContext->ResolveObjects(pObject, wsName.AsStringView(), kFlags);
     if (!maybeResult.has_value() ||
         !maybeResult.value().objects.front()->IsNode())
@@ -444,7 +444,7 @@
       constexpr Mask<XFA_ResolveFlag> kFlags = {XFA_ResolveFlag::kChildren,
                                                 XFA_ResolveFlag::kParent,
                                                 XFA_ResolveFlag::kSiblings};
-      Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+      absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
           pScriptContext->ResolveObjects(
               pObject, runtime->ToWideString(params[0]).AsStringView(), kFlags);
       if (!maybeResult.has_value() ||
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index f6ac5e7..e7a263d 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -181,7 +181,7 @@
     return CJS_Result::Failure(JSMessage::kParamError);
 
   WideString expression = runtime->ToWideString(params[0]);
-  Optional<XFA_ATTRIBUTEINFO> attr =
+  absl::optional<XFA_ATTRIBUTEINFO> attr =
       XFA_GetAttributeByName(expression.AsStringView());
   if (attr.has_value() && HasAttribute(attr.value().attribute))
     return CJS_Result::Success(runtime->NewBoolean(true));
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 0c8e5fe..ef3051f 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -209,7 +209,7 @@
                                     bool bNotify) {
   switch (GetXFANode()->GetAttributeType(eAttr)) {
     case XFA_AttributeType::Enum: {
-      Optional<XFA_AttributeValue> item =
+      absl::optional<XFA_AttributeValue> item =
           XFA_GetAttributeValueByName(wsValue.AsStringView());
       SetEnum(eAttr,
               item.has_value() ? item.value()
@@ -239,7 +239,7 @@
 
 void CJX_Object::SetAttributeByString(WideStringView wsAttr,
                                       const WideString& wsValue) {
-  Optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(wsAttr);
+  absl::optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(wsAttr);
   if (attr.has_value()) {
     SetAttributeByEnum(attr.value().attribute, wsValue, true);
     return;
@@ -249,8 +249,8 @@
 }
 
 WideString CJX_Object::GetAttributeByString(WideStringView attr) const {
-  Optional<WideString> result;
-  Optional<XFA_ATTRIBUTEINFO> enum_attr = XFA_GetAttributeByName(attr);
+  absl::optional<WideString> result;
+  absl::optional<XFA_ATTRIBUTEINFO> enum_attr = XFA_GetAttributeByName(attr);
   if (enum_attr.has_value())
     result = TryAttribute(enum_attr.value().attribute, true);
   else
@@ -262,11 +262,11 @@
   return TryAttribute(attr, true).value_or(WideString());
 }
 
-Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
-                                              bool bUseDefault) const {
+absl::optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
+                                                    bool bUseDefault) const {
   switch (GetXFANode()->GetAttributeType(eAttr)) {
     case XFA_AttributeType::Enum: {
-      Optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
+      absl::optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
       if (!value.has_value())
         return absl::nullopt;
       return WideString::FromASCII(XFA_AttributeValueToName(value.value()));
@@ -275,19 +275,19 @@
       return TryCData(eAttr, bUseDefault);
 
     case XFA_AttributeType::Boolean: {
-      Optional<bool> value = TryBoolean(eAttr, bUseDefault);
+      absl::optional<bool> value = TryBoolean(eAttr, bUseDefault);
       if (!value.has_value())
         return absl::nullopt;
       return WideString(value.value() ? L"1" : L"0");
     }
     case XFA_AttributeType::Integer: {
-      Optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
+      absl::optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
       if (!iValue.has_value())
         return absl::nullopt;
       return WideString::Format(L"%d", iValue.value());
     }
     case XFA_AttributeType::Measure: {
-      Optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
+      absl::optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
       if (!value.has_value())
         return absl::nullopt;
       return value->ToString();
@@ -302,10 +302,10 @@
   RemoveMapModuleKey(GetMapKey_Custom(wsAttr));
 }
 
-Optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr,
-                                      bool bUseDefault) const {
+absl::optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr,
+                                            bool bUseDefault) const {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+  absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
   if (value.has_value())
     return !!value.value();
   if (!bUseDefault)
@@ -337,10 +337,10 @@
   return TryInteger(eAttr, true).value_or(0);
 }
 
-Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
-                                         bool bUseDefault) const {
+absl::optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
+                                               bool bUseDefault) const {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+  absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
   if (value.has_value())
     return value.value();
   if (!bUseDefault)
@@ -348,10 +348,10 @@
   return GetXFANode()->GetDefaultInteger(eAttr);
 }
 
-Optional<XFA_AttributeValue> CJX_Object::TryEnum(XFA_Attribute eAttr,
-                                                 bool bUseDefault) const {
+absl::optional<XFA_AttributeValue> CJX_Object::TryEnum(XFA_Attribute eAttr,
+                                                       bool bUseDefault) const {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<int32_t> value = GetMapModuleValueFollowingChain(key);
+  absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
   if (value.has_value())
     return static_cast<XFA_AttributeValue>(value.value());
   if (!bUseDefault)
@@ -386,10 +386,11 @@
     OnChanged(eAttr, false);
 }
 
-Optional<CXFA_Measurement> CJX_Object::TryMeasure(XFA_Attribute eAttr,
-                                                  bool bUseDefault) const {
+absl::optional<CXFA_Measurement> CJX_Object::TryMeasure(
+    XFA_Attribute eAttr,
+    bool bUseDefault) const {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<CXFA_Measurement> result =
+  absl::optional<CXFA_Measurement> result =
       GetMapModuleMeasurementFollowingChain(key);
   if (result.has_value())
     return result.value();
@@ -398,8 +399,8 @@
   return GetXFANode()->GetDefaultMeasurement(eAttr);
 }
 
-Optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
-  Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
+absl::optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
+  absl::optional<CXFA_Measurement> measure = TryMeasure(attr, false);
   if (!measure.has_value())
     return absl::nullopt;
   return measure->ToUnit(XFA_Unit::Pt);
@@ -427,7 +428,7 @@
                               bool bScriptModify) {
   CXFA_Node* xfaObj = GetXFANode();
   uint32_t key = GetMapKey_Element(xfaObj->GetElementType(), eAttr);
-  Optional<WideString> old_value = GetMapModuleString(key);
+  absl::optional<WideString> old_value = GetMapModuleString(key);
   if (!old_value.has_value() || old_value.value() != wsValue) {
     if (bNotify)
       OnChanging(eAttr);
@@ -475,7 +476,7 @@
   auto* xfaObj = GetXFANode();
   uint32_t key =
       GetMapKey_Element(xfaObj->GetElementType(), XFA_Attribute::Value);
-  Optional<WideString> old_value = GetMapModuleString(key);
+  absl::optional<WideString> old_value = GetMapModuleString(key);
   if (!old_value.has_value() || old_value.value() != wsValue) {
     if (bNotify)
       OnChanging(XFA_Attribute::Value);
@@ -487,10 +488,10 @@
   }
 }
 
-Optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
-                                          bool bUseDefault) const {
+absl::optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
+                                                bool bUseDefault) const {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<WideString> value = GetMapModuleStringFollowingChain(key);
+  absl::optional<WideString> value = GetMapModuleStringFollowingChain(key);
   if (value.has_value())
     return value;
 
@@ -504,7 +505,7 @@
                                      int32_t value,
                                      bool bNotify) {
   uint32_t key = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
-  Optional<int32_t> old_value = GetMapModuleValue(key);
+  absl::optional<int32_t> old_value = GetMapModuleValue(key);
   if (!old_value.has_value() || old_value.value() != value) {
     if (bNotify)
       OnChanging(eAttr);
@@ -614,7 +615,7 @@
     case XFA_ObjectType::ContentNode: {
       WideString wsContentType;
       if (GetXFANode()->GetElementType() == XFA_Element::ExData) {
-        Optional<WideString> ret =
+        absl::optional<WideString> ret =
             TryAttribute(XFA_Attribute::ContentType, false);
         if (ret.has_value())
           wsContentType = ret.value();
@@ -681,8 +682,8 @@
   return TryContent(bScriptModify, true).value_or(WideString());
 }
 
-Optional<WideString> CJX_Object::TryContent(bool bScriptModify,
-                                            bool bProto) const {
+absl::optional<WideString> CJX_Object::TryContent(bool bScriptModify,
+                                                  bool bProto) const {
   CXFA_Node* pNode = nullptr;
   switch (GetXFANode()->GetObjectType()) {
     case XFA_ObjectType::ContainerNode:
@@ -709,7 +710,7 @@
       if (!pContentRawDataNode) {
         XFA_Element element = XFA_Element::Sharptext;
         if (GetXFANode()->GetElementType() == XFA_Element::ExData) {
-          Optional<WideString> contentType =
+          absl::optional<WideString> contentType =
               TryAttribute(XFA_Attribute::ContentType, false);
           if (contentType.has_value()) {
             if (contentType.value().EqualsASCII("text/html"))
@@ -743,7 +744,7 @@
   return absl::nullopt;
 }
 
-Optional<WideString> CJX_Object::TryNamespace() const {
+absl::optional<WideString> CJX_Object::TryNamespace() const {
   if (GetXFANode()->IsModelNode() ||
       GetXFANode()->GetElementType() == XFA_Element::Packet) {
     CFX_XMLNode* pXMLNode = GetXFANode()->GetXMLMappingNode();
@@ -808,21 +809,21 @@
   CreateMapModule()->SetMeasurement(key, value);
 }
 
-Optional<int32_t> CJX_Object::GetMapModuleValue(uint32_t key) const {
+absl::optional<int32_t> CJX_Object::GetMapModuleValue(uint32_t key) const {
   CFXJSE_MapModule* pModule = GetMapModule();
   if (!pModule)
     return absl::nullopt;
   return pModule->GetValue(key);
 }
 
-Optional<WideString> CJX_Object::GetMapModuleString(uint32_t key) const {
+absl::optional<WideString> CJX_Object::GetMapModuleString(uint32_t key) const {
   CFXJSE_MapModule* pModule = GetMapModule();
   if (!pModule)
     return absl::nullopt;
   return pModule->GetString(key);
 }
 
-Optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurement(
+absl::optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurement(
     uint32_t key) const {
   CFXJSE_MapModule* pModule = GetMapModule();
   if (!pModule)
@@ -830,7 +831,7 @@
   return pModule->GetMeasurement(key);
 }
 
-Optional<int32_t> CJX_Object::GetMapModuleValueFollowingChain(
+absl::optional<int32_t> CJX_Object::GetMapModuleValueFollowingChain(
     uint32_t key) const {
   std::set<const CXFA_Node*> visited;
   for (const CXFA_Node* pNode = GetXFANode(); pNode;
@@ -838,7 +839,7 @@
     if (!visited.insert(pNode).second)
       break;
 
-    Optional<int32_t> result = pNode->JSObject()->GetMapModuleValue(key);
+    absl::optional<int32_t> result = pNode->JSObject()->GetMapModuleValue(key);
     if (result.has_value())
       return result;
 
@@ -848,7 +849,7 @@
   return absl::nullopt;
 }
 
-Optional<WideString> CJX_Object::GetMapModuleStringFollowingChain(
+absl::optional<WideString> CJX_Object::GetMapModuleStringFollowingChain(
     uint32_t key) const {
   std::set<const CXFA_Node*> visited;
   for (const CXFA_Node* pNode = GetXFANode(); pNode;
@@ -856,7 +857,8 @@
     if (!visited.insert(pNode).second)
       break;
 
-    Optional<WideString> result = pNode->JSObject()->GetMapModuleString(key);
+    absl::optional<WideString> result =
+        pNode->JSObject()->GetMapModuleString(key);
     if (result.has_value())
       return result;
 
@@ -866,15 +868,15 @@
   return absl::nullopt;
 }
 
-Optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurementFollowingChain(
-    uint32_t key) const {
+absl::optional<CXFA_Measurement>
+CJX_Object::GetMapModuleMeasurementFollowingChain(uint32_t key) const {
   std::set<const CXFA_Node*> visited;
   for (const CXFA_Node* pNode = GetXFANode(); pNode;
        pNode = pNode->GetTemplateNodeIfExists()) {
     if (!visited.insert(pNode).second)
       break;
 
-    Optional<CXFA_Measurement> result =
+    absl::optional<CXFA_Measurement> result =
         pNode->JSObject()->GetMapModuleMeasurement(key);
     if (result.has_value())
       return result;
@@ -1006,7 +1008,7 @@
 
   CXFA_Node* pProtoNode = nullptr;
   if (!wsSOM.IsEmpty()) {
-    Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+    absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
         GetDocument()->GetScriptContext()->ResolveObjects(
             pProtoRoot, wsSOM.AsStringView(),
             Mask<XFA_ResolveFlag>{
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index 4034f1d..a68ed0e 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -125,8 +125,8 @@
   bool HasAttribute(XFA_Attribute eAttr) const;
   WideString GetAttributeByString(WideStringView attr) const;
   WideString GetAttributeByEnum(XFA_Attribute attr) const;
-  Optional<WideString> TryAttribute(XFA_Attribute eAttr,
-                                    bool bUseDefault) const;
+  absl::optional<WideString> TryAttribute(XFA_Attribute eAttr,
+                                          bool bUseDefault) const;
   void SetAttributeByEnum(XFA_Attribute eAttr,
                           const WideString& wsValue,
                           bool bNotify);
@@ -134,7 +134,7 @@
   void RemoveAttribute(WideStringView wsAttr);
 
   WideString GetContent(bool bScriptModify) const;
-  Optional<WideString> TryContent(bool bScriptModify, bool bProto) const;
+  absl::optional<WideString> TryContent(bool bScriptModify, bool bProto) const;
   void SetContent(const WideString& wsContent,
                   const WideString& wsXMLValue,
                   bool bNotify,
@@ -174,30 +174,32 @@
   JSE_PROP(ScriptSomInstanceIndex);
   JSE_PROP(ScriptSubmitFormatMode);
 
-  Optional<WideString> TryNamespace() const;
+  absl::optional<WideString> TryNamespace() const;
 
   int32_t GetInteger(XFA_Attribute eAttr) const;
-  Optional<int32_t> TryInteger(XFA_Attribute eAttr, bool bUseDefault) const;
+  absl::optional<int32_t> TryInteger(XFA_Attribute eAttr,
+                                     bool bUseDefault) const;
   void SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify);
 
   WideString GetCData(XFA_Attribute eAttr) const;
-  Optional<WideString> TryCData(XFA_Attribute eAttr, bool bUseDefault) const;
+  absl::optional<WideString> TryCData(XFA_Attribute eAttr,
+                                      bool bUseDefault) const;
   void SetCData(XFA_Attribute eAttr, const WideString& wsValue);
 
   XFA_AttributeValue GetEnum(XFA_Attribute eAttr) const;
-  Optional<XFA_AttributeValue> TryEnum(XFA_Attribute eAttr,
-                                       bool bUseDefault) const;
+  absl::optional<XFA_AttributeValue> TryEnum(XFA_Attribute eAttr,
+                                             bool bUseDefault) const;
   void SetEnum(XFA_Attribute eAttr, XFA_AttributeValue eValue, bool bNotify);
 
   bool GetBoolean(XFA_Attribute eAttr) const;
-  Optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const;
+  absl::optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const;
   void SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify);
 
   CXFA_Measurement GetMeasure(XFA_Attribute eAttr) const;
   float GetMeasureInUnit(XFA_Attribute eAttr, XFA_Unit unit) const;
-  Optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
-                                        bool bUseDefault) const;
-  Optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
+  absl::optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
+                                              bool bUseDefault) const;
+  absl::optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
   void SetMeasure(XFA_Attribute eAttr,
                   const CXFA_Measurement& mValue,
                   bool bNotify);
@@ -260,12 +262,13 @@
   void SetMapModuleValue(uint32_t key, int32_t value);
   void SetMapModuleString(uint32_t key, const WideString& wsValue);
   void SetMapModuleMeasurement(uint32_t key, const CXFA_Measurement& value);
-  Optional<int32_t> GetMapModuleValue(uint32_t key) const;
-  Optional<WideString> GetMapModuleString(uint32_t key) const;
-  Optional<CXFA_Measurement> GetMapModuleMeasurement(uint32_t key) const;
-  Optional<int32_t> GetMapModuleValueFollowingChain(uint32_t key) const;
-  Optional<WideString> GetMapModuleStringFollowingChain(uint32_t key) const;
-  Optional<CXFA_Measurement> GetMapModuleMeasurementFollowingChain(
+  absl::optional<int32_t> GetMapModuleValue(uint32_t key) const;
+  absl::optional<WideString> GetMapModuleString(uint32_t key) const;
+  absl::optional<CXFA_Measurement> GetMapModuleMeasurement(uint32_t key) const;
+  absl::optional<int32_t> GetMapModuleValueFollowingChain(uint32_t key) const;
+  absl::optional<WideString> GetMapModuleStringFollowingChain(
+      uint32_t key) const;
+  absl::optional<CXFA_Measurement> GetMapModuleMeasurementFollowingChain(
       uint32_t key) const;
   bool HasMapModuleKey(uint32_t key) const;
   void RemoveMapModuleKey(uint32_t key);
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 006a096..8e402b2 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -48,7 +48,7 @@
   if (pRefNode->GetElementType() == XFA_Element::Xfa)
     pRefNode = pScriptContext->GetThisObject();
 
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
       pScriptContext->ResolveObjects(
           ToNode(pRefNode), wsExpression.AsStringView(),
           Mask<XFA_ResolveFlag>{
@@ -220,7 +220,7 @@
   pDoc->GetNodeOwner()->PersistList(pNodeList);
 
   CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
-  Optional<CFXJSE_Engine::ResolveResult> maybeResult =
+  absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
       pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
                                      dwFlag);