Replace defined(OS_APPLE) with BUILDFLAG(IS_APPLE).

Bug: chromium:1234043
Change-Id: I35f293235e7fad0547ca2aa8d377f9f2be9c43c6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/89230
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 19261b5..8981824 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -679,7 +679,7 @@
     uint16_t cid = CIDFromCharCode(charcode);
     wchar_t unicode = 0;
     if (m_bCIDIsGID) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       if (FontStyleIsSymbolic(m_Flags))
         return cid;
 
@@ -744,7 +744,7 @@
     if (m_Charset == CIDSET_JAPAN1) {
       if (unicode == '\\') {
         unicode = '/';
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
       } else if (unicode == 0xa5) {
         unicode = 0x5c;
 #endif
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index f8c8a28..77cbdcd 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -114,7 +114,7 @@
   return pString.GetLength();
 }
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) {
   return GlyphFromCharCode(charcode, nullptr);
 }
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 160d497..d92da3c 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -88,7 +88,7 @@
   virtual size_t CountChar(ByteStringView pString) const;
   virtual int AppendChar(char* buf, uint32_t charcode) const;
   virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   virtual int GlyphFromCharCodeExt(uint32_t charcode);
 #endif
   virtual WideString UnicodeFromCharCode(uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 51f0e88..0205b02 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -18,13 +18,13 @@
 #include "core/fxge/fx_font.h"
 #include "core/fxge/fx_freetype.h"
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 #include <Carbon/Carbon.h>
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 
 namespace {
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 struct GlyphNameMap {
   const char* m_pStrAdobe;    // Raw, POD struct.
   const char* m_pStrUnicode;  // Raw, POD struct.
@@ -44,7 +44,7 @@
   return nullptr;
 }
 
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 
 bool FT_UseType1Charmap(FXFT_FaceRec* face) {
   if (FXFT_Get_Face_CharmapCount(face) == 0) {
@@ -69,7 +69,7 @@
 CPDF_Type1Font::CPDF_Type1Font(CPDF_Document* pDocument,
                                CPDF_Dictionary* pFontDict)
     : CPDF_SimpleFont(pDocument, pFontDict) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   memset(m_ExtGID, 0xff, sizeof(m_ExtGID));
 #endif
 }
@@ -113,7 +113,7 @@
   return LoadCommon();
 }
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) {
   if (charcode > 0xff)
     return -1;
@@ -127,7 +127,7 @@
   if (!m_Font.GetFaceRec())
     return;
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   bool bCoreText = true;
   if (!m_Font.GetPlatformFont()) {
     if (m_Font.GetPsName() == "DFHeiStd-W5")
@@ -149,7 +149,7 @@
           uint16_t unicode = prefix[j] * 256 + charcode;
           m_GlyphIndex[charcode] =
               FT_Get_Char_Index(m_Font.GetFaceRec(), unicode);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
           CalcExtGID(charcode);
 #endif
           if (m_GlyphIndex[charcode]) {
@@ -159,7 +159,7 @@
         }
       }
       if (bGotOne) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         if (!bCoreText)
           memcpy(m_ExtGID, m_GlyphIndex, sizeof(m_ExtGID));
 #endif
@@ -179,18 +179,18 @@
       m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
       m_GlyphIndex[charcode] = FT_Get_Char_Index(
           m_Font.GetFaceRec(), m_Encoding.UnicodeFromCharCode(charcode));
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       CalcExtGID(charcode);
 #endif
       if (m_GlyphIndex[charcode] == 0 && strcmp(name, ".notdef") == 0) {
         m_Encoding.SetUnicode(charcode, 0x20);
         m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFaceRec(), 0x20);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         CalcExtGID(charcode);
 #endif
       }
     }
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     if (!bCoreText) {
       fxcrt::spancpy(pdfium::make_span(m_ExtGID),
                      pdfium::make_span(m_GlyphIndex));
@@ -199,7 +199,7 @@
     return;
   }
   FT_UseType1Charmap(m_Font.GetFaceRec());
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   if (bCoreText) {
     if (FontStyleIsSymbolic(m_Flags)) {
       for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
@@ -264,7 +264,7 @@
     }
     return;
   }
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
   if (FontStyleIsSymbolic(m_Flags)) {
     for (size_t charcode = 0; charcode < kInternalTableSize; charcode++) {
       const char* name =
@@ -290,7 +290,7 @@
         }
       }
     }
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     if (!bCoreText)
       memcpy(m_ExtGID, m_GlyphIndex, sizeof(m_ExtGID));
 #endif
@@ -318,7 +318,7 @@
       m_GlyphIndex[charcode] = 0xffff;
     }
   }
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   if (!bCoreText)
     memcpy(m_ExtGID, m_GlyphIndex, sizeof(m_ExtGID));
 #endif
@@ -334,7 +334,7 @@
          CFX_FontMapper::IsFixedFont(m_Base14Font.value());
 }
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 void CPDF_Type1Font::SetExtGID(const char* name, uint32_t charcode) {
   CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
       kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
@@ -351,4 +351,4 @@
   name_glyph[kInternalTableSize - 1] = 0;
   SetExtGID(name_glyph, charcode);
 }
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
diff --git a/core/fpdfapi/font/cpdf_type1font.h b/core/fpdfapi/font/cpdf_type1font.h
index a0094a7..0f68f43 100644
--- a/core/fpdfapi/font/cpdf_type1font.h
+++ b/core/fpdfapi/font/cpdf_type1font.h
@@ -23,7 +23,7 @@
   bool IsType1Font() const override;
   const CPDF_Type1Font* AsType1Font() const override;
   CPDF_Type1Font* AsType1Font() override;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   int GlyphFromCharCodeExt(uint32_t charcode) override;
 #endif
 
@@ -41,7 +41,7 @@
   bool IsSymbolicFont() const;
   bool IsFixedFont() const;
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   void SetExtGID(const char* name, uint32_t charcode);
   void CalcExtGID(uint32_t charcode);
 
diff --git a/core/fpdfapi/page/cpdf_transferfuncdib.cpp b/core/fpdfapi/page/cpdf_transferfuncdib.cpp
index 01dbb06..96ddbf0 100644
--- a/core/fpdfapi/page/cpdf_transferfuncdib.cpp
+++ b/core/fpdfapi/page/cpdf_transferfuncdib.cpp
@@ -63,7 +63,7 @@
           m_Scanline[index++] = g0;
           m_Scanline[index++] = r0;
         }
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         index++;
 #endif
       }
@@ -97,7 +97,7 @@
           m_Scanline[index++] = m_RampR[src_byte];
         }
         src_buf++;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         index++;
 #endif
       }
@@ -115,7 +115,7 @@
         m_Scanline[index++] = m_RampB[*(src_buf++)];
         m_Scanline[index++] = m_RampG[*(src_buf++)];
         m_Scanline[index++] = m_RampR[*(src_buf++)];
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         index++;
 #endif
       }
@@ -132,7 +132,7 @@
         m_Scanline[index++] = m_RampR[*(src_buf++)];
         if (!bSkip) {
           m_Scanline[index++] = *src_buf;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         } else {
           index++;
 #endif
diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
index fda5ed9..940121e 100644
--- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
@@ -136,7 +136,7 @@
 TEST_F(CPDFSecurityHandlerEmbedderTest, PasswordAfterGenerateSave) {
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kChecksum[] = "c3c4fc0032f5d252327bf52d29a074fa";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "2a308e8cc20a6221112c387d122075a8";
 #else
   const char kChecksum[] = "9fe7eef8e51d15a604001854be6ed1ee";
diff --git a/core/fpdfapi/render/charposlist.cpp b/core/fpdfapi/render/charposlist.cpp
index 26df52c..6c171d2 100644
--- a/core/fpdfapi/render/charposlist.cpp
+++ b/core/fpdfapi/render/charposlist.cpp
@@ -37,7 +37,7 @@
     text_char_pos.m_GlyphIndex =
         font->GlyphFromCharCode(char_code, &is_vertical_glyph);
     uint32_t glyph_id = text_char_pos.m_GlyphIndex;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     text_char_pos.m_ExtGID = font->GlyphFromCharCodeExt(char_code);
     glyph_id = text_char_pos.m_ExtGID != static_cast<uint32_t>(-1)
                    ? text_char_pos.m_ExtGID
@@ -73,7 +73,7 @@
     if (use_fallback_font) {
       current_font =
           font->GetFontFallback(text_char_pos.m_FallbackFontPosition);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       text_char_pos.m_ExtGID = text_char_pos.m_GlyphIndex;
 #endif
     } else {
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp
index 08ca657..2c27370 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -17,7 +17,7 @@
 
 namespace {
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 constexpr bool kScaleDeviceBuffer = false;
 #else
 constexpr bool kScaleDeviceBuffer = true;
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 5ec9419..bca567d 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1402,7 +1402,7 @@
   int width = pClipRect->right - pClipRect->left;
   int height = pClipRect->bottom - pClipRect->top;
   FXDIB_Format format;
-#if defined(OS_APPLE) || defined(_SKIA_SUPPORT_) || \
+#if BUILDFLAG(IS_APPLE) || defined(_SKIA_SUPPORT_) || \
     defined(_SKIA_SUPPORT_PATHS_)
   format = bLuminosity ? FXDIB_Format::kRgb32 : FXDIB_Format::k8bppMask;
 #else
diff --git a/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp b/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
index 13c3567..e337aeb 100644
--- a/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
+++ b/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
@@ -25,7 +25,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 static constexpr char kAnnotationStampWithApBaseContentChecksum[] =
     "1a6cb54b1cfc5bb9f6ec3923a52ea7cc";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 static constexpr char kAnnotationStampWithApBaseContentChecksum[] =
     "243f3d6267d9db09198fed9f8c4957fd";
 #else
@@ -315,7 +315,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static constexpr char kContentWithTextChecksum[] =
       "6bbe5a547115b4aa30b49fe7c34030e3";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kContentWithTextChecksum[] =
       "ee4ec12f54ce8d117a73bd9b85a8954d";
 #else
@@ -386,13 +386,13 @@
   static constexpr char kContentWithHighlightFillChecksum[] =
       "fa25846c61d0253e86e8512d3be06ebb";
 #else
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static constexpr char kContentWithHighlightFillChecksum[] =
       "a820afec9b99d3d3f2e9e9382bbad7c1";
 #else
   static constexpr char kContentWithHighlightFillChecksum[] =
       "a08a0639f89446f66f3689ee8e08b9fe";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 
   ASSERT_TRUE(OpenDocument("annotation_highlight_square_with_ap.pdf"));
@@ -419,7 +419,7 @@
 // Note: The stroke color rendered for highlight is different from the normal
 // path since highlights have Multiply blend mode, while the other path has
 // Normal blend mode.
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static constexpr char kMD5ContentWithHighlight[] =
       "8837bea0b3520164b1784e513c882a2d";
 #else
@@ -446,13 +446,13 @@
 TEST_F(FPDFProgressiveRenderEmbedderTest, MAYBE_RenderInkWithColorScheme) {
 // Test rendering of multiple ink with forced color scheme on.
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static constexpr char kContentWithInkChecksum[] =
       "ebc57721e4c8da34156e09b9b2e62fb0";
 #else
   static constexpr char kContentWithInkChecksum[] =
       "b39d9f68ff71963d82c43eb20caa8f4d";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #else
 #if BUILDFLAG(IS_WIN)
   static constexpr char kContentWithInkChecksum[] =
@@ -475,7 +475,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static constexpr char kContentWithStampChecksum[] =
       "bdcd2b91223b1a73582b341d0153a73f";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kContentWithStampChecksum[] =
       "7a209e29caeeab7d2b25b34570a4ace6";
 #else
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index e0688bf..faa681e 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -21,12 +21,12 @@
 
 namespace {
 
-#if defined(OS_APPLE) || BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN)
 WideString ChangeSlashToPlatform(const wchar_t* str) {
   WideString result;
   while (*str) {
     if (*str == '/') {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       result += L':';
 #else
       result += L'\\';
@@ -51,7 +51,7 @@
   }
   return result;
 }
-#endif  // defined(OS_APPLE) || BUILDFLAG(IS_WIN)
+#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN)
 
 }  // namespace
 
@@ -70,7 +70,7 @@
   if (filepath.GetLength() <= 1)
     return WideString();
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   if (filepath.First(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
     return ChangeSlashToPlatform(filepath.c_str() + 1);
   return ChangeSlashToPlatform(filepath.c_str());
@@ -191,7 +191,7 @@
   if (filepath[0] == L'\\')
     return L'/' + ChangeSlashToPDF(filepath.c_str());
   return ChangeSlashToPDF(filepath.c_str());
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   if (filepath.First(sizeof("Mac") - 1).EqualsASCII("Mac"))
     return L'/' + ChangeSlashToPDF(filepath.c_str());
   return ChangeSlashToPDF(filepath.c_str());
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 0f23a41..aef0810 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -35,7 +35,7 @@
     {L"\\\\pdfdocs\\spec.pdf", L"/pdfdocs/spec.pdf"},
 // Network resource name. It is not supported yet.
 // {L"pclib/eng:\\pdfdocs\\spec.pdf", L"/pclib/eng/pdfdocs/spec.pdf"},
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     // Absolute path with colon separator.
     {L"Mac HD:PDFDocs:spec.pdf", L"/Mac HD/PDFDocs/spec.pdf"},
     // Relative path with colon separator.
@@ -65,7 +65,7 @@
 #if BUILDFLAG(IS_WIN)
       L"/C/docs/test.pdf",
       L"C:\\docs\\test.pdf"
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
       L"/Mac HD/docs/test.pdf",
       L"Mac HD:docs:test.pdf"
 #else
@@ -86,7 +86,7 @@
       {L"/E/docs/test.pdf", L"E:\\docs\\test.pdf"},
       {L"/F/docs/test.pdf", L"F:\\docs\\test.pdf"},
       {L"/G/docs/test.pdf", L"G:\\docs\\test.pdf"},
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
       {L"/Mac HD/docs1/test.pdf", L"Mac HD:docs1:test.pdf"},
       {L"/Mac HD/docs2/test.pdf", L"Mac HD:docs2:test.pdf"},
       {L"/Mac HD/docs3/test.pdf", L"Mac HD:docs3:test.pdf"},
@@ -141,7 +141,7 @@
 #if BUILDFLAG(IS_WIN)
     L"C:\\docs\\test.pdf",
     L"/C/docs/test.pdf"
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     L"Mac HD:docs:test.pdf",
     L"/Mac HD/docs/test.pdf"
 #else
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index 98c8c6a..9612025 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -45,11 +45,11 @@
 constexpr size_t kBlockSize = 4096;
 
 #ifdef PDF_ENABLE_XFA_PNG
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 const double kPngGamma = 1.7;
 #else
 const double kPngGamma = 2.2;
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #endif  // PDF_ENABLE_XFA_PNG
 
 void RGB2BGR(uint8_t* buffer, int width = 1) {
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index e919275..bedddfd 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -11,7 +11,7 @@
 #include "third_party/base/check.h"
 
 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
-    defined(OS_APPLE) || defined(OS_ASMJS)
+    BUILDFLAG(IS_APPLE) || defined(OS_ASMJS)
 #include <sys/time.h>
 #include <time.h>
 #endif
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index c5ecc59..80370b5 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -1691,7 +1691,7 @@
   EXPECT_EQ(L"cla", WideString::Format(L"%.3ls", L"clams"));
   EXPECT_EQ(L"\u043e\u043f", WideString(L"\u043e\u043f"));
 
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
   // See https://bugs.chromium.org/p/pdfium/issues/detail?id=1132
   EXPECT_EQ(L"\u043e\u043f", WideString::Format(L"\u043e\u043f"));
   EXPECT_EQ(L"\u043e\u043f", WideString::Format(L"%ls", L"\u043e\u043f"));
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 7b2d476..5dcd97b 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1029,7 +1029,7 @@
   DestroyPlatform();
 }
 
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
 void CFX_AggDeviceDriver::InitPlatform() {}
 
 void CFX_AggDeviceDriver::DestroyPlatform() {}
@@ -1043,7 +1043,7 @@
                                          const CFX_TextRenderOptions& options) {
   return false;
 }
-#endif  // !defined(OS_APPLE)
+#endif  // !BUILDFLAG(IS_APPLE)
 
 DeviceType CFX_AggDeviceDriver::GetDeviceType() const {
   return DeviceType::kDisplay;
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 51fe418..e408408 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -107,7 +107,7 @@
   RetainPtr<CFX_DIBitmap> const m_pBitmap;
   std::unique_ptr<CFX_ClipRgn> m_pClipRgn;
   std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   void* m_pPlatformGraphics = nullptr;
 #endif
   CFX_FillRenderOptions m_FillOptions;
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 771851c..c08fe96 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -361,7 +361,7 @@
   m_FontData = {};  // m_FontData can't outive m_Face.
   m_Face.Reset();
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   ReleasePlatformResource();
 #endif
 }
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index a45fc3b..b506f36 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -140,7 +140,7 @@
   bool IsSubstFontBold() const;
 #endif
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   void* GetPlatformFont() const { return m_pPlatformFont; }
   void SetPlatformFont(void* font) { m_pPlatformFont = font; }
 #endif
@@ -148,7 +148,7 @@
  private:
   RetainPtr<CFX_GlyphCache> GetOrCreateGlyphCache() const;
   void ClearGlyphCache();
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   void ReleasePlatformResource();
 #endif
   ByteString GetFamilyNameOrUntitled() const;
@@ -169,7 +169,7 @@
   uint64_t m_ObjectTag = 0;
   bool m_bEmbedded = false;
   bool m_bVertical = false;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   void* m_pPlatformFont = nullptr;
 #endif
 };
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 56b393e..35bd091 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -604,7 +604,7 @@
       }
     } else {
       if (Charset == FX_Charset::kSymbol) {
-#if defined(OS_APPLE) || defined(OS_ANDROID)
+#if BUILDFLAG(IS_APPLE) || defined(OS_ANDROID)
         if (SubstName == "Symbol") {
           pSubstFont->m_Family = "Chrome Symbol";
           pSubstFont->m_Charset = FX_Charset::kSymbol;
diff --git a/core/fxge/cfx_gemodule.h b/core/fxge/cfx_gemodule.h
index 47e23ec..6c7caae 100644
--- a/core/fxge/cfx_gemodule.h
+++ b/core/fxge/cfx_gemodule.h
@@ -13,7 +13,7 @@
 
 #include "build/build_config.h"
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 #include "third_party/base/span.h"
 #endif
 
@@ -31,7 +31,7 @@
     virtual void Init() = 0;
     virtual std::unique_ptr<SystemFontInfoIface>
     CreateDefaultSystemFontInfo() = 0;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     virtual void* CreatePlatformFont(pdfium::span<const uint8_t> font_span) = 0;
 #endif
   };
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index 82fa8d4..49abaeb 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -36,7 +36,7 @@
 #endif
 #endif
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 #include "core/fxge/cfx_textrenderoptions.h"
 #endif
 
@@ -253,7 +253,7 @@
     return nullptr;
 
   UniqueKeyGen keygen;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   const bool bNative = text_options->native_text;
 #else
   const bool bNative = false;
@@ -261,7 +261,7 @@
   GenKey(&keygen, pFont, matrix, dest_width, anti_alias, bNative);
   ByteString FaceGlyphsKey(keygen.key_, keygen.key_len_);
 
-#if defined(OS_APPLE) && !defined(_SKIA_SUPPORT_) && \
+#if BUILDFLAG(IS_APPLE) && !defined(_SKIA_SUPPORT_) && \
     !defined(_SKIA_SUPPORT_PATHS_)
   const bool bDoLookUp = !text_options->native_text;
 #else
@@ -272,7 +272,7 @@
                              bFontStyle, dest_width, anti_alias);
   }
 
-#if defined(OS_APPLE) && !defined(_SKIA_SUPPORT_) && \
+#if BUILDFLAG(IS_APPLE) && !defined(_SKIA_SUPPORT_) && \
     !defined(_SKIA_SUPPORT_PATHS_)
   std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap;
   auto it = m_SizeMap.find(FaceGlyphsKey);
@@ -329,7 +329,7 @@
 }
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
 void CFX_GlyphCache::InitPlatform() {}
 #endif
 
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index dd472d5..1606a05 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -301,7 +301,7 @@
 
 bool ShouldDrawDeviceText(const CFX_Font* pFont,
                           const CFX_TextRenderOptions& options) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   if (options.font_is_cid)
     return false;
 
diff --git a/core/fxge/dib/cfx_dibbase.h b/core/fxge/dib/cfx_dibbase.h
index 4052f41..aebdb03 100644
--- a/core/fxge/dib/cfx_dibbase.h
+++ b/core/fxge/dib/cfx_dibbase.h
@@ -23,12 +23,12 @@
 // Base class for all Device-Independent Bitmaps.
 class CFX_DIBBase : public Retainable {
  public:
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   // Matches Apple's kCGBitmapByteOrder32Little in fx_quartz_device.cpp.
   static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kRgb32;
-#else   // defined(OS_APPLE)
+#else   // BUILDFLAG(IS_APPLE)
   static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kRgb;
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 
   ~CFX_DIBBase() override;
 
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 5c1adcd..4f9cd05 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -944,7 +944,7 @@
       m_charDetails.SetGlyphAt(cur_index,
                                static_cast<uint16_t>(cp.m_GlyphIndex));
       m_charDetails.SetFontCharWidthAt(cur_index, cp.m_FontCharWidth);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       if (cp.m_ExtGID) {
         m_charDetails.SetGlyphAt(cur_index, static_cast<uint16_t>(cp.m_ExtGID));
       }
@@ -1750,7 +1750,7 @@
       }
     }
     glyphs[index] = static_cast<uint16_t>(cp.m_GlyphIndex);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     if (cp.m_ExtGID)
       glyphs[index] = static_cast<uint16_t>(cp.m_ExtGID);
 #endif
diff --git a/core/fxge/text_char_pos.h b/core/fxge/text_char_pos.h
index b28d249..6be2671 100644
--- a/core/fxge/text_char_pos.h
+++ b/core/fxge/text_char_pos.h
@@ -20,7 +20,7 @@
   uint32_t m_Unicode = 0;
   uint32_t m_GlyphIndex = 0;
   int m_FontCharWidth = 0;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   uint32_t m_ExtGID = 0;
 #endif
   int32_t m_FallbackFontPosition = 0;
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index fcdef5b..2f3d08a 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -544,9 +544,9 @@
     EXPECT_EQ(681.535034f, rect.top);
   }
   {
-#if defined(_SKIA_SUPPORT_) && defined(OS_APPLE)
+#if defined(_SKIA_SUPPORT_) && BUILDFLAG(IS_APPLE)
     static constexpr char kExpectedHash[] = "fad91b9c968fe8019a774f5e2419b8fc";
-#elif defined(_SKIA_SUPPORT_PATHS_) && defined(OS_APPLE)
+#elif defined(_SKIA_SUPPORT_PATHS_) && BUILDFLAG(IS_APPLE)
     static constexpr char kExpectedHash[] = "acddfe688a117ead56af7b249a2cf8a1";
 #elif defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static constexpr char kExpectedHash[] = "1fb0dd8dd5f0b9bb8d076e48eb59296d";
@@ -771,9 +771,9 @@
   UnloadPage(page);
 
   // Open the saved document.
-#if defined(_SKIA_SUPPORT_) && defined(OS_APPLE)
+#if defined(_SKIA_SUPPORT_) && BUILDFLAG(IS_APPLE)
   static const char kChecksum[] = "899387ae792390cd0d83cf7e2bbebfb5";
-#elif defined(_SKIA_SUPPORT_PATHS_) && defined(OS_APPLE)
+#elif defined(_SKIA_SUPPORT_PATHS_) && BUILDFLAG(IS_APPLE)
   static const char kChecksum[] = "e40e235ee35f47ff28dda009aaaf36df";
 #elif defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static const char kChecksum[] = "798fa41303381c9ba6d99092f5cd4d2b";
@@ -910,7 +910,7 @@
   static const char kMd5ModifiedHighlight[] =
       "66f3caef3a7d488a4fa1ad37fc06310e";
   static const char kMd5ModifiedSquare[] = "a456dad0bc6801ee2d6408a4394af563";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static const char kMd5Original[] = "fc59468d154f397fd298c69f47ef565a";
   static const char kMd5ModifiedHighlight[] =
       "e64bf648f6e9354d1f3eedb47a2c9498";
@@ -1118,7 +1118,7 @@
   static const char kMd5ModifiedPath[] = "b820e4ae359db95cbac9823937c6da1a";
   static const char kMd5TwoPaths[] = "c53837b7bb6a9a21a846aa786526aa56";
   static const char kMd5NewAnnot[] = "4f0f4217156e4251036f369184a48967";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static const char kMd5ModifiedPath[] = "e31421f86c61d4e9cda138f15f561ca3";
   static const char kMd5TwoPaths[] = "58d932492f9d485d6a4bc0ba76c04557";
   static const char kMd5NewAnnot[] = "61f9ad13f2fd235753db198cf9704773";
@@ -1331,7 +1331,7 @@
   static const char kMd5NewImage[] = "beb7db3647706d7fe4689f92073847aa";
   static const char kMd5ModifiedImage[] = "baa9b065469268e215ef958fe6987d6b";
 #else
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static const char kMd5NewImage[] = "c6fcbceb2f079bef10458ac60db3a10c";
   static const char kMd5ModifiedImage[] = "8068eb568e5c1c5fbe84e98f7a980ac3";
 #else
@@ -1415,7 +1415,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static const char kMd5NewText[] = "310d9de5f17fb288fb243f5dbaf2b6dc";
   static const char kMd5ModifiedText[] = "22be42c136c3bf5a8ecea3dd83770a02";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static const char kMd5NewText[] = "57a0fb3fba33e17de26bcde4c40b9a75";
   static const char kMd5ModifiedText[] = "072574999f2e3f36774ee0b5bc94d4dd";
 #else
@@ -1551,7 +1551,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static const char kMd5[] = "aa0e47d966c60d59102a2466542e0e46";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static const char kMd5[] = "cd90315b250dfe08265ce0ac335c5f76";
 #else
   static const char kMd5[] = "c4fb6911f2a87f490be196f8898de738";
@@ -3013,7 +3013,7 @@
   {
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static const char kMd5sum[] = "b4c8f1dab175508810c476d078ebc5a6";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     static const char kMd5sum[] = "108a46c517c4eaace9982ee83e8e3296";
 #else
     static const char kMd5sum[] = "5550d8dcb4d1af1f50e8b4bcaef2ee60";
@@ -3039,7 +3039,7 @@
   {
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static const char kMd5sum[] = "9173db3a892bc1697eef5cdaed19eda6";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     static const char kMd5sum[] = "eb3869335e7a219e1b5f25c1c6037b97";
 #else
     static const char kMd5sum[] = "805fe7bb751ac4ed2b82bb66efe6db40";
@@ -3056,7 +3056,7 @@
   {
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static const char kMd5sum[] = "174dbdb218c2b14011c9c1db67fe41c3";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     static const char kMd5sum[] = "d20b1978da2362d3942ea0fc6d230997";
 #else
     static const char kMd5sum[] = "c5c5dcb462af3ef5f43b298ec048feef";
@@ -3566,7 +3566,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   constexpr char kOriginalChecksum[] = "4f35703e89202bcc8419ca2df739bb4e";
   constexpr char kModifiedChecksum[] = "cee0a1b41f33d487af8fb70c4c82e3c9";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   constexpr char kOriginalChecksum[] = "522a4a6b6c7eab5bf95ded1f21ea372e";
   constexpr char kModifiedChecksum[] = "6844019e07b83cc01723415f58218d06";
 #else
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index ee755a4..d49633fa 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -45,7 +45,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 static constexpr char kBottomTextChecksum[] =
     "84461cd5d952b6ae3d57a5070da84e19";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 static constexpr char kBottomTextChecksum[] =
     "81636489006a31fcb00cf29efcdf7909";
 #else
@@ -55,7 +55,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 const char kFirstRemovedChecksum[] = "f46cbf12eb4e9bbdc3a5d8e1f2103446";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const char kFirstRemovedChecksum[] = "a1dc2812692fcc7ee4f01ca77435df9d";
 #else
 const char kFirstRemovedChecksum[] = "e1477dc3b5b3b9c560814c4d1135a02b";
@@ -65,7 +65,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 const char kLoadedFontTextChecksum[] = "fc2334c350cbd0d2ae6076689da09741";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const char kLoadedFontTextChecksum[] = "0f3e4a7d71f9e7eb8a1a0d69403b9848";
 #else
 const char kLoadedFontTextChecksum[] = "d58570cc045dfb818b92cbabbd1a364c";
@@ -261,11 +261,11 @@
   EXPECT_TRUE(FPDFPage_GenerateContent(page.get()));
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "9a31fb87d1c6d2346bba22d1196041cd";
-#else   // defined(OS_APPLE)
+#else   // BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "5bb65e15fc0a685934cd5006dec08a76";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #else   // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kChecksum[] = "9a31fb87d1c6d2346bba22d1196041cd";
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
@@ -306,11 +306,11 @@
   EXPECT_TRUE(FPDFPage_GenerateContent(page.get()));
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "9a31fb87d1c6d2346bba22d1196041cd";
-#else   // defined(OS_APPLE)
+#else   // BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "5bb65e15fc0a685934cd5006dec08a76";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #else   // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kChecksum[] = "9a31fb87d1c6d2346bba22d1196041cd";
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
@@ -735,7 +735,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kChangedChecksum[] = "49c8602cb60508009a34d0caaac63bb4";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kChangedChecksum[] = "b720e83476fd6819d47c533f1f43c728";
 #else
   const char kChangedChecksum[] = "9a85b9354a69c61772ed24151c140f46";
@@ -793,7 +793,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static constexpr char kOriginalChecksum[] =
       "92ff84385a0f986eacfa4bbecf8d7a7a";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kOriginalChecksum[] =
       "ae7a25c85e0e2dd0c5cb9dd5cd37f6df";
 #else
@@ -861,7 +861,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   static constexpr char kOriginalChecksum[] =
       "1e022a0360f053ecb41cc431a36834a6";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kOriginalChecksum[] =
       "1226bc2b8072622eb28f52321876e814";
 #else
@@ -1065,7 +1065,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static constexpr char kOriginalChecksum[] =
         "8a8bed7820764522955f422e27f4292f";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     static constexpr char kOriginalChecksum[] =
         "966579fb98206858ce2f0a1f94a74d05";
 #else
@@ -1114,7 +1114,7 @@
       "1573b85dd9a2c59401c1c30abbee3b25";
   static constexpr char kNonPrimesAfterSaveChecksum[] =
       "1573b85dd9a2c59401c1c30abbee3b25";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kNonPrimesChecksum[] =
       "6e19a4dd674b522cd39cf41956559bd6";
   static constexpr char kNonPrimesAfterSaveChecksum[] =
@@ -1400,7 +1400,7 @@
   ASSERT_EQ(2, FPDFPage_CountObjects(page));
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kHelloRemovedChecksum[] = "fc2a40a3d1edfe6e972be104b5ae87ad";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kHelloRemovedChecksum[] = "5508c2f06d104050f74f655693e38c2c";
 #else
   const char kHelloRemovedChecksum[] = "a8cd82499cf744e0862ca468c9d4ceb8";
@@ -1558,7 +1558,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kStream1RemovedChecksum[] = "7fe07f182b37d40afc6ae36a4e89fe73";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kStream1RemovedChecksum[] = "3cdc75af44c15bed80998facd6e674c9";
 #else
   const char kStream1RemovedChecksum[] = "b474826df1acedb05c7b82e1e49e64a6";
@@ -2070,7 +2070,7 @@
   ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kChecksum[] = "3490f699d894351a554d79e1fcdf7981";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kChecksum[] = "279693baca9f48da2d75a8e289aed58e";
 #else
   const char kChecksum[] = "fe415d47945c10b9cc8e9ca08887369e";
@@ -2261,7 +2261,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static constexpr char md5[] = "fa64eb3808b541342496281277fad5f2";
 #else
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     static constexpr char md5[] = "983baaa1f688eff7a14b1bf91c171a1a";
 #else
     static constexpr char md5[] = "161523e196eb5341604cd73e12c97922";
@@ -2286,7 +2286,7 @@
     ScopedFPDFBitmap page_bitmap = RenderPage(page.get());
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
     static constexpr char md5[] = "abc65660389911aab95550ca8cd97a2b";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
     static constexpr char md5[] = "e0b3493c5c16e41d0d892ffb48e63fba";
 #else
     static constexpr char md5[] = "1fbf772dca8d82b960631e6683934964";
@@ -2367,7 +2367,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kOriginalChecksum[] = "bf87e8b36380ebd96ca429213fa23a09";
   const char kStrokeChecksum[] = "d16eb1bb4748eeb5fb801594da70d519";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kOriginalChecksum[] = "c488514ce0fc949069ff560407edacd2";
   const char kStrokeChecksum[] = "e06ee84aeebe926e8c980b7822027e8a";
 #else
@@ -2602,7 +2602,7 @@
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kOrigChecksum[] = "e15086e54078e4d22fa3fb12105c579e";
   const char kNewChecksum[] = "7282fe98693c0a7ad2c1b3f3f9563977";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kOrigChecksum[] = "a637057185f50aac1aa5490f726aef95";
   const char kNewChecksum[] = "8ad9d79b02b609ff734e2a2195c96e2d";
 #else
@@ -3009,7 +3009,7 @@
   ScopedFPDFBitmap page_bitmap2 = RenderPage(page);
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kInsertTrueTypeChecksum[] = "4f9a6c7752ac7d4e4c731260fdb5af15";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kInsertTrueTypeChecksum[] = "c7e2271a7f30e5b919a13ead47cea105";
 #else
   const char kInsertTrueTypeChecksum[] = "683f4a385a891494100192cb338b11f0";
diff --git a/fpdfsdk/fpdf_flatten_embeddertest.cpp b/fpdfsdk/fpdf_flatten_embeddertest.cpp
index e815193..8eb7737 100644
--- a/fpdfsdk/fpdf_flatten_embeddertest.cpp
+++ b/fpdfsdk/fpdf_flatten_embeddertest.cpp
@@ -43,13 +43,13 @@
   static constexpr char kCheckboxChecksum[] =
       "95fdaa000e81c80892b8d370f77be970";
 #else
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static constexpr char kCheckboxChecksum[] =
       "6aafcb2d98da222964bcdbf5aa1f4f1f";
 #else
   static constexpr char kCheckboxChecksum[] =
       "594265790b81df2d93120d33b72a6ada";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 
   ASSERT_TRUE(OpenDocument("bug_861842.pdf"));
@@ -74,7 +74,7 @@
   static constexpr char kPageHash[] = "1ce2e06c12972973b8f04a2f79245313";
   static constexpr char kFlattenedPageHash[] =
       "e03b1b8157c30c77ea94f9c24dc85a00";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static constexpr char kPageHash[] = "049ed3f1e21fc72f929af3410c64bc8f";
   static constexpr char kFlattenedPageHash[] =
       "41debc60cf2a8f74c710ec6082d77b18";
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index a85a14e..2dcfcd7 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -1324,7 +1324,7 @@
       "199536b979a42da3c2745297f6e87a77";
   const char kUnfocusedTextFormWithAbcChecksum[] =
       "574aa06445957315f0dadd24a0c59811";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kFocusedTextFormWithAbcChecksum[] =
       "9fb14198d75ca0a107060c60ca21b0c7";
   const char kUnfocusedTextFormWithAbcChecksum[] =
@@ -1408,7 +1408,7 @@
 TEST_F(FPDFFormFillEmbedderTest, RemoveFormFieldHighlight) {
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   const char kMd5NoHighlight[] = "013aa241c39c02505d9525550be04e48";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   const char kMd5NoHighlight[] = "5c82aa43e3b478aa1e4c94bb9ef1f11f";
 #else
   const char kMd5NoHighlight[] = "a6268304f7eedfa9ee98fac3caaf2efb";
@@ -3122,7 +3122,7 @@
   CheckSelection(L"");
 
   // Select all with the keyboard shortcut.
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   constexpr int kCorrectModifier = FWL_EVENTFLAG_MetaKey;
 #else
   constexpr int kCorrectModifier = FWL_EVENTFLAG_ControlKey;
@@ -3136,7 +3136,7 @@
   CheckSelection(L"");
 
   // Select all with the keyboard shortcut using the wrong modifier key.
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   constexpr int kWrongModifier = FWL_EVENTFLAG_ControlKey;
 #else
   constexpr int kWrongModifier = FWL_EVENTFLAG_MetaKey;
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 8a08202..2c1706d 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -1275,7 +1275,7 @@
 // only disable native text support on macOS. Therefore Windows and Linux
 // rendering results remain the same as rendering with no flags, while the macOS
 // rendering result doesn't.
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   static const char kOriginalChecksum[] = "0e339d606aafb63077f49e238dc27cb0";
   static const char kNoNativeTextChecksum[] =
       "288502887ffc63291f35a0573b944375";
@@ -1283,7 +1283,7 @@
   static const char kOriginalChecksum[] = "288502887ffc63291f35a0573b944375";
   static const char kNoNativeTextChecksum[] =
       "288502887ffc63291f35a0573b944375";
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 #endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
   ASSERT_TRUE(OpenDocument("bug_664284.pdf"));
   FPDF_PAGE page = LoadPage(0);
@@ -1406,7 +1406,7 @@
   static const char kLcdTextChecksum[] = "fea3e59b7ac7b7a6940018497034f6cf";
   static const char kNoSmoothtextChecksum[] =
       "c4173cf724618e5b68efb74543519bb9";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   static const char kLcdTextChecksum[] = "6eef7237f7591f07616e238422086737";
   static const char kNoSmoothtextChecksum[] =
       "6eef7237f7591f07616e238422086737";
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 087cfad..88ce67a 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -126,7 +126,7 @@
 
 // static
 bool CPWL_Wnd::IsPlatformShortcutKey(Mask<FWL_EVENTFLAG> nFlag) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   return IsMETAKeyDown(nFlag);
 #else
   return IsCTRLKeyDown(nFlag);
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 6b5b82a..69759ac 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -148,7 +148,7 @@
   charPos[0].m_Origin = CFX_PointF(penX + left, penY + top);
   charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charcodes[0]);
   charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
 #endif
   penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f;
@@ -156,7 +156,7 @@
     charPos[i].m_Origin = CFX_PointF(penX + left, penY + top);
     charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(charcodes[i]);
     charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
 #endif
     penX += (float)(charPos[i].m_FontCharWidth) * (float)fontSize / 1000.0f;
diff --git a/testing/embedder_test_constants.cpp b/testing/embedder_test_constants.cpp
index e0cf56a..d72b7ec 100644
--- a/testing/embedder_test_constants.cpp
+++ b/testing/embedder_test_constants.cpp
@@ -12,7 +12,7 @@
 const char kAnnotationStampWithApChecksum[] =
     "e4e7dc6446fa763a245e03eb5de6ed28";
 #else
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 const char kAnnotationStampWithApChecksum[] =
     "d243b5d64752be0f45b86df7bd2e2708";
 #else
@@ -31,7 +31,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 const char kHelloWorldChecksum[] = "fea3e59b7ac7b7a6940018497034f6cf";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const char kHelloWorldChecksum[] = "6eef7237f7591f07616e238422086737";
 #else
 const char kHelloWorldChecksum[] = "c1c548442e0e0f949c5550d89bf8ae3b";
@@ -39,7 +39,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 const char kHelloWorldRemovedChecksum[] = "e51fe51cc5f03ad66f603030df9b0400";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const char kHelloWorldRemovedChecksum[] = "6e1cae48a2e35c521dee4ca502f48af6";
 #else
 const char kHelloWorldRemovedChecksum[] = "4a9b80f675f7f3bf2da1b02f12449e4b";
@@ -55,7 +55,7 @@
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
 const char kTextFormChecksum[] = "f8f0817b19ef07d0404caf008964b7f2";
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const char kTextFormChecksum[] = "fa2bf756942a950101fc147fc4ef3f82";
 #else
 const char kTextFormChecksum[] = "6f86fe1dbed5965d91aec6e0b829e29f";
diff --git a/third_party/base/allocator/partition_allocator/address_space_randomization.h b/third_party/base/allocator/partition_allocator/address_space_randomization.h
index 4f04f34..620028c 100644
--- a/third_party/base/allocator/partition_allocator/address_space_randomization.h
+++ b/third_party/base/allocator/partition_allocator/address_space_randomization.h
@@ -70,7 +70,7 @@
       return 0x80000000ULL;
     }
 
-  #elif defined(OS_APPLE)
+  #elif BUILDFLAG(IS_APPLE)
 
     // macOS as of 10.12.5 does not clean up entries in page map levels 3/4
     // [PDP/PML4] created from mmap or mach_vm_allocate, even after the region
diff --git a/third_party/base/allocator/partition_allocator/page_allocator_constants.h b/third_party/base/allocator/partition_allocator/page_allocator_constants.h
index 4a91a0f..f13e518 100644
--- a/third_party/base/allocator/partition_allocator/page_allocator_constants.h
+++ b/third_party/base/allocator/partition_allocator/page_allocator_constants.h
@@ -10,7 +10,7 @@
 #include "build/build_config.h"
 #include "third_party/base/compiler_specific.h"
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 
 #include <mach/vm_page_size.h>
 
@@ -39,7 +39,7 @@
 namespace pdfium {
 namespace {
 
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
 
 constexpr ALWAYS_INLINE int PageAllocationGranularityShift() {
 #if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_PPC64)
@@ -63,7 +63,7 @@
 
 PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE size_t
 PageAllocationGranularity() {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   return vm_page_size;
 #else
   return 1ULL << PageAllocationGranularityShift();
@@ -105,7 +105,7 @@
 // See DecommitSystemPages(), this is not guaranteed to be synchronous on all
 // platforms.
 static constexpr bool kDecommittedPagesAreAlwaysZeroed =
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     false;
 #else
     true;
diff --git a/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h b/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
index 7b2f13d..646cbb7 100644
--- a/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
+++ b/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -10,7 +10,7 @@
 
 #include "build/build_config.h"
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 #include <mach/mach.h>
 #endif
 #if defined(OS_ANDROID)
@@ -86,7 +86,7 @@
                                PageAccessibilityConfiguration accessibility,
                                PageTag page_tag,
                                bool commit) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   // Use a custom tag to make it easier to distinguish Partition Alloc regions
   // in vmmap(1). Tags between 240-255 are supported.
   DCHECK(PageTag::kFirst <= page_tag);
@@ -181,7 +181,7 @@
 bool RecommitSystemPagesInternal(void* address,
                                  size_t length,
                                  PageAccessibilityConfiguration accessibility) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   // On macOS, to update accounting, we need to make another syscall. For more
   // details, see https://crbug.com/823915.
   madvise(address, length, MADV_FREE_REUSE);
@@ -194,7 +194,7 @@
 }
 
 void DiscardSystemPagesInternal(void* address, size_t length) {
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
   int ret = madvise(address, length, MADV_FREE_REUSABLE);
   if (ret) {
     // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED.
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.cc b/third_party/base/allocator/partition_allocator/partition_alloc.cc
index 1dd5582..6891275 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc.cc
+++ b/third_party/base/allocator/partition_allocator/partition_alloc.cc
@@ -486,7 +486,7 @@
 #if defined(PAGE_ALLOCATOR_CONSTANTS_ARE_CONSTEXPR)
   constexpr size_t kMaxSlotCount =
       (PartitionPageSize() * kMaxPartitionPagesPerSlotSpan) / SystemPageSize();
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
   // It's better for slot_usage to be stack-allocated and fixed-size, which
   // demands that its size be constexpr. On OS_APPLE, PartitionPageSize() is
   // always SystemPageSize() << 2, so regardless of what the run time page size
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc_constants.h b/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
index e3bcf5a..d0280ce 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
+++ b/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
@@ -11,7 +11,7 @@
 #include "build/build_config.h"
 #include "third_party/base/allocator/partition_allocator/page_allocator_constants.h"
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 #include <mach/vm_page_size.h>
 #endif
 
@@ -49,7 +49,7 @@
 PartitionPageShift() {
   return 18;  // 256 KiB
 }
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE int
 PartitionPageShift() {
   return vm_page_shift + 2;
diff --git a/third_party/base/immediate_crash.h b/third_party/base/immediate_crash.h
index 81f18cc..fd2fd05 100644
--- a/third_party/base/immediate_crash.h
+++ b/third_party/base/immediate_crash.h
@@ -55,13 +55,13 @@
 // to continue after SIGTRAP.
 #define TRAP_SEQUENCE1_() asm volatile("int3")
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 // Intentionally empty: __builtin_unreachable() is always part of the sequence
 // (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
 #define TRAP_SEQUENCE2_() asm volatile("")
 #else
 #define TRAP_SEQUENCE2_() asm volatile("ud2")
-#endif  // defined(OS_APPLE)
+#endif  // BUILDFLAG(IS_APPLE)
 
 #elif defined(ARCH_CPU_ARMEL)
 
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index 717d4d7..6b0e8a7 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -540,7 +540,7 @@
     {0xfef135f8, "AdobeHeitiStd-Regular", "Batang,Century,Dotum", 0,
      FX_CodePage::kChineseSimplified},
 };
-#elif defined(OS_APPLE)
+#elif BUILDFLAG(IS_APPLE)
 const FGAS_FontInfo kXFAFontsMap[] = {
     {0x01d5d33e, "SimSun", "STHeiti,Heiti TC,STFangsong", 0,
      FX_CodePage::kChineseSimplified},
diff --git a/xfa/fgas/layout/cfgas_rtfbreak.cpp b/xfa/fgas/layout/cfgas_rtfbreak.cpp
index b290c2d..b5e5abc 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak.cpp
@@ -772,7 +772,7 @@
       current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wForm);
       if (current_char_pos.m_GlyphIndex == 0xFFFF)
         current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wch);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
       current_char_pos.m_ExtGID = current_char_pos.m_GlyphIndex;
 #endif
       current_char_pos.m_FontCharWidth = iCharWidth;
diff --git a/xfa/fgas/layout/cfgas_txtbreak.cpp b/xfa/fgas/layout/cfgas_txtbreak.cpp
index 49e7031..b63cc9c 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak.cpp
@@ -814,7 +814,7 @@
       }
       if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
         pCharPos->m_GlyphIndex = pFont->GetGlyphIndex(wForm);
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
         pCharPos->m_ExtGID = pCharPos->m_GlyphIndex;
 #endif
         pCharPos->m_FontCharWidth = iCharWidth;
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 534b45e..f9c2146 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -39,7 +39,7 @@
 
 constexpr int kEditMargin = 3;
 
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
 constexpr XFA_FWL_KeyFlag kEditingModifier = XFA_FWL_KeyFlag::kCommand;
 #else
 constexpr XFA_FWL_KeyFlag kEditingModifier = XFA_FWL_KeyFlag::kCtrl;
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 740e88f..a5d7e47 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -155,7 +155,7 @@
 
 bool CFWL_NoteDriver::DoKey(CFWL_Message* pMessage, CFWL_Widget* pMessageForm) {
   CFWL_MessageKey* pMsg = static_cast<CFWL_MessageKey*>(pMessage);
-#if !defined(OS_APPLE)
+#if !BUILDFLAG(IS_APPLE)
   if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown &&
       pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Tab) {
     return true;
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 3292079..39961df 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -63,7 +63,7 @@
     pGraphics->SaveGraphState();
     pGraphics->SetFillColor(CFGAS_GEColor(FWLTHEME_COLOR_BKSelected));
     CFGAS_GEPath path;
-#if defined(OS_APPLE)
+#if BUILDFLAG(IS_APPLE)
     path.AddRectangle(rtItem.left, rtItem.top, rtItem.width - 1,
                       rtItem.height - 1);
 #else