/* * Copyright (c) 2026, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include namespace Web::Speech { GC_DEFINE_ALLOCATOR(SpeechSynthesisUtterance); WebIDL::ExceptionOr> SpeechSynthesisUtterance::construct_impl(JS::Realm& realm, String const& text) { return realm.create(realm, text); } SpeechSynthesisUtterance::SpeechSynthesisUtterance(JS::Realm& realm, String const& text) : DOM::EventTarget(realm) , m_text(text) { } SpeechSynthesisUtterance::~SpeechSynthesisUtterance() = default; void SpeechSynthesisUtterance::initialize(JS::Realm& realm) { WEB_SET_PROTOTYPE_FOR_INTERFACE(SpeechSynthesisUtterance); Base::initialize(realm); } void SpeechSynthesisUtterance::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_voice); } #undef __ENUMERATE #define __ENUMERATE(attribute_name, event_name) \ void SpeechSynthesisUtterance::set_##attribute_name(GC::Ptr value) \ { \ set_event_handler_attribute(event_name, value); \ } \ GC::Ptr SpeechSynthesisUtterance::attribute_name() \ { \ return event_handler_attribute(event_name); \ } ENUMERATE_SPEECH_SYNTHESIS_UTTERANCE_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE }