LibWeb: Add stub implementation of FontFaceSet and Document.fonts

This is now enough for duolingo to load and use its fallback fonts.
This commit is contained in:
Andrew Kaster
2024-05-07 14:49:31 -06:00
committed by Andreas Kling
parent 2c31d7dddc
commit e10721f1b5
13 changed files with 174 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
#include <LibWeb/Bindings/DedicatedWorkerExposedInterfaces.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/WorkerGlobalScopePrototype.h>
#include <LibWeb/CSS/FontFaceSet.h>
#include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/MessageEvent.h>
@@ -53,6 +54,7 @@ void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_navigator);
visitor.visit(m_internal_port);
visitor.visit(m_page);
visitor.visit(m_fonts);
}
void WorkerGlobalScope::finalize()
@@ -127,4 +129,11 @@ WebIDL::ExceptionOr<void> WorkerGlobalScope::post_message(JS::Value message, Str
ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
JS::NonnullGCPtr<CSS::FontFaceSet> WorkerGlobalScope::fonts()
{
if (!m_fonts)
m_fonts = CSS::FontFaceSet::create(realm());
return *m_fonts;
}
}