Skip to content

Commit

Permalink
Hook LocalFontFaceSource into font whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
pilgrim-brave committed Jun 14, 2022
1 parent 77a4b69 commit 9b8be87
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit 9b8be87

Please sign in to comment.