/* * Copyright (c) 2026, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include namespace Web::Speech { GC_DEFINE_ALLOCATOR(SpeechSynthesis); GC::Ref SpeechSynthesis::create(JS::Realm& realm) { return realm.create(realm); } SpeechSynthesis::SpeechSynthesis(JS::Realm& realm) : DOM::EventTarget(realm) { } SpeechSynthesis::~SpeechSynthesis() = default; void SpeechSynthesis::initialize(JS::Realm& realm) { WEB_SET_PROTOTYPE_FOR_INTERFACE(SpeechSynthesis); Base::initialize(realm); } void SpeechSynthesis::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_voices); } void SpeechSynthesis::set_onvoiceschanged(GC::Ptr event_handler) { set_event_handler_attribute(HTML::EventNames::voiceschanged, event_handler); } GC::Ptr SpeechSynthesis::onvoiceschanged() { return event_handler_attribute(HTML::EventNames::voiceschanged); } // https://wicg.github.io/speech-api/#dom-speechsynthesis-cancel void SpeechSynthesis::cancel() { dbgln("FIXME: Implement SpeechSynthesis::cancel()"); } // https://wicg.github.io/speech-api/#dom-speechsynthesis-getvoices Vector> const& SpeechSynthesis::get_voices() const { // FIXME: Populate m_voices with available synthesis voices. return m_voices; } }