diff --git a/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.cc b/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.cc new file mode 100644 index 000000000000..b90c07bec165 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.cc @@ -0,0 +1,28 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/core/css/local_font_face_source.h" + +#include "third_party/blink/renderer/core/execution_context/execution_context.h" + +#define IsLocalFontAvailable IsLocalFontAvailable_ChromiumImpl + +#include "src/third_party/blink/renderer/core/css/local_font_face_source.cc" + +#undef IsLocalFontAvailable + +namespace blink { + +bool LocalFontFaceSource::IsLocalFontAvailable( + const FontDescription& font_description) const { + if (!brave::AllowFontFamily(font_selector_->GetExecutionContext(), + font_name_)) { + return false; + } + + return IsLocalFontAvailable_ChromiumImpl(font_description); +} + +} // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.h b/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.h new file mode 100644 index 000000000000..b5896271bc12 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/css/local_font_face_source.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CSS_LOCAL_FONT_FACE_SOURCE_H_ +#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CSS_LOCAL_FONT_FACE_SOURCE_H_ + +#include "third_party/blink/renderer/core/css/css_font_face_source.h" + +#define IsLocalFontAvailable \ + IsLocalFontAvailable_ChromiumImpl(const FontDescription&) const; \ + bool IsLocalFontAvailable + +#include "src/third_party/blink/renderer/core/css/local_font_face_source.h" + +#undef IsLocalFontAvailable + +#endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_CSS_LOCAL_FONT_FACE_SOURCE_H_