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