mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb/CSS: Implement delete method for FontFaceSet
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
d33a87c8c4
commit
09aec4be71
Notes:
github-actions[bot]
2024-10-03 14:37:42 +00:00
Author: https://github.com/kostyafarber Commit: https://github.com/LadybirdBrowser/ladybird/commit/09aec4be716 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1613 Reviewed-by: https://github.com/kalenikaliaksandr
1 changed files with 20 additions and 2 deletions
|
@ -97,8 +97,26 @@ FontFaceSet::add(JS::Handle<FontFace> face)
|
|||
// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-delete
|
||||
bool FontFaceSet::delete_(JS::Handle<FontFace> face)
|
||||
{
|
||||
// FIXME: Do the actual spec steps
|
||||
return m_set_entries->set_remove(face);
|
||||
// 1. If font is CSS-connected, return false and exit this algorithm immediately.
|
||||
if (face->is_css_connected()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. Let deleted be the result of removing font from the FontFaceSet’s set entries.
|
||||
bool deleted = m_set_entries->set_remove(face);
|
||||
|
||||
// 3. If font is present in the FontFaceSet’s [[LoadedFonts]], or [[FailedFonts]] lists, remove it.
|
||||
m_loaded_fonts.remove_all_matching([face](auto const& entry) { return entry == face; });
|
||||
m_failed_fonts.remove_all_matching([face](auto const& entry) { return entry == face; });
|
||||
|
||||
// 4. If font is present in the FontFaceSet’s [[LoadingFonts]] list, remove it. If font was the last item in that list (and so the list is now empty), switch the FontFaceSet to loaded.
|
||||
m_loading_fonts.remove_all_matching([face](auto const& entry) { return entry == face; });
|
||||
|
||||
if (m_loading_fonts.is_empty()) {
|
||||
m_status = Bindings::FontFaceSetLoadStatus::Loaded;
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-clear
|
||||
|
|
Loading…
Reference in a new issue