mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb: Add stub implementation of CSS FontFace Web API
This commit is contained in:
parent
3a5eabc43b
commit
2c31d7dddc
Notes:
sideshowbarker
2024-07-17 03:35:16 +09:00
Author: https://github.com/ADKaster
Commit: 2c31d7dddc
Pull-request: https://github.com/SerenityOS/serenity/pull/24255
Issue: https://github.com/SerenityOS/serenity/issues/22014
7 changed files with 130 additions and 0 deletions
43
Userland/Libraries/LibWeb/CSS/FontFace.cpp
Normal file
43
Userland/Libraries/LibWeb/CSS/FontFace.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/FontFacePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/FontFace.h>
|
||||
#include <LibWeb/WebIDL/Promise.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(FontFace);
|
||||
|
||||
JS::NonnullGCPtr<FontFace> FontFace::construct_impl(JS::Realm& realm, String family, FontFaceSource source, FontFaceDescriptors const& descriptors)
|
||||
{
|
||||
return realm.heap().allocate<FontFace>(realm, realm, move(family), move(source), descriptors);
|
||||
}
|
||||
|
||||
FontFace::FontFace(JS::Realm& realm, String, FontFaceSource, FontFaceDescriptors const&)
|
||||
: Bindings::PlatformObject(realm)
|
||||
{
|
||||
}
|
||||
|
||||
void FontFace::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(FontFace);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontface-load
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Promise>> FontFace::load()
|
||||
{
|
||||
// FIXME: Do the steps
|
||||
auto promise = WebIDL::create_rejected_promise(realm(), WebIDL::NotSupportedError::create(realm(), "FontFace::load is not yet implemented"_fly_string));
|
||||
return verify_cast<JS::Promise>(*promise->promise());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue