mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 10:06:03 +00:00
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:
parent
2c31d7dddc
commit
e10721f1b5
Notes:
sideshowbarker
2024-07-17 05:03:11 +09:00
Author: https://github.com/ADKaster
Commit: e10721f1b5
Pull-request: https://github.com/SerenityOS/serenity/pull/24255
Issue: https://github.com/SerenityOS/serenity/issues/22014
13 changed files with 174 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<void> post_message(JS::Value message, StructuredSerializeOptions const&);
|
||||
|
||||
JS::NonnullGCPtr<CSS::FontFaceSet> fonts();
|
||||
|
||||
// Non-IDL public methods
|
||||
|
||||
URL::URL const& url() const { return m_url.value(); }
|
||||
|
@ -136,6 +138,9 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-cross-origin-isolated-capability
|
||||
bool m_cross_origin_isolated_capability { false };
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#font-source
|
||||
JS::GCPtr<CSS::FontFaceSet> m_fonts;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#import <CSS/FontFaceSet.idl>
|
||||
#import <DOM/EventTarget.idl>
|
||||
#import <DOM/EventHandler.idl>
|
||||
#import <HTML/WindowOrWorkerGlobalScope.idl>
|
||||
|
@ -28,3 +29,4 @@ interface WorkerGlobalScope : EventTarget {
|
|||
};
|
||||
|
||||
WorkerGlobalScope includes WindowOrWorkerGlobalScope;
|
||||
WorkerGlobalScope includes FontFaceSource;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue