Replace FX_ArraySize() with pdfium::size() outside of core/.

Similar to how Chromium replaced arraysize() with base::size() in
https://crrev.com/621760.

Change-Id: I5181f9f2bb300b4f3b91495649861a87375b355b
Bug: 1435
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69811
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
index 68e3e8f..ad445f2 100644
--- a/fpdfsdk/cpdfsdk_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -31,6 +31,7 @@
 #include "fpdfsdk/pwl/cpwl_edit_impl.h"
 #include "fpdfsdk/pwl/cpwl_icon.h"
 #include "fpdfsdk/pwl/cpwl_wnd.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -153,8 +154,8 @@
                           {CFX_PointF(0.40f, 0.60f), CFX_PointF(0.28f, 0.66f),
                            CFX_PointF(0.30f, 0.56f)}};
 
-  for (size_t i = 0; i < FX_ArraySize(pts); ++i) {
-    for (size_t j = 0; j < FX_ArraySize(pts[0]); ++j) {
+  for (size_t i = 0; i < pdfium::size(pts); ++i) {
+    for (size_t j = 0; j < pdfium::size(pts[0]); ++j) {
       pts[i][j].x = pts[i][j].x * fWidth + crBBox.left;
       pts[i][j].y *= pts[i][j].y * fHeight + crBBox.bottom;
     }
@@ -163,8 +164,8 @@
   std::ostringstream csAP;
   csAP << pts[0][0].x << " " << pts[0][0].y << " " << kMoveToOperator << "\n";
 
-  for (size_t i = 0; i < FX_ArraySize(pts); ++i) {
-    size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0;
+  for (size_t i = 0; i < pdfium::size(pts); ++i) {
+    size_t nNext = i < pdfium::size(pts) - 1 ? i + 1 : 0;
 
     float px1 = pts[i][1].x - pts[i][0].x;
     float py1 = pts[i][1].y - pts[i][0].y;
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index c83673b..6ac93cb 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -879,7 +879,7 @@
 
   static constexpr const char* kModeKeyForMode[] = {"N", "R", "D"};
   static_assert(
-      FX_ArraySize(kModeKeyForMode) == FPDF_ANNOT_APPEARANCEMODE_COUNT,
+      pdfium::size(kModeKeyForMode) == FPDF_ANNOT_APPEARANCEMODE_COUNT,
       "length of kModeKeyForMode should be equal to "
       "FPDF_ANNOT_APPEARANCEMODE_COUNT");
   const char* modeKey = kModeKeyForMode[appearanceMode];
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index 55d7a74..52d130d 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -10,7 +10,6 @@
 
 #include "build/build_config.h"
 #include "constants/annotation_common.h"
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_system.h"
 #include "public/cpp/fpdf_scopers.h"
 #include "public/fpdf_annot.h"
@@ -2473,7 +2472,7 @@
                                          FPDF_FORMFIELD_CHECKBOX,
                                          FPDF_FORMFIELD_RADIOBUTTON};
 
-  for (size_t i = 0; i < FX_ArraySize(kExpectedAnnotTypes); ++i) {
+  for (size_t i = 0; i < pdfium::size(kExpectedAnnotTypes); ++i) {
     ScopedFPDFAnnotation annot(FPDFPage_GetAnnot(page, i));
     ASSERT_TRUE(annot);
     EXPECT_EQ(kExpectedAnnotTypes[i],
@@ -2645,9 +2644,9 @@
 
   // Test invalid parameters.
   EXPECT_FALSE(FPDFAnnot_SetFocusableSubtypes(nullptr, kDefaultSubtypes,
-                                              FX_ArraySize(kDefaultSubtypes)));
+                                              pdfium::size(kDefaultSubtypes)));
   EXPECT_FALSE(FPDFAnnot_SetFocusableSubtypes(form_handle(), nullptr,
-                                              FX_ArraySize(kDefaultSubtypes)));
+                                              pdfium::size(kDefaultSubtypes)));
   EXPECT_EQ(-1, FPDFAnnot_GetFocusableSubtypesCount(nullptr));
 
   std::vector<FPDF_ANNOTATION_SUBTYPE> subtypes(1);
@@ -2688,7 +2687,7 @@
   // Make links and highlights focusable.
   static constexpr FPDF_ANNOTATION_SUBTYPE kSubTypes[] = {FPDF_ANNOT_LINK,
                                                           FPDF_ANNOT_HIGHLIGHT};
-  constexpr int kSubTypesCount = FX_ArraySize(kSubTypes);
+  constexpr int kSubTypesCount = pdfium::size(kSubTypes);
   ASSERT_TRUE(
       FPDFAnnot_SetFocusableSubtypes(form_handle(), kSubTypes, kSubTypesCount));
   ASSERT_EQ(kSubTypesCount, FPDFAnnot_GetFocusableSubtypesCount(form_handle()));
@@ -2754,7 +2753,7 @@
     constexpr char kExpectedResult[] =
         "https://cs.chromium.org/chromium/src/third_party/pdfium/public/"
         "fpdf_text.h";
-    constexpr unsigned long kExpectedLength = FX_ArraySize(kExpectedResult);
+    constexpr unsigned long kExpectedLength = pdfium::size(kExpectedResult);
     unsigned long bufsize =
         FPDFAction_GetURIPath(document(), action, nullptr, 0);
     ASSERT_EQ(kExpectedLength, bufsize);
diff --git a/fpdfsdk/fpdf_annot_unittest.cpp b/fpdfsdk/fpdf_annot_unittest.cpp
index 7ddd579..b9044fa 100644
--- a/fpdfsdk/fpdf_annot_unittest.cpp
+++ b/fpdfsdk/fpdf_annot_unittest.cpp
@@ -18,6 +18,7 @@
 #include "public/fpdf_edit.h"
 #include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -83,7 +84,7 @@
 
   // Check that the appearance stream is same as we just set.
   const uint32_t kStreamDataSize =
-      FX_ArraySize(kStreamData) * sizeof(FPDF_WCHAR);
+      pdfium::size(kStreamData) * sizeof(FPDF_WCHAR);
   unsigned long normal_length_bytes = FPDFAnnot_GetAP(
       annot.get(), FPDF_ANNOT_APPEARANCEMODE_NORMAL, nullptr, 0);
   ASSERT_EQ(kStreamDataSize, normal_length_bytes);
@@ -159,12 +160,12 @@
       {80.0f, 90.0f}, {81.0f, 91.0f}, {82.0f, 92.0f},
       {83.0f, 93.0f}, {84.0f, 94.0f}, {85.0f, 95.0f}};
   static constexpr size_t kFirstStrokePointCount =
-      FX_ArraySize(kFirstInkStroke);
+      pdfium::size(kFirstInkStroke);
 
   static constexpr FS_POINTF kSecondInkStroke[] = {
       {70.0f, 90.0f}, {71.0f, 91.0f}, {72.0f, 92.0f}};
   static constexpr size_t kSecondStrokePointCount =
-      FX_ArraySize(kSecondInkStroke);
+      pdfium::size(kSecondInkStroke);
 
   static constexpr FS_POINTF kThirdInkStroke[] = {{60.0f, 90.0f},
                                                   {61.0f, 91.0f},
@@ -172,7 +173,7 @@
                                                   {63.0f, 93.0f},
                                                   {64.0f, 94.0f}};
   static constexpr size_t kThirdStrokePointCount =
-      FX_ArraySize(kThirdInkStroke);
+      pdfium::size(kThirdInkStroke);
 
   // Negative test: |annot| is passed as nullptr.
   EXPECT_EQ(-1, FPDFAnnot_AddInkStroke(nullptr, kFirstInkStroke,
@@ -251,7 +252,7 @@
   static constexpr FS_POINTF kInkStroke[] = {{80.0f, 90.0f}, {81.0f, 91.0f},
                                              {82.0f, 92.0f}, {83.0f, 93.0f},
                                              {84.0f, 94.0f}, {85.0f, 95.0f}};
-  static constexpr size_t kPointCount = FX_ArraySize(kInkStroke);
+  static constexpr size_t kPointCount = pdfium::size(kInkStroke);
 
   // InkStroke should get added to ink annotation. Also inklist should get
   // created.
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 174e9c1..eee623b 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -8,7 +8,6 @@
 
 #include "build/build_config.h"
 #include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
 #include "public/cpp/fpdf_scopers.h"
@@ -21,6 +20,7 @@
 #include "testing/embedder_test_timer_handling_delegate.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 using testing::_;
 using testing::InSequence;
@@ -841,7 +841,7 @@
 
   static constexpr int kExpectedAnnotIndex[] = {1, 2, 3, 0};
   // Tabs should iterate focus over annotations.
-  for (size_t i = 0; i < FX_ArraySize(kExpectedAnnotIndex); ++i) {
+  for (size_t i = 0; i < pdfium::size(kExpectedAnnotIndex); ++i) {
     ASSERT_TRUE(FORM_OnKeyDown(form_handle(), page, FWL_VKEY_Tab, 0));
     int page_index = -2;
     FPDF_ANNOTATION annot = nullptr;
@@ -865,7 +865,7 @@
 
   static constexpr int kExpectedAnnotIndex[] = {0, 3, 2, 1};
   // Shift-tabs should iterate focus over annotations.
-  for (size_t i = 0; i < FX_ArraySize(kExpectedAnnotIndex); ++i) {
+  for (size_t i = 0; i < pdfium::size(kExpectedAnnotIndex); ++i) {
     ASSERT_TRUE(FORM_OnKeyDown(form_handle(), page, FWL_VKEY_Tab,
                                FWL_EVENTFLAG_ShiftKey));
     int page_index = -2;
@@ -2998,7 +2998,7 @@
     // Set Widget and Link as supported tabbable annots.
     constexpr FPDF_ANNOTATION_SUBTYPE kFocusableSubtypes[] = {FPDF_ANNOT_WIDGET,
                                                               FPDF_ANNOT_LINK};
-    constexpr size_t kSubtypeCount = FX_ArraySize(kFocusableSubtypes);
+    constexpr size_t kSubtypeCount = pdfium::size(kFocusableSubtypes);
     ASSERT_TRUE(FPDFAnnot_SetFocusableSubtypes(
         form_handle(), kFocusableSubtypes, kSubtypeCount));
   }
diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp
index f44fdd1..8a8c65f 100644
--- a/fpdfsdk/fpdf_structtree_embeddertest.cpp
+++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_string.h"
 #include "public/fpdf_structtree.h"
 #include "testing/embedder_test.h"
 #include "third_party/base/optional.h"
+#include "third_party/base/stl_util.h"
 
 class FPDFStructTreeEmbedderTest : public EmbedderTest {};
 
@@ -57,7 +57,7 @@
     // Deliberately pass in a small buffer size to make sure |buffer| remains
     // untouched.
     ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer, 1));
-    for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
+    for (size_t i = 0; i < pdfium::size(buffer); ++i)
       EXPECT_EQ(0U, buffer[i]);
 
     EXPECT_EQ(-1, FPDF_StructElement_GetMarkedContentID(gchild_element));
@@ -118,7 +118,7 @@
     // Deliberately pass in a small buffer size to make sure |buffer| remains
     // untouched.
     ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, 1));
-    for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
+    for (size_t i = 0; i < pdfium::size(buffer); ++i)
       EXPECT_EQ(0U, buffer[i]);
 
     ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer)));
@@ -154,7 +154,7 @@
     // Deliberately pass in a small buffer size to make sure |buffer| remains
     // untouched.
     ASSERT_EQ(20U, FPDF_StructElement_GetTitle(element, buffer, 1));
-    for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
+    for (size_t i = 0; i < pdfium::size(buffer); ++i)
       EXPECT_EQ(0U, buffer[i]);
 
     ASSERT_EQ(20U,
diff --git a/fpdfsdk/fpdf_text_embeddertest.cpp b/fpdfsdk/fpdf_text_embeddertest.cpp
index 77f015a..ce9c622 100644
--- a/fpdfsdk/fpdf_text_embeddertest.cpp
+++ b/fpdfsdk/fpdf_text_embeddertest.cpp
@@ -8,7 +8,6 @@
 #include <vector>
 
 #include "build/build_config.h"
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxge/fx_font.h"
 #include "public/cpp/fpdf_scopers.h"
 #include "public/fpdf_text.h"
@@ -17,11 +16,12 @@
 #include "testing/embedder_test.h"
 #include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
 constexpr char kHelloGoodbyeText[] = "Hello, world!\r\nGoodbye, world!";
-constexpr int kHelloGoodbyeTextSize = FX_ArraySize(kHelloGoodbyeText);
+constexpr int kHelloGoodbyeTextSize = pdfium::size(kHelloGoodbyeText);
 
 bool check_unsigned_shorts(const char* expected,
                            const unsigned short* actual,
@@ -676,7 +676,7 @@
       "http://example.com/",
       "http://www.abc.com",
   };
-  static const int kNumLinks = static_cast<int>(FX_ArraySize(kExpectedUrls));
+  static const int kNumLinks = static_cast<int>(pdfium::size(kExpectedUrls));
 
   EXPECT_EQ(kNumLinks, FPDFLink_CountWebLinks(pagelink));
 
@@ -687,7 +687,7 @@
     EXPECT_EQ(static_cast<int>(expected_len),
               FPDFLink_GetURL(pagelink, i, nullptr, 0));
     EXPECT_EQ(static_cast<int>(expected_len),
-              FPDFLink_GetURL(pagelink, i, buffer, FX_ArraySize(buffer)));
+              FPDFLink_GetURL(pagelink, i, buffer, pdfium::size(buffer)));
     EXPECT_TRUE(check_unsigned_shorts(kExpectedUrls[i], buffer, expected_len));
   }
 
@@ -715,7 +715,7 @@
 
   EXPECT_EQ(kUrlSize, FPDFLink_GetURL(pagelink, 1, nullptr, 0));
   EXPECT_EQ(kUrlSize,
-            FPDFLink_GetURL(pagelink, 1, buffer, FX_ArraySize(buffer)));
+            FPDFLink_GetURL(pagelink, 1, buffer, pdfium::size(buffer)));
   EXPECT_TRUE(check_unsigned_shorts(kExpectedUrl, buffer, kUrlSize));
 
   FPDFLink_CloseWebLinks(pagelink);
@@ -849,7 +849,7 @@
                                         16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
 
   int count = FPDFText_CountChars(textpage);
-  ASSERT_EQ(FX_ArraySize(kExpectedFontsSizes), static_cast<size_t>(count));
+  ASSERT_EQ(pdfium::size(kExpectedFontsSizes), static_cast<size_t>(count));
   for (int i = 0; i < count; ++i)
     EXPECT_EQ(kExpectedFontsSizes[i], FPDFText_GetFontSize(textpage, i)) << i;
 
@@ -968,18 +968,18 @@
   static constexpr int kStartIndex = 238;
 
   ASSERT_EQ(268, FPDFText_CountChars(textpage));
-  for (size_t i = 0; i < FX_ArraySize(kData); ++i)
+  for (size_t i = 0; i < pdfium::size(kData); ++i)
     EXPECT_EQ(kData[i], FPDFText_GetUnicode(textpage, kStartIndex + i));
 
-  unsigned short buffer[FX_ArraySize(kData) + 1];
+  unsigned short buffer[pdfium::size(kData) + 1];
   memset(buffer, 0xbd, sizeof(buffer));
   int count =
-      FPDFText_GetText(textpage, kStartIndex, FX_ArraySize(kData), buffer);
+      FPDFText_GetText(textpage, kStartIndex, pdfium::size(kData), buffer);
   ASSERT_GT(count, 0);
-  ASSERT_EQ(FX_ArraySize(kData) + 1, static_cast<size_t>(count));
-  for (size_t i = 0; i < FX_ArraySize(kData); ++i)
+  ASSERT_EQ(pdfium::size(kData) + 1, static_cast<size_t>(count));
+  for (size_t i = 0; i < pdfium::size(kData); ++i)
     EXPECT_EQ(kData[i], buffer[i]);
-  EXPECT_EQ(0, buffer[FX_ArraySize(kData)]);
+  EXPECT_EQ(0, buffer[pdfium::size(kData)]);
 
   FPDFText_ClosePage(textpage);
   UnloadPage(page);
@@ -1001,8 +1001,8 @@
       0x0056, 0x0065, 0x0072, 0x0069, 0x0074, 0x0061, 0xfffe,
       0x0073, 0x0065, 0x0072, 0x0075, 0x006D, 0x0000};
   {
-    constexpr int count = FX_ArraySize(soft_expected) - 1;
-    unsigned short buffer[FX_ArraySize(soft_expected)];
+    constexpr int count = pdfium::size(soft_expected) - 1;
+    unsigned short buffer[pdfium::size(soft_expected)];
     memset(buffer, 0, sizeof(buffer));
 
     EXPECT_EQ(count + 1, FPDFText_GetText(textpage, 0, count, buffer));
@@ -1014,14 +1014,14 @@
   {
     // There isn't the \0 in the actual doc, but there is a \r\n, so need to
     // add 1 to get aligned.
-    constexpr size_t offset = FX_ArraySize(soft_expected) + 1;
+    constexpr size_t offset = pdfium::size(soft_expected) + 1;
     // Expecting 'User-\r\ngenerated', the - is a unicode character, so cannnot
     // store in a char[].
     constexpr unsigned short hard_expected[] = {
         0x0055, 0x0073, 0x0065, 0x0072, 0x2010, 0x000d, 0x000a, 0x0067, 0x0065,
         0x006e, 0x0065, 0x0072, 0x0061, 0x0074, 0x0065, 0x0064, 0x0000};
-    constexpr int count = FX_ArraySize(hard_expected) - 1;
-    unsigned short buffer[FX_ArraySize(hard_expected)];
+    constexpr int count = pdfium::size(hard_expected) - 1;
+    unsigned short buffer[pdfium::size(hard_expected)];
 
     EXPECT_EQ(count + 1, FPDFText_GetText(textpage, offset, count, buffer));
     for (int i = 0; i < count; i++)
@@ -1103,7 +1103,7 @@
       0x0061, 0x0073, 0x0020, 0x0063, 0x006f, 0x006d, 0x006d, 0x0069,
       0x0074, 0x0074, 0x0065, 0x0064, 0x002c, 0x0020, 0x0069, 0x0074,
       0x0020, 0x006e, 0x006f, 0x0074, 0x0069, 0x0002, 0x0066, 0x0069};
-  static_assert(page_range_length == FX_ArraySize(expected),
+  static_assert(page_range_length == pdfium::size(expected),
                 "Expected should be the same size as the range being "
                 "extracted from page.");
   EXPECT_LT(page_range_offset + page_range_length,
@@ -1205,7 +1205,7 @@
   // Positive testing.
   constexpr char kHelloText[] = "Hello, world!";
   // Return value includes the terminating NUL that is provided.
-  constexpr unsigned long kHelloUTF16Size = FX_ArraySize(kHelloText) * 2;
+  constexpr unsigned long kHelloUTF16Size = pdfium::size(kHelloText) * 2;
   constexpr wchar_t kHelloWideText[] = L"Hello, world!";
   unsigned long size = FPDFTextObj_GetText(text_object, text_page, nullptr, 0);
   ASSERT_EQ(kHelloUTF16Size, size);
@@ -1323,14 +1323,14 @@
     ASSERT_TRUE(text_page);
 
     constexpr char kText[] = "ABCD";
-    constexpr size_t kTextSize = FX_ArraySize(kText);
+    constexpr size_t kTextSize = pdfium::size(kText);
     // -1 for CountChars not including the \0
     EXPECT_EQ(static_cast<int>(kTextSize) - 1,
               FPDFText_CountChars(text_page.get()));
 
     unsigned short buffer[kTextSize];
     int num_chars =
-        FPDFText_GetText(text_page.get(), 0, FX_ArraySize(buffer) - 1, buffer);
+        FPDFText_GetText(text_page.get(), 0, pdfium::size(buffer) - 1, buffer);
     ASSERT_EQ(static_cast<int>(kTextSize), num_chars);
     EXPECT_TRUE(check_unsigned_shorts(kText, buffer, kTextSize));
   }
@@ -1346,9 +1346,9 @@
   FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
   ASSERT_TRUE(text_page);
 
-  static constexpr int kSubstringsSize[] = {FX_ArraySize("Hello,"),
-                                            FX_ArraySize(" world!\r\n"),
-                                            FX_ArraySize("Goodbye,")};
+  static constexpr int kSubstringsSize[] = {pdfium::size("Hello,"),
+                                            pdfium::size(" world!\r\n"),
+                                            pdfium::size("Goodbye,")};
 
   // -1 for CountChars not including the \0, but +1 for the extra control
   // character.
@@ -1498,7 +1498,7 @@
 
 TEST_F(FPDFTextEmbedderTest, GetMatrix) {
   constexpr char kExpectedText[] = "A1\r\nA2\r\nA3";
-  constexpr size_t kExpectedTextSize = FX_ArraySize(kExpectedText);
+  constexpr size_t kExpectedTextSize = pdfium::size(kExpectedText);
   constexpr FS_MATRIX kExpectedMatrices[] = {
       {12.0f, 0.0f, 0.0f, 10.0f, 66.0f, 90.0f},
       {12.0f, 0.0f, 0.0f, 10.0f, 66.0f, 90.0f},
@@ -1511,7 +1511,7 @@
       {1.0f, 0.0f, 0.0f, 0.833333, 60.0f, 130.0f},
       {1.0f, 0.0f, 0.0f, 0.833333, 60.0f, 130.0f},
   };
-  constexpr size_t kExpectedCount = FX_ArraySize(kExpectedMatrices);
+  constexpr size_t kExpectedCount = pdfium::size(kExpectedMatrices);
   static_assert(kExpectedCount + 1 == kExpectedTextSize,
                 "Bad expected matrix size");
 
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 168f07b..0b08bb8 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -11,10 +11,10 @@
 #include <utility>
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
 #include "fpdfsdk/pwl/cpwl_wnd.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -198,13 +198,13 @@
                                             5.0f, 3.0f, 5.0f};
       static constexpr float kOffsetsMinY[] = {4.0f, 3.0f, 5.0f, 3.0f,
                                                4.0f, 6.0f, 4.0f};
-      static_assert(FX_ArraySize(kOffsetsX) == FX_ArraySize(kOffsetsY),
+      static_assert(pdfium::size(kOffsetsX) == pdfium::size(kOffsetsY),
                     "Wrong offset count");
-      static_assert(FX_ArraySize(kOffsetsX) == FX_ArraySize(kOffsetsMinY),
+      static_assert(pdfium::size(kOffsetsX) == pdfium::size(kOffsetsMinY),
                     "Wrong offset count");
       const float* pOffsetsY =
           m_eSBButtonType == PSBT_MIN ? kOffsetsMinY : kOffsetsY;
-      for (size_t i = 0; i < FX_ArraySize(kOffsetsX); ++i)
+      for (size_t i = 0; i < pdfium::size(kOffsetsX); ++i)
         pts.push_back(CFX_PointF(fX + kOffsetsX[i], fY + pOffsetsY[i]));
       pDevice->DrawFillArea(mtUser2Device, pts,
                             IsEnabled()
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index f380e6e..4969add 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -23,12 +23,12 @@
 #include "fxbarcode/datamatrix/BC_C40Encoder.h"
 
 #include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_memory.h"
 #include "fxbarcode/common/BC_CommonBitMatrix.h"
 #include "fxbarcode/datamatrix/BC_Encoder.h"
 #include "fxbarcode/datamatrix/BC_EncoderContext.h"
 #include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
 #include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -40,7 +40,7 @@
   wchar_t cw[2];
   cw[0] = static_cast<wchar_t>(v / 256);
   cw[1] = static_cast<wchar_t>(v % 256);
-  return WideString(cw, FX_ArraySize(cw));
+  return WideString(cw, pdfium::size(cw));
 }
 
 }  // namespace
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
index 29924d8..90c738f 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
@@ -6,8 +6,8 @@
 
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 class CBC_DataMatrixWriterTest : public testing::Test {
  public:
@@ -42,10 +42,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -70,10 +70,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"helloworld", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -94,10 +94,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"12345", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -126,10 +126,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"abcdefghijklmnopqrst", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 5758f7e..6ecc168 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -28,6 +28,7 @@
 #include "core/fxcrt/fx_memory_wrappers.h"
 #include "fxbarcode/datamatrix/BC_Encoder.h"
 #include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -145,7 +146,7 @@
   ASSERT(numECWords > 0);
 
   const size_t len = codewords.GetLength();
-  static constexpr size_t kFactorTableNum = FX_ArraySize(FACTOR_SETS);
+  static constexpr size_t kFactorTableNum = pdfium::size(FACTOR_SETS);
   size_t table = 0;
   while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
     ++table;
diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/fxbarcode/datamatrix/BC_SymbolInfo.cpp
index 1b77f5f..78af349 100644
--- a/fxbarcode/datamatrix/BC_SymbolInfo.cpp
+++ b/fxbarcode/datamatrix/BC_SymbolInfo.cpp
@@ -22,10 +22,10 @@
 
 #include "fxbarcode/datamatrix/BC_SymbolInfo.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "fxbarcode/common/BC_CommonBitMatrix.h"
 #include "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
 #include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -54,7 +54,7 @@
     {816, 336, 136, 56, 24, 24, 16}, {1050, 408, 175, 68, 18, 18, 36},
     {1304, 496, 163, 62, 20, 20, 36}};
 
-constexpr size_t kSymbolDataSize = FX_ArraySize(kSymbolData);
+constexpr size_t kSymbolDataSize = pdfium::size(kSymbolData);
 static_assert(kSymbolDataSize + 1 == kSymbolsCount, "Wrong kSymbolDataSize");
 
 }  // namespace
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index f7a7615..816d39c 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -38,9 +38,9 @@
 const int8_t kOnedCodaCharacterEncoding[] = {
     0x03, 0x06, 0x09, 0x60, 0x12, 0x42, 0x21, 0x24, 0x30, 0x48, 0x0c,
     0x18, 0x45, 0x51, 0x54, 0x15, 0x1A, 0x29, 0x0B, 0x0E, 0x1A, 0x29};
-static_assert(FX_ArraySize(kOnedCodaCharacterEncoding) == 22, "Wrong size");
-static_assert(FX_ArraySize(kOnedCodaCharacterEncoding) ==
-                  FX_ArraySize(kOnedCodaAlphabet),
+static_assert(pdfium::size(kOnedCodaCharacterEncoding) == 22, "Wrong size");
+static_assert(pdfium::size(kOnedCodaCharacterEncoding) ==
+                  pdfium::size(kOnedCodaAlphabet),
               "Wrong size");
 
 const char kStartEndChars[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E',
@@ -160,7 +160,7 @@
         break;
     }
     int8_t code = 0;
-    for (size_t i = 0; i < FX_ArraySize(kOnedCodaAlphabet); i++) {
+    for (size_t i = 0; i < pdfium::size(kOnedCodaAlphabet); i++) {
       if (ch == kOnedCodaAlphabet[i]) {
         code = kOnedCodaCharacterEncoding[i];
         break;
diff --git a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
index 3de3b60..d17e989 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
@@ -4,8 +4,8 @@
 
 #include "fxbarcode/oned/BC_OnedCode128Writer.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -32,7 +32,7 @@
       {"321ABC", 722, {104, 19, 18, 17, 33, 34, 35}, 7},
       {"XYZ", 448, {104, 56, 57, 58}, 4},
   };
-  for (size_t i = 0; i < FX_ArraySize(kTestCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kTestCases); ++i) {
     FXSYS_snprintf(buf, sizeof(buf) - 1, "Test case %zu", i);
     SCOPED_TRACE(buf);
     const TestCase& test_case = kTestCases[i];
@@ -65,7 +65,7 @@
       {"321ABC", 933, {105, 32, 1, 65, 66, 67}, 6},
       {"XYZ", 641, {105, 88, 89, 90}, 4},
   };
-  for (size_t i = 0; i < FX_ArraySize(kTestCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kTestCases); ++i) {
     FXSYS_snprintf(buf, sizeof(buf) - 1, "Test case %zu", i);
     SCOPED_TRACE(buf);
     const TestCase& test_case = kTestCases[i];
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 42c031a..7f2de96 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -30,6 +30,7 @@
 #include "fxbarcode/BC_Writer.h"
 #include "fxbarcode/common/BC_CommonBitMatrix.h"
 #include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -37,13 +38,13 @@
     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
     'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
     'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '*', '$', '/', '+', '%'};
-constexpr size_t kOnedCode39AlphabetLen = FX_ArraySize(kOnedCode39Alphabet);
+constexpr size_t kOnedCode39AlphabetLen = pdfium::size(kOnedCode39Alphabet);
 
 const char kOnedCode39Checksum[] = {
     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
     'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
     'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%'};
-static_assert(FX_ArraySize(kOnedCode39Checksum) == 43, "Wrong size");
+static_assert(pdfium::size(kOnedCode39Checksum) == 43, "Wrong size");
 
 const int16_t kOnedCode39CharacterEncoding[] = {
     0x0034, 0x0121, 0x0061, 0x0160, 0x0031, 0x0130, 0x0070, 0x0025, 0x0124,
@@ -51,7 +52,7 @@
     0x004C, 0x001C, 0x0103, 0x0043, 0x0142, 0x0013, 0x0112, 0x0052, 0x0007,
     0x0106, 0x0046, 0x0016, 0x0181, 0x00C1, 0x01C0, 0x0091, 0x0190, 0x00D0,
     0x0085, 0x0184, 0x00C4, 0x0094, 0x00A8, 0x00A2, 0x008A, 0x002A};
-static_assert(FX_ArraySize(kOnedCode39CharacterEncoding) == 44, "Wrong size");
+static_assert(pdfium::size(kOnedCode39CharacterEncoding) == 44, "Wrong size");
 
 bool IsInOnedCode39Alphabet(wchar_t ch) {
   return FXSYS_IsDecimalDigit(ch) || (ch >= L'A' && ch <= L'Z') || ch == L'-' ||
@@ -155,7 +156,7 @@
     if (j >= kOnedCode39AlphabetLen)
       return '*';
   }
-  return kOnedCode39Checksum[checksum % FX_ArraySize(kOnedCode39Checksum)];
+  return kOnedCode39Checksum[checksum % pdfium::size(kOnedCode39Checksum)];
 }
 
 uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index 822f376..1e1ed1f 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -6,8 +6,8 @@
 
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 TEST(PDF417HighLevelEncoderTest, EncodeHighLevel) {
   static constexpr struct EncodeHighLevelCase {
@@ -40,7 +40,7 @@
       {L"0000000000000", L"\x0386\x000f\x00d9\x017b\x000b\x0064", 6},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(kEncodeHighLevelCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kEncodeHighLevelCases); ++i) {
     const EncodeHighLevelCase& testcase = kEncodeHighLevelCases[i];
     WideStringView input(testcase.input);
     WideString expected(testcase.expected, testcase.expected_length);
@@ -84,7 +84,7 @@
        L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(kEncodeBinaryCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kEncodeBinaryCases); ++i) {
     const EncodeBinaryCase& testcase = kEncodeBinaryCases[i];
     std::vector<uint8_t> input_array;
     size_t input_length = strlen(testcase.input);
@@ -151,7 +151,7 @@
        18},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(kEncodeNumericCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kEncodeNumericCases); ++i) {
     const EncodeNumericCase& testcase = kEncodeNumericCases[i];
     WideString input(testcase.input);
     WideString expected(testcase.expected, testcase.expected_length);
@@ -196,7 +196,7 @@
       {L"123FOO45678", 6, 5},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(kConsecutiveDigitCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kConsecutiveDigitCases); ++i) {
     const ConsecutiveDigitCase& testcase = kConsecutiveDigitCases[i];
     WideString input(testcase.input);
     int actual_count =
@@ -256,7 +256,7 @@
       {L"XXX121XXX12345678901234", 0, 9},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(kConsecutiveTextCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(kConsecutiveTextCases); ++i) {
     const ConsecutiveTextCase& testcase = kConsecutiveTextCases[i];
     WideString input(testcase.input);
     int actual_count =
diff --git a/fxbarcode/pdf417/BC_PDF417Writer_unittest.cpp b/fxbarcode/pdf417/BC_PDF417Writer_unittest.cpp
index 99ed6df..6851f24 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417Writer_unittest.cpp
@@ -7,6 +7,7 @@
 #include <vector>
 
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 class CBC_PDF417WriterTest : public testing::Test {
  public:
@@ -415,10 +416,10 @@
         1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1};
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedWidth, width);
     ASSERT_EQ(kExpectedHeight, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -813,10 +814,10 @@
         1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1};
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"hello world", &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedWidth, width);
     ASSERT_EQ(kExpectedHeight, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
 }
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter_unittest.cpp b/fxbarcode/qrcode/BC_QRCodeWriter_unittest.cpp
index 6edbc87..227d242 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter_unittest.cpp
+++ b/fxbarcode/qrcode/BC_QRCodeWriter_unittest.cpp
@@ -6,8 +6,8 @@
 
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 class CBC_QRCodeWriterTest : public testing::Test {
  public:
@@ -53,10 +53,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", 0, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -88,10 +88,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", 1, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -123,10 +123,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", 2, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -158,10 +158,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"", 3, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -193,10 +193,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"hello world", 0, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -228,10 +228,10 @@
     // clang-format on
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"hello world", 1, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -266,10 +266,10 @@
         1};
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"hello world", 2, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
   {
@@ -304,10 +304,10 @@
         1};
     std::vector<uint8_t, FxAllocAllocator<uint8_t>> data =
         writer.Encode(L"hello world", 3, &width, &height);
-    ASSERT_EQ(FX_ArraySize(kExpectedData), data.size());
+    ASSERT_EQ(pdfium::size(kExpectedData), data.size());
     ASSERT_EQ(kExpectedDimension, width);
     ASSERT_EQ(kExpectedDimension, height);
-    for (size_t i = 0; i < FX_ArraySize(kExpectedData); ++i)
+    for (size_t i = 0; i < pdfium::size(kExpectedData); ++i)
       EXPECT_EQ(kExpectedData[i], data[i]) << i;
   }
 }
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 4cb6337..e809f42 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -40,6 +40,7 @@
 #include "fxbarcode/qrcode/BC_QRCoderVersion.h"
 #include "third_party/base/optional.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 
 using ModeStringPair = std::pair<CBC_QRCoderMode*, ByteString>;
 
@@ -63,7 +64,7 @@
   if (code < 32)
     return -1;
   size_t code_index = static_cast<size_t>(code - 32);
-  if (code_index >= FX_ArraySize(g_alphaNumericTable))
+  if (code_index >= pdfium::size(g_alphaNumericTable))
     return -1;
   return g_alphaNumericTable[code_index];
 }
diff --git a/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
index 2c6b051..dcc9235 100644
--- a/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
@@ -22,12 +22,12 @@
 
 #include "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "fxbarcode/common/BC_CommonByteMatrix.h"
 #include "fxbarcode/qrcode/BC_QRCoder.h"
 #include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
 #include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
 #include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -331,7 +331,7 @@
     return true;
 
   const size_t index = version - 2;
-  if (index >= FX_ArraySize(kPositionAdjustmentPatternCoordinates))
+  if (index >= pdfium::size(kPositionAdjustmentPatternCoordinates))
     return false;
 
   const auto* coordinates = &kPositionAdjustmentPatternCoordinates[index][0];
diff --git a/fxjs/cjs_globalarrays.cpp b/fxjs/cjs_globalarrays.cpp
index b95861d..72f7439 100644
--- a/fxjs/cjs_globalarrays.cpp
+++ b/fxjs/cjs_globalarrays.cpp
@@ -6,14 +6,14 @@
 
 #include "fxjs/cjs_globalarrays.h"
 
-#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/stl_util.h"
 
 #define GLOBAL_ARRAY(rt, name, ...)                                          \
   {                                                                          \
     static const wchar_t* const values[] = {__VA_ARGS__};                    \
     v8::Local<v8::Array> array = (rt)->NewArray();                           \
     v8::Local<v8::Context> ctx = (rt)->GetIsolate()->GetCurrentContext();    \
-    for (size_t i = 0; i < FX_ArraySize(values); ++i)                        \
+    for (size_t i = 0; i < pdfium::size(values); ++i)                        \
       array->Set(ctx, i, (rt)->NewString(values[i])).FromJust();             \
     (rt)->SetConstArray((name), array);                                      \
     (rt)->DefineGlobalConst(                                                 \
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 8eed97d..8ba2565 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -35,6 +35,7 @@
 #include "fxjs/js_define.h"
 #include "fxjs/js_resources.h"
 #include "third_party/base/optional.h"
+#include "third_party/base/stl_util.h"
 
 // static
 const JSMethodSpec CJS_PublicMethods::GlobalFunctionSpecs[] = {
@@ -924,7 +925,7 @@
 
   int nMonth = 1;
   sTemp = wsArray[1];
-  for (size_t i = 0; i < FX_ArraySize(fxjs::kMonths); ++i) {
+  for (size_t i = 0; i < pdfium::size(fxjs::kMonths); ++i) {
     if (sTemp.Compare(fxjs::kMonths[i]) == 0) {
       nMonth = i + 1;
       break;
@@ -984,7 +985,7 @@
     return CJS_Result::Failure(JSMessage::kParamError);
 
   int iIndex = WithinBoundsOrZero(pRuntime->ToInt32(params[0]),
-                                  FX_ArraySize(kDateFormats));
+                                  pdfium::size(kDateFormats));
   std::vector<v8::Local<v8::Value>> newParams;
   newParams.push_back(pRuntime->NewString(kDateFormats[iIndex]));
   return AFDate_FormatEx(pRuntime, newParams);
@@ -998,7 +999,7 @@
     return CJS_Result::Failure(JSMessage::kParamError);
 
   int iIndex = WithinBoundsOrZero(pRuntime->ToInt32(params[0]),
-                                  FX_ArraySize(kDateFormats));
+                                  pdfium::size(kDateFormats));
   std::vector<v8::Local<v8::Value>> newParams;
   newParams.push_back(pRuntime->NewString(kDateFormats[iIndex]));
   return AFDate_KeystrokeEx(pRuntime, newParams);
@@ -1012,7 +1013,7 @@
     return CJS_Result::Failure(JSMessage::kParamError);
 
   int iIndex = WithinBoundsOrZero(pRuntime->ToInt32(params[0]),
-                                  FX_ArraySize(kTimeFormats));
+                                  pdfium::size(kTimeFormats));
   std::vector<v8::Local<v8::Value>> newParams;
   newParams.push_back(pRuntime->NewString(kTimeFormats[iIndex]));
   return AFDate_FormatEx(pRuntime, newParams);
@@ -1025,7 +1026,7 @@
     return CJS_Result::Failure(JSMessage::kParamError);
 
   int iIndex = WithinBoundsOrZero(pRuntime->ToInt32(params[0]),
-                                  FX_ArraySize(kTimeFormats));
+                                  pdfium::size(kTimeFormats));
   std::vector<v8::Local<v8::Value>> newParams;
   newParams.push_back(pRuntime->NewString(kTimeFormats[iIndex]));
   return AFDate_KeystrokeEx(pRuntime, newParams);
diff --git a/fxjs/cjs_publicmethods_unittest.cpp b/fxjs/cjs_publicmethods_unittest.cpp
index 739c031..69ba63a 100644
--- a/fxjs/cjs_publicmethods_unittest.cpp
+++ b/fxjs/cjs_publicmethods_unittest.cpp
@@ -4,8 +4,8 @@
 
 #include "fxjs/cjs_publicmethods.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 TEST(CJS_PublicMethods, IsNumber) {
   // TODO(weili): Check whether results from case 0, 1, 10, 15 are intended.
@@ -43,7 +43,7 @@
       {L"0123", true},
       {L"9876123", true},
   };
-  for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
+  for (size_t i = 0; i < pdfium::size(test_data); ++i) {
     EXPECT_EQ(test_data[i].expected,
               CJS_PublicMethods::IsNumber(test_data[i].input))
         << "for case " << i;
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 2f174fa..ad504ef 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -15,7 +15,6 @@
 
 #include "build/build_config.h"
 #include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_memory.h"
 #include "fxjs/cjs_event_context.h"
 #include "fxjs/cjs_eventrecorder.h"
 #include "fxjs/cjs_object.h"
@@ -24,6 +23,7 @@
 #include "fxjs/fx_date_helpers.h"
 #include "fxjs/js_define.h"
 #include "fxjs/js_resources.h"
+#include "third_party/base/stl_util.h"
 
 #if defined(OS_ANDROID)
 #include <ctype.h>
@@ -215,7 +215,7 @@
   cFormat.erase(std::remove(cFormat.begin(), cFormat.end(), '%'),
                 cFormat.end());
 
-  for (size_t i = 0; i < FX_ArraySize(TbConvertTable); ++i) {
+  for (size_t i = 0; i < pdfium::size(TbConvertTable); ++i) {
     int iStart = 0;
     int iEnd;
     while ((iEnd = cFormat.find(TbConvertTable[i].lpszJSMark, iStart)) != -1) {
@@ -234,7 +234,7 @@
       {L"M", min},   {L"s", sec},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(cTableAd); ++i) {
+  for (size_t i = 0; i < pdfium::size(cTableAd); ++i) {
     int iStart = 0;
     int iEnd;
     while ((iEnd = cFormat.find(cTableAd[i].lpszJSMark, iStart)) != -1) {
diff --git a/fxjs/cjs_util_unittest.cpp b/fxjs/cjs_util_unittest.cpp
index 7c10571..b4c07f7 100644
--- a/fxjs/cjs_util_unittest.cpp
+++ b/fxjs/cjs_util_unittest.cpp
@@ -4,8 +4,8 @@
 
 #include "fxjs/cjs_util.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 TEST(CJS_Util, ParseDataType) {
   struct ParseDataTypeCase {
@@ -105,7 +105,7 @@
       {L"%10s", UTIL_STRING},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(cases); i++) {
+  for (size_t i = 0; i < pdfium::size(cases); i++) {
     WideString input(cases[i].input_string);
     EXPECT_EQ(cases[i].expected, CJS_Util::ParseDataType(&input))
         << cases[i].input_string;
diff --git a/fxjs/fx_date_helpers.cpp b/fxjs/fx_date_helpers.cpp
index 5256fb1..24d6890 100644
--- a/fxjs/fx_date_helpers.cpp
+++ b/fxjs/fx_date_helpers.cpp
@@ -14,6 +14,7 @@
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_system.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
+#include "third_party/base/stl_util.h"
 
 namespace fxjs {
 namespace {
@@ -113,7 +114,7 @@
   // Check for February onwards.
   static constexpr int kCumulativeDaysInMonths[] = {
       59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
-  for (size_t i = 0; i < FX_ArraySize(kCumulativeDaysInMonths); ++i) {
+  for (size_t i = 0; i < pdfium::size(kCumulativeDaysInMonths); ++i) {
     if (day < kCumulativeDaysInMonths[i])
       return i + 1;
   }
@@ -433,7 +434,7 @@
               nSkip = FindSubWordLength(value, j);
               if (nSkip == KMonthAbbreviationLength) {
                 WideString sMonth = value.Substr(j, KMonthAbbreviationLength);
-                for (size_t m = 0; m < FX_ArraySize(kMonths); ++m) {
+                for (size_t m = 0; m < pdfium::size(kMonths); ++m) {
                   if (sMonth.CompareNoCase(kMonths[m]) == 0) {
                     nMonth = m + 1;
                     i += 3;
@@ -470,7 +471,7 @@
               if (nSkip <= kLongestFullMonthLength) {
                 WideString sMonth = value.Substr(j, nSkip);
                 sMonth.MakeLower();
-                for (size_t m = 0; m < FX_ArraySize(kFullMonths); ++m) {
+                for (size_t m = 0; m < pdfium::size(kFullMonths); ++m) {
                   WideString sFullMonths = WideString(kFullMonths[m]);
                   sFullMonths.MakeLower();
                   if (sFullMonths.Contains(sMonth.c_str())) {
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 105fd69..0c0cf38 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -279,7 +279,7 @@
     255, 2,   255, 255, 255, 255, 255, 255, 255, 255, 255,
     255, 255, 1,   255, 255, 255, 255, 255, 255, 255, 255,
 };
-static_assert(FX_ArraySize(kAltTableDate) == L'a' - L'A' + 1,
+static_assert(pdfium::size(kAltTableDate) == L'a' - L'A' + 1,
               "Invalid kAltTableDate size.");
 
 const uint8_t kAltTableTime[] = {
@@ -287,7 +287,7 @@
     255, 6,   255, 255, 255, 255, 255, 7,   255, 255, 255,
     255, 255, 1,   17,  255, 255, 255, 255, 255, 255, 255,
 };
-static_assert(FX_ArraySize(kAltTableTime) == L'a' - L'A' + 1,
+static_assert(pdfium::size(kAltTableTime) == L'a' - L'A' + 1,
               "Invalid kAltTableTime size.");
 
 void AlternateDateTimeSymbols(WideString* pPattern,
@@ -981,7 +981,7 @@
   szEncode[3] = 0;
   for (wchar_t ch : wsURL) {
     size_t i = 0;
-    size_t iCount = FX_ArraySize(kStrUnsafe);
+    size_t iCount = pdfium::size(kStrUnsafe);
     while (i < iCount) {
       if (ch == kStrUnsafe[i]) {
         int32_t iIndex = ch / 16;
@@ -996,7 +996,7 @@
       continue;
 
     i = 0;
-    iCount = FX_ArraySize(kStrReserved);
+    iCount = pdfium::size(kStrReserved);
     while (i < iCount) {
       if (ch == kStrReserved[i]) {
         int32_t iIndex = ch / 16;
@@ -1011,7 +1011,7 @@
       continue;
 
     i = 0;
-    iCount = FX_ArraySize(kStrSpecial);
+    iCount = pdfium::size(kStrSpecial);
     while (i < iCount) {
       if (ch == kStrSpecial[i]) {
         wsResultBuf.AppendChar(ch);
@@ -1344,7 +1344,7 @@
     kClassTag,                              // tag
     "XFA_FM2JS_FormCalcClass",              // name
     kFormCalcFM2JSFunctions,                // methods
-    FX_ArraySize(kFormCalcFM2JSFunctions),  // number of methods
+    pdfium::size(kFormCalcFM2JSFunctions),  // number of methods
     nullptr,                                // dynamic prop type
     nullptr,                                // dynamic prop getter
     nullptr,                                // dynamic prop setter
diff --git a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
index 4803df6..9e2532c 100644
--- a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "core/fxcrt/fx_memory.h"
 #include "fxjs/xfa/cfxjse_engine.h"
 #include "fxjs/xfa/cfxjse_value.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/xfa_js_embedder_test.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fxfa/cxfa_eventparam.h"
 
 class CFXJSE_FormCalcContextEmbedderTest : public XFAJSEmbedderTest {
@@ -73,7 +73,7 @@
                 "endif",
                 0}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -94,7 +94,7 @@
       {"concat(\"The total is \", 2, \" dollars and \", 57, \" cents.\")",
        "The total is 2 dollars and 57 cents."}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -135,7 +135,7 @@
                {"12 >= 12", true},
                {"\"true\" < \"false\"", false}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -153,7 +153,7 @@
     float result;
   } tests[] = {{"Abs(1.03)", 1.03f}, {"Abs(-1.03)", 1.03f}, {"Abs(0)", 0.0f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -171,7 +171,7 @@
     float result;
   } tests[] = {{"Avg(0, 32, 16)", 16.0f}, {"Avg(2.5, 17, null)", 9.75f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -189,7 +189,7 @@
     int result;
   } tests[] = {{"Ceil(2.5875)", 3}, {"Ceil(-5.9)", -5}, {"Ceil(\"abc\")", 0}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -207,7 +207,7 @@
     int result;
   } tests[] = {{"Count(\"Tony\", \"Blue\", 41)", 3}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -227,7 +227,7 @@
                {"Floor(5.999965342)", 5},
                {"Floor(3.2 * 15)", 48}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -247,7 +247,7 @@
                {"Max(\"abc\", 15, \"Tony Blue\")", 15},
                {"Max(\"abc\")", 0}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -269,7 +269,7 @@
                // {"Min(\"abc\", 15, \"Tony Blue\")", 15},
                {"Min(\"abc\")", 0}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -287,7 +287,7 @@
     int result;
   } tests[] = {{"Mod(64, -3)", 1}, {"Mod(-13, 3)", -1}, {"Mod(\"abc\", 2)", 0}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -308,7 +308,7 @@
                {"Round(8.9897, \"abc\")", 9.0f},
                {"Round(FV(400, 0.10/12, 30*12), 2)", 904195.17f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -328,7 +328,7 @@
                {"Sum(-2, 4, -6, 8)", 4},
                {"Sum(4, 16, \"abc\", 19)", 39}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -367,7 +367,7 @@
       {"Date2Num(\"1/3/00\", \"D/M/YY\") - Date2Num(\"1/2/00\", \"D/M/YY\")",
        29}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -390,7 +390,7 @@
       // {"DateFmt(4, \"fr_FR\")", "EEE D' MMMM YYYY"}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -413,7 +413,7 @@
                {"IsoDate2Num(\"19960315T20:20:20\")", 35138},
                {"IsoDate2Num(\"2000-03-01\") - IsoDate2Num(\"20000201\")", 29}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -431,7 +431,7 @@
     int result;
   } tests[] = {{"IsoTime2Num(\"00:00:00Z\")", 1}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -452,7 +452,7 @@
                {"LocalDateFmt(3, \"de_CH\")", "t. MMMM jjjj"},
                {"LocalDateFmt(4, \"fr_FR\")", "EEEE j MMMM aaaa"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -474,7 +474,7 @@
                {"LocalTimeFmt(3, \"de_CH\")", "HH:mm:ss z"},
                {"LocalTimeFmt(4, \"fr_FR\")", "HH' h 'mm z"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -499,7 +499,7 @@
       //  "Jan 1, 1902"}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -523,7 +523,7 @@
                {"Num2GMTime(43993001, TimeFmt(4, \"de_DE\"), \"de_DE\")",
                 "12.13 Uhr GMT"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -543,7 +543,7 @@
     const char* result;
   } tests[] = {{"Num2Time(1, \"HH:MM:SS\")", "00:00:00"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -578,7 +578,7 @@
       // {"Time2Num(\"00:00:00 GMT\", \"HH:MM:SS Z\")", 1},
       {"Time2Num(\"13:13:13 GMT\", \"HH:MM:SS Z\", \"fr_FR\")", 47593001}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -601,7 +601,7 @@
       // {"TimeFmt(4, \"de_DE\")", "H.MM' Uhr 'Z"}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -621,7 +621,7 @@
   } tests[] = {{"Apr(35000, 269.50, 360)", 0.08515404566f},
                {"Apr(210000 * 0.75, 850 + 110, 25 * 26)", 0.07161332404f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -643,7 +643,7 @@
       // {"CTerm(0.0275 + 0.0025, 1000000, 55000 * 0.10)", 176.02226044975f}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -662,7 +662,7 @@
   } tests[] = {{"FV(400, 0.10 / 12, 30 * 12)", 904195.16991842445f},
                {"FV(1000, 0.075 / 4, 10 * 4)", 58791.96145535981f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -682,7 +682,7 @@
                {"IPmt(160000, 0.0475, 980, 24, 12)", 7103.80833569485f},
                {"IPmt(15000, 0.065, 65.50, 15, 1)", 0.0f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -702,7 +702,7 @@
                {"NPV(0.10, 500, 1500, 4000, 10000)", 11529.60863329007f},
                {"NPV(0.0275 / 12, 50, 60, 40, 100, 25)", 273.14193838457f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -721,7 +721,7 @@
   } tests[] = {// {"Pmt(150000, 0.0475 / 12, 25 * 12)", 855.17604207164f},
                {"Pmt(25000, 0.085, 12)", 3403.82145169876f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -743,7 +743,7 @@
       // {"PPmt(15000, 0.065, 65.50, 15, 1)", 0.0f}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -764,7 +764,7 @@
       // {"PV(1000, 0.075 / 4, 10 * 4)", 58791.96145535981f}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -783,7 +783,7 @@
   } tests[] = {{"Rate(12000, 8000, 5)", 0.0844717712f},
                {"Rate(10000, 0.25 * 5000, 4 * 12)", 0.04427378243f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -802,7 +802,7 @@
   } tests[] = {// {"Term(475, .05, 1500)", 3.00477517728f},
                {"Term(2500, 0.0275 + 0.0025, 5000)", 1.97128786369f}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -824,7 +824,7 @@
       {"Choose(20/3, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\")",
        "F"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -852,7 +852,7 @@
     bool result;
   } tests[] = {{"HasValue(2)", true}, {"HasValue(\" \")", false}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -877,7 +877,7 @@
       {"Oneof(3, null, null)", false},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -897,7 +897,7 @@
                {"Within(1.5, 0, 2)", true},
                {"Within(-1, 0, 2)", false}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -915,7 +915,7 @@
     int result;
   } tests[] = {{"eval(\"10*3+5*4\")", 50}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -934,7 +934,7 @@
   } tests[] = {{"Null()", "null"},
                {"Concat(\"ABC\", Null(), \"DEF\")", "ABCDEF"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -959,7 +959,7 @@
     const char* result;
   } tests[] = {{"Ref(\"10*3+5*4\")", "10*3+5*4"}, {"Ref(\"hello\")", "hello"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -983,7 +983,7 @@
                {"UnitType(\"2.zero cm\")", "in"},
                {"UnitType(\"kilometers\")", "in"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1007,7 +1007,7 @@
       // {"UnitType(\"5.08cm\", \"kilograms\")", 2.0f}
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1027,7 +1027,7 @@
                {"At(\"ABCDEFGH\", \"F\")", 6},
                {"At(23412931298471, 29)", 5}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1049,7 +1049,7 @@
                 "You owe One Thousand One Hundred Fifty-four Dollars And "
                 "Sixty-seven Cents."}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1093,7 +1093,7 @@
       {R"(Decode("?%"))", "?"},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
     CFXJSE_Value* value = GetValue();
     EXPECT_TRUE(value->IsString());
@@ -1129,7 +1129,7 @@
 #endif  // !defined(OS_WIN)
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1149,7 +1149,7 @@
   } tests[] = {{"Format(\"MMM D, YYYY\", \"20020901\")", "Sep 1, 2002"},
                {"Format(\"$9,999,999.99\", 1234567.89)", "$1,234,567.89"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1169,7 +1169,7 @@
   } tests[] = {{"Left(\"ABCDEFGH\", 3)", "ABC"},
                {"Left(\"Tony Blue\", 5)", "Tony "}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1189,7 +1189,7 @@
   } tests[] = {
       {"Len(\"ABCDEFGH\")", 8}, {"Len(4)", 1}, {"Len(Str(4.532, 6, 4))", 6}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1209,7 +1209,7 @@
                {"Lower(\"21 Main St.\")", "21 main st."},
                {"Lower(15)", "15"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1239,7 +1239,7 @@
   } tests[] = {{"Ltrim(\"   ABCD\")", "ABCD"},
                {"Ltrim(Rtrim(\"    Tony Blue    \"))", "Tony Blue"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1258,7 +1258,7 @@
     const char* result;
   } tests[] = {{"Parse(\"MMM D, YYYY\", \"Sep 1, 2002\")", "2002-09-01"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1284,7 +1284,7 @@
                {"Replace(\"ABCDEFGH\", \"D\")", "ABCEFGH"},
                {"Replace(\"ABCDEFGH\", \"d\")", "ABCDEFGH"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1304,7 +1304,7 @@
   } tests[] = {{"Right(\"ABCDEFGH\", 3)", "FGH"},
                {"Right(\"Tony Blue\", 5)", " Blue"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1324,7 +1324,7 @@
   } tests[] = {{"Rtrim(\"ABCD   \")", "ABCD"},
                {"Rtrim(\"Tony Blue      \t\")", "Tony Blue"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1344,7 +1344,7 @@
   } tests[] = {{"Space(5)", "     "},
                {"Concat(\"Tony\", Space(1), \"Blue\")", "Tony Blue"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1366,7 +1366,7 @@
                {"Str(234.458, 4)", " 234"},
                {"Str(31.2345, 4, 2)", "****"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1388,7 +1388,7 @@
                {"Stuff(\"members-list@myweb.com\", 0, 0, \"cc:\")",
                 "cc:members-list@myweb.com"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1465,7 +1465,7 @@
                {"Upper(\"21 Main St.\")", "21 MAIN ST."},
                {"Upper(15)", "15"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1491,7 +1491,7 @@
        "One Thousand One Hundred Fifty-four Dollars And Sixty-seven Cents"},
       {"WordNum(43, 2)", "Forty-three Dollars And Zero Cents"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(Execute(tests[i].program));
 
     CFXJSE_Value* value = GetValue();
@@ -1524,7 +1524,7 @@
       "Round(2.0)()",
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_FALSE(ExecuteSilenceFailure(tests[i]));
   }
 }
diff --git a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
index b6a6663..b191f76 100644
--- a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
+++ b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
@@ -6,9 +6,9 @@
 
 #include <stdint.h>
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_string.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fxfa/parser/cxfa_localemgr.h"
 
 namespace {
@@ -32,8 +32,8 @@
   }
 
   uint8_t test_selector = data[0] % 10;
-  uint8_t locale_selector = data[1] % FX_ArraySize(kLocales);
-  uint8_t type_selector = data[2] % FX_ArraySize(kTypes);
+  uint8_t locale_selector = data[1] % pdfium::size(kLocales);
+  uint8_t type_selector = data[2] % pdfium::size(kTypes);
   data += 3;
   size -= 3;
 
diff --git a/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc b/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
index 4b20068..86703f7 100644
--- a/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
+++ b/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
@@ -7,6 +7,7 @@
 #include "core/fxge/fx_dib.h"
 #include "testing/fuzzers/pdfium_fuzzer_util.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -33,8 +34,8 @@
 
   BlendMode blend_mode = static_cast<BlendMode>(
       data[28] % (static_cast<int>(BlendMode::kLast) + 1));
-  FXDIB_Format dest_format = kFormat[data[29] % FX_ArraySize(kFormat)];
-  FXDIB_Format src_format = kFormat[data[30] % FX_ArraySize(kFormat)];
+  FXDIB_Format dest_format = kFormat[data[29] % pdfium::size(kFormat)];
+  FXDIB_Format src_format = kFormat[data[30] % pdfium::size(kFormat)];
   bool is_clip = !(data[31] % 2);
   bool is_rgb_byte_order = !(data[32] % 2);
   size -= kParameterSize;
diff --git a/xfa/fde/cfde_wordbreak_data.cpp b/xfa/fde/cfde_wordbreak_data.cpp
index 9331253..22b9cfc 100644
--- a/xfa/fde/cfde_wordbreak_data.cpp
+++ b/xfa/fde/cfde_wordbreak_data.cpp
@@ -6,8 +6,8 @@
 
 #include "xfa/fde/cfde_wordbreak_data.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_system.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -2825,7 +2825,7 @@
 
 WordBreakProperty FX_GetWordBreakProperty(wchar_t wcCodePoint) {
   size_t index = static_cast<size_t>(wcCodePoint) / 2;
-  if (index >= FX_ArraySize(kCodePointProperties))
+  if (index >= pdfium::size(kCodePointProperties))
     return WordBreakProperty::kNone;
 
   uint8_t dwProperty = kCodePointProperties[index];
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index 30b63f9..d20cb6d 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -12,7 +12,6 @@
 #include <vector>
 
 #include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "third_party/base/stl_util.h"
 #include "xfa/fgas/crt/cfgas_decimal.h"
@@ -455,7 +454,7 @@
         ResolveZone(tzDiff, pLocale, &hour, &minute);
       } else {
         // Search the timezone list. There are only 8 of them, so linear scan.
-        for (size_t i = 0; i < FX_ArraySize(g_FXLocaleTimeZoneData); ++i) {
+        for (size_t i = 0; i < pdfium::size(g_FXLocaleTimeZoneData); ++i) {
           const FX_LOCALETIMEZONEINFO& info = g_FXLocaleTimeZoneData[i];
           if (tz != info.name)
             continue;
diff --git a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
index 0c8fbd4..fc8d485 100644
--- a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
@@ -12,10 +12,10 @@
 
 #include "build/build_config.h"
 #include "core/fpdfapi/page/cpdf_pagemodule.h"
-#include "core/fxcrt/fx_memory.h"
 #include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fxfa/parser/cxfa_localemgr.h"
 
 class CFGAS_StringFormatterTest : public testing::Test {
@@ -114,7 +114,7 @@
   // as they are not supported. In theory there are the full width versions
   // of DDD, DDDD, MMM, MMMM, E, e, gg, YYY, YYYYY.
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(
         fmt(tests[i].locale, tests[i].pattern)
@@ -163,7 +163,7 @@
   // The z modifier only appends if the TZ is outside of +0
   SetTZ("UTC+2");
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(
         fmt(tests[i].locale, tests[i].pattern)
@@ -195,7 +195,7 @@
       {L"en", L"9111T1111:", L"MMM D, YYYYTh:MM:SS A",
        L"Jan 1, 9111 11:11:00 AM"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)
                     ->FormatDateTime(tests[i].input, FX_DATETIMETYPE_DateTime,
@@ -223,7 +223,7 @@
        L"time{'At 'HH:MM Z}date{' on 'MMM DD, YYYY}",
        L"At 10:30 GMT on Jul 16, 1999"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)
                     ->FormatDateTime(tests[i].input, FX_DATETIMETYPE_TimeDate,
@@ -284,7 +284,7 @@
   // not supported. In theory there are the full width versions of DDD,
   // DDDD, MMM, MMMM, E, e, gg, YYY, YYYYY.
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     CFX_DateTime result;
     EXPECT_TRUE(
         fmt(tests[i].locale, tests[i].pattern)
@@ -311,7 +311,7 @@
 //   // kkkk, HHH, HHHH, KKK, KKKK, MMM, MMMM, SSS, SSSS plus 2 more that the
 //   // spec apparently forgot to list the symbol.
 
-//   for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+//   for (size_t i = 0; i < pdfium::size(tests); ++i) {
 //     CFX_DateTime result;
 //     EXPECT_TRUE(fmt(tests[i].locale)
 //                     ->ParseDateTime(tests[i].input, tests[i].pattern,
@@ -633,7 +633,7 @@
                {L"en", L"A1C-1234-D", L"000-9999-X", L"A1C1234D"},
                {L"en", L"A1C-1234-D text", L"000-9999-X 'text'", L"A1C1234D"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)
                     ->ParseText(tests[i].input, &result));
@@ -663,7 +663,7 @@
       {L"en", L"K1#5K2", L"00X OO9", L"K1# 5K2"},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)
                     ->FormatText(tests[i].input, &result));
@@ -681,7 +681,7 @@
       {L"en", L"No data", L"null{'No data'}"},
   };
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(
         fmt(tests[i].locale, tests[i].pattern)->ParseNull(tests[i].input))
         << " TEST: " << i;
@@ -695,7 +695,7 @@
     const wchar_t* output;
   } tests[] = {{L"en", L"null{'n/a'}", L"n/a"}, {L"en", L"null{}", L""}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)->FormatNull(&result));
     EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i;
@@ -711,7 +711,7 @@
                {L"en", L"9", L"zero{9}"},
                {L"en", L"a", L"zero{'a'}"}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     EXPECT_TRUE(
         fmt(tests[i].locale, tests[i].pattern)->ParseZero(tests[i].input))
         << " TEST: " << i;
@@ -731,7 +731,7 @@
                // {L"en", L"0.0", L"zero{9}", L"0"},
                {L"en", L"0", L"zero{}", L""}};
 
-  for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
+  for (size_t i = 0; i < pdfium::size(tests); ++i) {
     WideString result;
     EXPECT_TRUE(fmt(tests[i].locale, tests[i].pattern)->FormatZero(&result));
     EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i;
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 3d2d305..a303525 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -323,7 +323,7 @@
                                 FX_CODEPAGE_MSDOS_US};
 
 uint16_t FX_GetCodePageBit(uint16_t wCodePage) {
-  for (size_t i = 0; i < FX_ArraySize(g_CodePages); ++i) {
+  for (size_t i = 0; i < pdfium::size(g_CodePages); ++i) {
     if (g_CodePages[i] == wCodePage)
       return static_cast<uint16_t>(i);
   }
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index b342237..fb6bbf0 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -13,6 +13,7 @@
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_document.h"
 #include "core/fxge/fx_font.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fgas/font/cfgas_fontmgr.h"
 #include "xfa/fgas/font/cfgas_gefont.h"
 
@@ -97,7 +98,7 @@
 ByteString CFGAS_PDFFontMgr::PsNameToFontName(const ByteString& strPsName,
                                               bool bBold,
                                               bool bItalic) {
-  for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) {
+  for (size_t i = 0; i < pdfium::size(g_XFAPDFFontName); ++i) {
     if (strPsName == g_XFAPDFFontName[i][0]) {
       size_t index = 1;
       if (bBold)
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index a733583..b348fdb 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -9,7 +9,7 @@
 #include "build/build_config.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fgas/font/cfgas_fontmgr.h"
 
 namespace {
@@ -1872,7 +1872,7 @@
 
 WideString FGAS_FontNameToEnglishName(WideStringView wsLocalName) {
   uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
-  const FGAS_FontInfo* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
+  const FGAS_FontInfo* pEnd = g_XFAFontsMap + pdfium::size(g_XFAFontsMap);
   const FGAS_FontInfo* pFontInfo =
       std::lower_bound(g_XFAFontsMap, pEnd, dwLocalNameHash,
                        [](const FGAS_FontInfo& entry, uint32_t hash) {
@@ -1888,7 +1888,7 @@
   wsFontNameTemp.Remove(L' ');
   uint32_t dwCurFontNameHash =
       FX_HashCode_GetW(wsFontNameTemp.AsStringView(), true);
-  const FGAS_FontInfo* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
+  const FGAS_FontInfo* pEnd = g_XFAFontsMap + pdfium::size(g_XFAFontsMap);
   const FGAS_FontInfo* pFontInfo =
       std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
                        [](const FGAS_FontInfo& entry, uint32_t hash) {
diff --git a/xfa/fgas/layout/cfx_char.cpp b/xfa/fgas/layout/cfx_char.cpp
index cd258f9..ed48913 100644
--- a/xfa/fgas/layout/cfx_char.cpp
+++ b/xfa/fgas/layout/cfx_char.cpp
@@ -9,7 +9,6 @@
 #include <algorithm>
 
 #include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_memory.h"
 #include "third_party/base/stl_util.h"
 
 namespace {
@@ -238,29 +237,29 @@
 }
 
 FX_BIDIWEAKSTATE GetWeakState(FX_BIDIWEAKSTATE eState, FX_BIDICLASS eClass) {
-  ASSERT(static_cast<size_t>(eState) < FX_ArraySize(kWeakStates));
-  ASSERT(static_cast<size_t>(eClass) < FX_ArraySize(kWeakStates[0]));
+  ASSERT(static_cast<size_t>(eState) < pdfium::size(kWeakStates));
+  ASSERT(static_cast<size_t>(eClass) < pdfium::size(kWeakStates[0]));
   return kWeakStates[static_cast<size_t>(eState)][static_cast<size_t>(eClass)];
 }
 
 FX_BIDIWEAKACTION GetWeakAction(FX_BIDIWEAKSTATE eState, FX_BIDICLASS eClass) {
-  ASSERT(static_cast<size_t>(eState) < FX_ArraySize(kWeakActions));
-  ASSERT(static_cast<size_t>(eClass) < FX_ArraySize(kWeakActions[0]));
+  ASSERT(static_cast<size_t>(eState) < pdfium::size(kWeakActions));
+  ASSERT(static_cast<size_t>(eClass) < pdfium::size(kWeakActions[0]));
   return kWeakActions[static_cast<size_t>(eState)][static_cast<size_t>(eClass)];
 }
 
 FX_BIDINEUTRALSTATE GetNeutralState(FX_BIDINEUTRALSTATE eState,
                                     FX_BIDICLASS eClass) {
-  ASSERT(static_cast<size_t>(eState) < FX_ArraySize(kNeutralStates));
-  ASSERT(static_cast<size_t>(eClass) < FX_ArraySize(kNeutralStates[0]));
+  ASSERT(static_cast<size_t>(eState) < pdfium::size(kNeutralStates));
+  ASSERT(static_cast<size_t>(eClass) < pdfium::size(kNeutralStates[0]));
   return kNeutralStates[static_cast<size_t>(eState)]
                        [static_cast<size_t>(eClass)];
 }
 
 FX_BIDINEUTRALACTION GetNeutralAction(FX_BIDINEUTRALSTATE eState,
                                       FX_BIDICLASS eClass) {
-  ASSERT(static_cast<size_t>(eState) < FX_ArraySize(kNeutralActions));
-  ASSERT(static_cast<size_t>(eClass) < FX_ArraySize(kNeutralActions[0]));
+  ASSERT(static_cast<size_t>(eState) < pdfium::size(kNeutralActions));
+  ASSERT(static_cast<size_t>(eClass) < pdfium::size(kNeutralActions[0]));
   return kNeutralActions[static_cast<size_t>(eState)]
                         [static_cast<size_t>(eClass)];
 }
diff --git a/xfa/fgas/layout/fx_arabic.cpp b/xfa/fgas/layout/fx_arabic.cpp
index 886bb0d..af0bd69 100644
--- a/xfa/fgas/layout/fx_arabic.cpp
+++ b/xfa/fgas/layout/fx_arabic.cpp
@@ -9,8 +9,8 @@
 #include <algorithm>
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_unicode.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -161,7 +161,7 @@
 }
 
 wchar_t GetArabicFromAlefTable(wchar_t alef) {
-  static const size_t s_iAlefCount = FX_ArraySize(gs_FX_AlefTable);
+  static const size_t s_iAlefCount = pdfium::size(gs_FX_AlefTable);
   for (size_t iStart = 0; iStart < s_iAlefCount; iStart++) {
     const FX_ARAALEF& v = gs_FX_AlefTable[iStart];
     if (v.wAlef == alef)
@@ -221,7 +221,7 @@
 }  // namespace pdfium
 
 wchar_t FX_GetArabicFromShaddaTable(wchar_t shadda) {
-  static const size_t s_iShaddaCount = FX_ArraySize(gs_FX_ShaddaTable);
+  static const size_t s_iShaddaCount = pdfium::size(gs_FX_ShaddaTable);
   for (size_t iStart = 0; iStart < s_iShaddaCount; iStart++) {
     const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart];
     if (v.wShadda == shadda)
diff --git a/xfa/fgas/layout/fx_linebreak.cpp b/xfa/fgas/layout/fx_linebreak.cpp
index 96821f1..6b59ab0 100644
--- a/xfa/fgas/layout/fx_linebreak.cpp
+++ b/xfa/fgas/layout/fx_linebreak.cpp
@@ -6,8 +6,8 @@
 
 #include "xfa/fgas/layout/fx_linebreak.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxcrt/fx_unicode.h"
+#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -226,7 +226,7 @@
                                           FX_BREAKPROPERTY next_char) {
   size_t row = static_cast<size_t>(curr_char);
   size_t col = static_cast<size_t>(next_char);
-  ASSERT(row < FX_ArraySize(gs_FX_LineBreak_PairTable));
-  ASSERT(col < FX_ArraySize(gs_FX_LineBreak_PairTable[0]));
+  ASSERT(row < pdfium::size(gs_FX_LineBreak_PairTable));
+  ASSERT(col < pdfium::size(gs_FX_LineBreak_PairTable[0]));
   return gs_FX_LineBreak_PairTable[row][col];
 }
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 16563d3..383cb8a 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -9,9 +9,9 @@
 #include <algorithm>
 #include <utility>
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxge/render_defines.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fde/cfde_textout.h"
 #include "xfa/fgas/font/cfgas_fontmgr.h"
 #include "xfa/fgas/font/cfgas_gefont.h"
@@ -141,7 +141,7 @@
   pGraphics->SaveGraphState();
   pGraphics->SetStrokeColor(CXFA_GEColor(0xFF000000));
   static constexpr float kDashPattern[2] = {1, 1};
-  pGraphics->SetLineDash(0.0f, kDashPattern, FX_ArraySize(kDashPattern));
+  pGraphics->SetLineDash(0.0f, kDashPattern, pdfium::size(kDashPattern));
   pGraphics->StrokePath(&path, &matrix);
   pGraphics->RestoreGraphState();
 }
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index c4fccca..49cd2c4 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -9,9 +9,9 @@
 #include <algorithm>
 #include <utility>
 
-#include "core/fxcrt/fx_memory.h"
 #include "core/fxge/render_defines.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fwl/cfwl_edit.h"
 #include "xfa/fwl/cfwl_eventmouse.h"
 #include "xfa/fwl/cfwl_messagekey.h"
@@ -117,7 +117,7 @@
   pGS->SetStrokeColor(CXFA_GEColor(0xFF000000));
 
   static constexpr float kDashPattern[2] = {1, 1};
-  pGS->SetLineDash(0.0f, kDashPattern, FX_ArraySize(kDashPattern));
+  pGS->SetLineDash(0.0f, kDashPattern, pdfium::size(kDashPattern));
   pGS->SetLineWidth(0);
 
   CXFA_GEPath path;
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 594f87f..a638852 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -7,8 +7,8 @@
 #include "xfa/fxfa/cxfa_fwltheme.h"
 
 #include "core/fxcrt/fx_codepage.h"
-#include "core/fxcrt/fx_memory.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fde/cfde_textout.h"
 #include "xfa/fgas/font/cfgas_gefont.h"
 #include "xfa/fwl/cfwl_barcode.h"
@@ -63,7 +63,7 @@
 }
 
 bool CXFA_FWLTheme::LoadCalendarFont(CXFA_FFDoc* doc) {
-  for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts);
+  for (size_t i = 0; !m_pCalendarFont && i < pdfium::size(g_FWLTheme_CalFonts);
        ++i) {
     m_pCalendarFont =
         m_pApp->GetXFAFontMgr()->GetFont(doc, g_FWLTheme_CalFonts[i], 0);
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
index 1ce0493..05e22f7 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
@@ -6,9 +6,9 @@
 
 #include <vector>
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 
 TEST(CXFA_FMLexerTest, NullString) {
   WideStringView null_string;
@@ -170,7 +170,7 @@
             {L".#", TOKdotscream},
             {L".*", TOKdotstar}};
 
-  for (size_t i = 0; i < FX_ArraySize(op); ++i) {
+  for (size_t i = 0; i < pdfium::size(op); ++i) {
     auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(op[i].op);
     CXFA_FMToken token = lexer->NextToken();
     EXPECT_EQ(op[i].token, token.m_type);
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
index 894ea1a..ca109c7 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -8,8 +8,8 @@
 
 #include <utility>
 
-#include "core/fxcrt/fx_memory.h"
 #include "fxjs/xfa/cjx_object.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fxfa/cxfa_ffwidget.h"
 #include "xfa/fxfa/parser/cxfa_color.h"
 #include "xfa/fxfa/parser/cxfa_measurement.h"
@@ -27,7 +27,7 @@
         dashArray[1] = 2;
         dashArray[3] = 2;
       }
-      pGraphics->SetLineDash(0, dashArray, FX_ArraySize(dashArray));
+      pGraphics->SetLineDash(0, dashArray, pdfium::size(dashArray));
       break;
     }
     case XFA_AttributeValue::DashDotDot: {
@@ -37,7 +37,7 @@
         dashArray[3] = 2;
         dashArray[5] = 2;
       }
-      pGraphics->SetLineDash(0, dashArray, FX_ArraySize(dashArray));
+      pGraphics->SetLineDash(0, dashArray, pdfium::size(dashArray));
       break;
     }
     case XFA_AttributeValue::Dashed: {
@@ -45,7 +45,7 @@
       if (iCapType != XFA_AttributeValue::Butt)
         dashArray[1] = 2;
 
-      pGraphics->SetLineDash(0, dashArray, FX_ArraySize(dashArray));
+      pGraphics->SetLineDash(0, dashArray, pdfium::size(dashArray));
       break;
     }
     case XFA_AttributeValue::Dotted: {
@@ -53,7 +53,7 @@
       if (iCapType != XFA_AttributeValue::Butt)
         dashArray[1] = 2;
 
-      pGraphics->SetLineDash(0, dashArray, FX_ArraySize(dashArray));
+      pGraphics->SetLineDash(0, dashArray, pdfium::size(dashArray));
       break;
     }
     default:
diff --git a/xfa/fxfa/parser/xfa_utils_unittest.cpp b/xfa/fxfa/parser/xfa_utils_unittest.cpp
index 77f21bc..7cdbd74 100644
--- a/xfa/fxfa/parser/xfa_utils_unittest.cpp
+++ b/xfa/fxfa/parser/xfa_utils_unittest.cpp
@@ -4,8 +4,8 @@
 
 #include "xfa/fxfa/parser/xfa_utils.h"
 
-#include "core/fxcrt/fx_memory.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/stl_util.h"
 
 TEST(XfaUtilsImpTest, XFA_MapRotation) {
   struct TestCase {
@@ -17,7 +17,7 @@
                    {91, 91},       {359, 359},  {360, 0},   {361, 1},
                    {100000, 280}};
 
-  for (size_t i = 0; i < FX_ArraySize(TestCases); ++i) {
+  for (size_t i = 0; i < pdfium::size(TestCases); ++i) {
     EXPECT_EQ(TestCases[i].expected_output,
               XFA_MapRotation(TestCases[i].input));
   }
diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp
index ff6bac1..0f90986 100644
--- a/xfa/fxgraphics/cxfa_graphics.cpp
+++ b/xfa/fxgraphics/cxfa_graphics.cpp
@@ -14,6 +14,7 @@
 #include "core/fxge/cfx_unicodeencoding.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "xfa/fxgraphics/cxfa_gecolor.h"
 #include "xfa/fxgraphics/cxfa_gepath.h"
 #include "xfa/fxgraphics/cxfa_gepattern.h"
@@ -103,7 +104,7 @@
     }};
 
 const FX_HATCHDATA& GetHatchBitmapData(size_t index) {
-  return index < FX_ArraySize(kHatchBitmapData) ? kHatchBitmapData[index]
+  return index < pdfium::size(kHatchBitmapData) ? kHatchBitmapData[index]
                                                 : kHatchPlaceHolder;
 }