/* * Copyright (c) 2026, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::Speech { class SpeechSynthesis final : public DOM::EventTarget { WEB_PLATFORM_OBJECT(SpeechSynthesis, DOM::EventTarget); GC_DECLARE_ALLOCATOR(SpeechSynthesis); public: [[nodiscard]] static GC::Ref create(JS::Realm&); virtual ~SpeechSynthesis() override; // https://wicg.github.io/speech-api/#dom-speechsynthesis-pending bool pending() const { return m_pending; } // https://wicg.github.io/speech-api/#dom-speechsynthesis-speaking bool speaking() const { return m_speaking; } // https://wicg.github.io/speech-api/#dom-speechsynthesis-paused bool paused() const { return m_paused; } void set_onvoiceschanged(GC::Ptr); GC::Ptr onvoiceschanged(); void cancel(); Vector> const& get_voices() const; private: explicit SpeechSynthesis(JS::Realm&); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool m_pending { false }; bool m_speaking { false }; bool m_paused { false }; Vector> m_voices; }; }