diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 1bb90aff61031525d5cada6609d9fc05e8ffc3c7..1da186584ce950e81db4b8b2c94e2995bbf51422 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -494,14 +494,14 @@ void BrowserContextAdapter::clearHttpCache()
 
 void BrowserContextAdapter::setSpellCheckLanguages(const QStringList &languages)
 {
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     m_browserContext->setSpellCheckLanguages(languages);
 #endif
 }
 
 QStringList BrowserContextAdapter::spellCheckLanguages() const
 {
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     return m_browserContext->spellCheckLanguages();
 #else
     return QStringList();
@@ -510,14 +510,14 @@ QStringList BrowserContextAdapter::spellCheckLanguages() const
 
 void BrowserContextAdapter::setSpellCheckEnabled(bool enabled)
 {
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     m_browserContext->setSpellCheckEnabled(enabled);
 #endif
 }
 
 bool BrowserContextAdapter::isSpellCheckEnabled() const
 {
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     return m_browserContext->isSpellCheckEnabled();
 #else
     return false;
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 8823e98975533c120ae5b5668c0c6ef5648b30ca..133006d7055ce9393d08b2a5f515e9f2bd963915 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -78,7 +78,7 @@ BrowserContextQt::BrowserContextQt(BrowserContextAdapter *adapter)
     factory.set_user_prefs(m_prefStore);
     scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
 
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     // Initial spellcheck settings
     registry->RegisterListPref(prefs::kSpellCheckDictionaries, new base::ListValue());
     registry->RegisterStringPref(prefs::kAcceptLanguages, std::string());
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 1ae6f130778a6873d517b5ac3fecafd6241468fa..b45463d733989cfec98c0ad1e46d11dd6e7d1e5d 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -42,9 +42,10 @@
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread_restrictions.h"
-#if defined(ENABLE_SPELLCHECK)
+#include "components/spellcheck/spellcheck_build_features.h"
+#if BUILDFLAG(ENABLE_SPELLCHECK)
 #include "chrome/browser/spellchecker/spellcheck_message_filter.h"
-#if defined(USE_BROWSER_SPELLCHECKER)
+#if BUILDFLAG(USE_BROWSER_SPELLCHECKER)
 #include "chrome/browser/spellchecker/spellcheck_message_filter_platform.h"
 #endif
 #endif
@@ -414,11 +415,11 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost*
 #if defined(ENABLE_PEPPER_CDMS)
     host->AddFilter(new BrowserMessageFilterQt(id));
 #endif
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     // SpellCheckMessageFilter is required for both Hunspell and Native configurations.
     host->AddFilter(new SpellCheckMessageFilter(id));
 #endif
-#if defined(Q_OS_MACOS) && defined(ENABLE_SPELLCHECK) && defined(USE_BROWSER_SPELLCHECKER)
+#if defined(Q_OS_MACOS) && BUILDFLAG(ENABLE_SPELLCHECK) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
   host->AddFilter(new SpellCheckMessageFilterPlatform(id));
 #endif
 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index fa55597d1c8176acd90da2e536bdcccac1f37953..38f66d641f73079becc156948d419a9b01cd9fd8 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -175,7 +175,7 @@ bool ContentMainDelegateQt::BasicStartupComplete(int *exit_code)
     SafeOverridePath(base::DIR_QT_LIBRARY_DATA, WebEngineLibraryInfo::getPath(base::DIR_QT_LIBRARY_DATA));
 #endif
     SafeOverridePath(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES));
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     SafeOverridePath(base::DIR_APP_DICTIONARIES, WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES));
 #endif
     SetContentClient(new ContentClientQt);
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 09d47380ff61f2c636605304873d6a6f896b0537..93badf853c4a5b68e001c520e97aa816d0f9dc0b 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -44,7 +44,7 @@
 
 #include "base/strings/string_split.h"
 #include "base/strings/utf_string_conversions.h"
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
 #include "components/spellcheck/renderer/spellcheck.h"
 #include "components/spellcheck/renderer/spellcheck_provider.h"
 #endif
@@ -104,7 +104,7 @@ void ContentRendererClientQt::RenderThreadStarted()
         m_visitedLinkSlave->GetBindCallback());
     renderThread->AddObserver(UserResourceController::instance());
 
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     m_spellCheck.reset(new SpellCheck());
     renderThread->AddObserver(m_spellCheck.data());
 #endif
@@ -120,7 +120,7 @@ void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view
     new RenderViewObserverQt(render_view, m_webCacheImpl.data());
     new WebChannelIPCTransport(render_view);
     UserResourceController::instance()->renderViewCreated(render_view);
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     new SpellCheckProvider(render_view, m_spellCheck.data());
 #endif
 
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 72b4e40615d8df001fac2e75d68b2119a3494aa0..c373665eeb5528ad012925283fbaf3f88eecd332 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -40,6 +40,7 @@
 #define CONTENT_RENDERER_CLIENT_QT_H
 
 #include "content/public/renderer/content_renderer_client.h"
+#include "components/spellcheck/spellcheck_build_features.h"
 
 #include <QtGlobal>
 #include <QScopedPointer>
@@ -52,7 +53,7 @@ namespace web_cache {
 class WebCacheImpl;
 }
 
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
 class SpellCheck;
 #endif
 
@@ -80,7 +81,7 @@ public:
 private:
     QScopedPointer<visitedlink::VisitedLinkSlave> m_visitedLinkSlave;
     QScopedPointer<web_cache::WebCacheImpl> m_webCacheImpl;
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     QScopedPointer<SpellCheck> m_spellCheck;
 #endif
 };
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 496bbb1841c42667aeae405bb9d74f22cb6d2da8..d67d972c839e78d5bf70f09284ec20f47c7626fe 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1347,7 +1347,7 @@ void WebContentsAdapter::leaveDrag()
 
 void WebContentsAdapter::replaceMisspelling(const QString &word)
 {
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     Q_D(WebContentsAdapter);
     d->webContents->ReplaceMisspelling(toString16(word));
 #endif
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index daf2d48b410489e649bb2cc2f202f5509538bb36..4f921bd072912a4eaafcfe5d15ab7e158deab423 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -46,6 +46,7 @@
 #include "web_contents_adapter.h"
 #include "web_engine_context.h"
 
+#include "components/spellcheck/spellcheck_build_features.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/public/common/context_menu_params.h"
 #include <ui/gfx/image/image_skia.h>
@@ -168,7 +169,7 @@ static inline WebEngineContextMenuData fromParams(const content::ContextMenuPara
     ret.setMediaFlags((WebEngineContextMenuData::MediaFlags)params.media_flags);
     ret.setSuggestedFileName(toQt(params.suggested_filename.data()));
     ret.setIsEditable(params.is_editable);
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     ret.setMisspelledWord(toQt(params.misspelled_word));
     ret.setSpellCheckerSuggestions(fromVector(params.dictionary_suggestions));
 #endif
@@ -178,7 +179,7 @@ static inline WebEngineContextMenuData fromParams(const content::ContextMenuPara
 void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *, const content::ContextMenuParams &params)
 {
     WebEngineContextMenuData contextMenuData(fromParams(params));
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     // Do not use params.spellcheck_enabled, since it is never
     // correctly initialized for chrome asynchronous spellchecking.
     // Even fixing the initialization in ContextMenuClientImpl::showContextMenu
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 40977812d9f7ae22e1a6865faa8a66e6dd4b7055..f46f8f4258421b1b7fbf55d1107825c720121052 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -43,6 +43,7 @@
 #include "base/base_paths.h"
 #include "base/command_line.h"
 #include "base/files/file_util.h"
+#include "components/spellcheck/spellcheck_build_features.h"
 #include "content/public/common/content_paths.h"
 #include "ui/base/ui_base_paths.h"
 #include "ui/base/ui_base_switches.h"
@@ -206,7 +207,7 @@ QString localesPath()
 #endif
 }
 
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
 QString dictionariesPath()
 {
     static QString potentialDictionariesPath;
@@ -333,7 +334,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
         return toFilePath(icuDataPath());
     case ui::DIR_LOCALES:
         return toFilePath(localesPath());
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
     case base::DIR_APP_DICTIONARIES:
         return toFilePath(dictionariesPath());
 #endif