Diff
Modified: trunk/LayoutTests/ChangeLog (110949 => 110950)
--- trunk/LayoutTests/ChangeLog 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/LayoutTests/ChangeLog 2012-03-16 06:35:17 UTC (rev 110950)
@@ -1,3 +1,15 @@
+2012-03-15 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: SpeechRecognition, Controller and Client
+ https://bugs.webkit.org/show_bug.cgi?id=81096
+
+ Reviewed by Adam Barth.
+
+ Add tests for the basics of the SpeechRecognition interface.
+
+ * fast/speech/scripted/basics-expected.txt: Added.
+ * fast/speech/scripted/basics.html: Added.
+
2012-03-15 Kent Tamura <[email protected]>
Update the expectation of labelable-elements.html.
Added: trunk/LayoutTests/fast/speech/scripted/basics-expected.txt (0 => 110950)
--- trunk/LayoutTests/fast/speech/scripted/basics-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/basics-expected.txt 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,29 @@
+Tests the basics of the Speech _javascript_ API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitSpeechRecognition' in self is true
+PASS webkitSpeechRecognition == null is false
+PASS speechReco == null is false
+PASS 'grammars' in speechReco is true
+PASS speechReco.grammars == null is false
+PASS speechReco.grammars.length === 0 is true
+PASS 'lang' in speechReco is true
+PASS 'continuous' in speechReco is true
+PASS 'start' in speechReco is true
+PASS 'stop' in speechReco is true
+PASS 'abort' in speechReco is true
+PASS 'onaudiostart' in speechReco is true
+PASS 'onsoundstart' in speechReco is true
+PASS 'onspeechstart' in speechReco is true
+PASS 'onspeechend' in speechReco is true
+PASS 'onsoundend' in speechReco is true
+PASS 'onaudioend' in speechReco is true
+PASS 'onresult' in speechReco is true
+PASS 'onnomatch' in speechReco is true
+PASS 'onresultdeleted' in speechReco is true
+PASS 'onerror' in speechReco is true
+PASS 'onstart' in speechReco is true
+PASS 'onend' in speechReco is true
+
Added: trunk/LayoutTests/fast/speech/scripted/basics.html (0 => 110950)
--- trunk/LayoutTests/fast/speech/scripted/basics.html (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/basics.html 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script type="text/_javascript_">
+description('Tests the basics of the Speech _javascript_ API');
+
+function run() {
+ // Check availability of constructors.
+ shouldBeTrue("'webkitSpeechRecognition' in self");
+ shouldBeFalse("webkitSpeechRecognition == null");
+
+ // Check for members of SpeechRecognition.
+ window.speechReco = new webkitSpeechRecognition();
+ shouldBeFalse("speechReco == null");
+ shouldBeTrue("'grammars' in speechReco");
+ shouldBeFalse("speechReco.grammars == null");
+ shouldBeTrue("speechReco.grammars.length === 0");
+ shouldBeTrue("'lang' in speechReco");
+ shouldBeTrue("'continuous' in speechReco");
+ shouldBeTrue("'start' in speechReco");
+ shouldBeTrue("'stop' in speechReco");
+ shouldBeTrue("'abort' in speechReco");
+ shouldBeTrue("'onaudiostart' in speechReco");
+ shouldBeTrue("'onsoundstart' in speechReco");
+ shouldBeTrue("'onspeechstart' in speechReco");
+ shouldBeTrue("'onspeechend' in speechReco");
+ shouldBeTrue("'onsoundend' in speechReco");
+ shouldBeTrue("'onaudioend' in speechReco");
+ shouldBeTrue("'onresult' in speechReco");
+ shouldBeTrue("'onnomatch' in speechReco");
+ shouldBeTrue("'onresultdeleted' in speechReco");
+ shouldBeTrue("'onerror' in speechReco");
+ shouldBeTrue("'onstart' in speechReco");
+ shouldBeTrue("'onend' in speechReco");
+
+ finishJSTest();
+}
+
+window._onload_ = run;
+window.jsTestIsAsync = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (110949 => 110950)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 06:35:17 UTC (rev 110950)
@@ -1,3 +1,71 @@
+2012-03-15 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: SpeechRecognition, Controller and Client
+ https://bugs.webkit.org/show_bug.cgi?id=81096
+
+ Reviewed by Adam Barth.
+
+ Add implementation stub for SpeechRecognition. Add the
+ SpeechRecognitionController class and SpeechRecognitionClient
+ interface.
+
+ Test: fast/speech/scripted/basics.html
+
+ * Modules/speech/DOMWindowSpeech.idl:
+ * Modules/speech/SpeechRecognition.cpp: Added.
+ (WebCore):
+ (WebCore::SpeechRecognition::create):
+ (WebCore::SpeechRecognition::start):
+ (WebCore::SpeechRecognition::stopFunction):
+ (WebCore::SpeechRecognition::abort):
+ (WebCore::SpeechRecognition::audioStartCallback):
+ (WebCore::SpeechRecognition::soundStartCallback):
+ (WebCore::SpeechRecognition::speechStartCallback):
+ (WebCore::SpeechRecognition::speechEndCallback):
+ (WebCore::SpeechRecognition::audioEndCallback):
+ (WebCore::SpeechRecognition::resultCallback):
+ (WebCore::SpeechRecognition::noMatchCallback):
+ (WebCore::SpeechRecognition::resultDeletedCallback):
+ (WebCore::SpeechRecognition::errorCallback):
+ (WebCore::SpeechRecognition::startCallback):
+ (WebCore::SpeechRecognition::endCallback):
+ (WebCore::SpeechRecognition::interfaceName):
+ (WebCore::SpeechRecognition::scriptExecutionContext):
+ (WebCore::SpeechRecognition::SpeechRecognition):
+ (WebCore::SpeechRecognition::~SpeechRecognition):
+ * Modules/speech/SpeechRecognition.h: Added.
+ (WebCore):
+ (SpeechRecognition):
+ (WebCore::SpeechRecognition::grammars):
+ (WebCore::SpeechRecognition::setGrammars):
+ (WebCore::SpeechRecognition::lang):
+ (WebCore::SpeechRecognition::setLang):
+ (WebCore::SpeechRecognition::continuous):
+ (WebCore::SpeechRecognition::setContinuous):
+ * Modules/speech/SpeechRecognition.idl:
+ * Modules/speech/SpeechRecognitionClient.h:
+ (WebCore):
+ (SpeechRecognitionClient):
+ (WebCore::SpeechRecognitionClient::~SpeechRecognitionClient):
+ * Modules/speech/SpeechRecognitionController.cpp:
+ (WebCore):
+ (WebCore::SpeechRecognitionController::supplementName):
+ (WebCore::SpeechRecognitionController::SpeechRecognitionController):
+ (WebCore::SpeechRecognitionController::~SpeechRecognitionController):
+ (WebCore::SpeechRecognitionController::create):
+ (WebCore::provideSpeechRecognitionTo):
+ * Modules/speech/SpeechRecognitionController.h: Added.
+ (WebCore):
+ (SpeechRecognitionController):
+ (WebCore::SpeechRecognitionController::start):
+ (WebCore::SpeechRecognitionController::stop):
+ (WebCore::SpeechRecognitionController::abort):
+ (WebCore::SpeechRecognitionController::visibilityHidden):
+ (WebCore::SpeechRecognitionController::unregisterSpeechRecognition):
+ (WebCore::SpeechRecognitionController::from):
+ * WebCore.gypi:
+ * dom/EventTargetFactory.in:
+
2012-03-15 Michal Ciepielski <[email protected]>
[EFL] Sets alpha channel for new buffers.
Modified: trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl (110949 => 110950)
--- trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl 2012-03-16 06:35:17 UTC (rev 110950)
@@ -28,6 +28,7 @@
Conditional=SCRIPTED_SPEECH,
Supplemental=DOMWindow
] DOMWindowSpeech {
+ attribute [V8EnabledAtRuntime] SpeechRecognitionConstructor webkitSpeechRecognition;
attribute [V8EnabledAtRuntime] SpeechRecognitionErrorConstructor webkitSpeechRecognitionError;
attribute [V8EnabledAtRuntime] SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent;
attribute [V8EnabledAtRuntime] SpeechGrammarConstructor webkitSpeechGrammar;
Added: trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "SpeechRecognition.h"
+
+#include "Document.h"
+#include "Page.h"
+#include "SpeechRecognitionController.h"
+#include "SpeechRecognitionError.h"
+#include "SpeechRecognitionEvent.h"
+
+namespace WebCore {
+
+PassRefPtr<SpeechRecognition> SpeechRecognition::create(ScriptExecutionContext* context)
+{
+ RefPtr<SpeechRecognition> speechRecognition(adoptRef(new SpeechRecognition(context)));
+ speechRecognition->suspendIfNeeded();
+ return speechRecognition.release();
+}
+
+void SpeechRecognition::start()
+{
+ ASSERT(m_controller); // FIXME: Spec should say what to do if we are already started.
+ m_controller->start(this, m_grammars.get(), m_lang, m_continuous);
+}
+
+void SpeechRecognition::stopFunction()
+{
+ ASSERT(m_controller);
+ m_controller->stop(this); // FIXME: Spec should say what to do if we are not started.
+}
+
+void SpeechRecognition::abort()
+{
+ ASSERT(m_controller);
+ m_controller->abort(this); // FIXME: Spec should say what to do if we are not started.
+}
+
+void SpeechRecognition::audioStartCallback()
+{
+ // FIXME: The spec should specify whether these events can bubble and are cancelable.
+ dispatchEvent(Event::create(eventNames().audiostartEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::soundStartCallback()
+{
+ dispatchEvent(Event::create(eventNames().soundstartEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::speechStartCallback()
+{
+ dispatchEvent(Event::create(eventNames().speechstartEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::speechEndCallback()
+{
+ dispatchEvent(Event::create(eventNames().speechendEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::audioEndCallback()
+{
+ dispatchEvent(Event::create(eventNames().audioendEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::resultCallback(PassRefPtr<SpeechRecognitionResult> result, unsigned long resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
+{
+ dispatchEvent(SpeechRecognitionEvent::createResult(result, resultIndex, resultHistory));
+}
+
+void SpeechRecognition::noMatchCallback(PassRefPtr<SpeechRecognitionResult> result)
+{
+ dispatchEvent(SpeechRecognitionEvent::createNoMatch(result));
+}
+
+void SpeechRecognition::resultDeletedCallback(unsigned resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
+{
+ dispatchEvent(SpeechRecognitionEvent::createResultDeleted(resultIndex, resultHistory));
+}
+
+void SpeechRecognition::errorCallback(PassRefPtr<SpeechRecognitionError> error)
+{
+ dispatchEvent(SpeechRecognitionEvent::createError(error));
+}
+
+void SpeechRecognition::startCallback()
+{
+ dispatchEvent(Event::create(eventNames().startEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+void SpeechRecognition::endCallback()
+{
+ dispatchEvent(Event::create(eventNames().endEvent, /*canBubble=*/false, /*cancelable=*/false));
+}
+
+const AtomicString& SpeechRecognition::interfaceName() const
+{
+ return eventNames().interfaceForSpeechRecognition;
+}
+
+ScriptExecutionContext* SpeechRecognition::scriptExecutionContext() const
+{
+ return ActiveDOMObject::scriptExecutionContext();
+}
+
+SpeechRecognition::SpeechRecognition(ScriptExecutionContext* context)
+ : ActiveDOMObject(context, this)
+ , m_grammars(SpeechGrammarList::create()) // FIXME: The spec is not clear on the default value for the grammars attribute.
+ , m_continuous(false)
+ , m_controller(0)
+{
+ ASSERT(scriptExecutionContext()->isDocument());
+ Document* document = static_cast<Document*>(scriptExecutionContext());
+
+ Page* page = document->page();
+ ASSERT(page);
+
+ m_controller = SpeechRecognitionController::from(page);
+ ASSERT(m_controller);
+
+ // FIXME: Need to hook up with Page to get notified when the visibility changes.
+}
+
+SpeechRecognition::~SpeechRecognition()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
Added: trunk/Source/WebCore/Modules/speech/SpeechRecognition.h (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.h 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SpeechRecognition_h
+#define SpeechRecognition_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "ActiveDOMObject.h"
+#include "EventTarget.h"
+#include "PlatformString.h"
+#include "SpeechGrammarList.h"
+#include <wtf/Compiler.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+class SpeechRecognitionController;
+class SpeechRecognitionError;
+class SpeechRecognitionResult;
+class SpeechRecognitionResultList;
+
+class SpeechRecognition : public RefCounted<SpeechRecognition>, public ActiveDOMObject, public EventTarget {
+public:
+ static PassRefPtr<SpeechRecognition> create(ScriptExecutionContext*);
+
+ PassRefPtr<SpeechGrammarList> grammars() { return m_grammars; }
+ void setGrammars(PassRefPtr<SpeechGrammarList> grammars) { m_grammars = grammars; }
+
+ String lang() { return m_lang; }
+ void setLang(const String& lang) { m_lang = lang; }
+
+ bool continuous() { return m_continuous; }
+ void setContinuous(bool continuous) { m_continuous = continuous; }
+
+ // Callable by the user.
+ void start();
+ void stopFunction();
+ void abort();
+
+ // Called by the SpeechRecognitionClient.
+ void audioStartCallback();
+ void soundStartCallback();
+ void speechStartCallback();
+ void speechEndCallback();
+ void audioEndCallback();
+ void resultCallback(PassRefPtr<SpeechRecognitionResult>, unsigned long resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
+ void noMatchCallback(PassRefPtr<SpeechRecognitionResult>);
+ void resultDeletedCallback(unsigned resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
+ void errorCallback(PassRefPtr<SpeechRecognitionError>);
+ void startCallback();
+ void endCallback();
+
+ // EventTarget
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+
+ using RefCounted<SpeechRecognition>::ref;
+ using RefCounted<SpeechRecognition>::deref;
+
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(audiostart);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(soundstart);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(result);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(resultdeleted);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(start);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(end);
+
+private:
+ friend class RefCounted<SpeechRecognition>;
+
+ SpeechRecognition(ScriptExecutionContext*);
+ ~SpeechRecognition();
+
+ // EventTarget
+ virtual void refEventTarget() OVERRIDE { ref(); }
+ virtual void derefEventTarget() OVERRIDE { deref(); }
+ virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
+ virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventTargetData; }
+
+ RefPtr<SpeechGrammarList> m_grammars;
+ String m_lang;
+ bool m_continuous;
+
+ EventTargetData m_eventTargetData;
+
+ SpeechRecognitionController* m_controller;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // SpeechRecognition_h
Copied: trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl (from rev 110949, trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl) (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {
+ interface [
+ Conditional=SCRIPTED_SPEECH,
+ ActiveDOMObject,
+ Constructor,
+ CallWith=ScriptExecutionContext,
+ EventTarget,
+ ] SpeechRecognition {
+ attribute SpeechGrammarList grammars;
+ attribute DOMString lang;
+ attribute boolean continuous;
+
+ void start();
+ [ImplementedAs=stopFunction] void stop();
+ void abort();
+
+ attribute EventListener onaudiostart;
+ attribute EventListener onsoundstart;
+ attribute EventListener onspeechstart;
+ attribute EventListener onspeechend;
+ attribute EventListener onsoundend;
+ attribute EventListener onaudioend;
+ attribute EventListener onresult;
+ attribute EventListener onnomatch;
+ attribute EventListener onresultdeleted;
+ attribute EventListener onerror;
+ attribute EventListener onstart;
+ attribute EventListener onend;
+ };
+}
Copied: trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h (from rev 110949, trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl) (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SpeechRecognitionClient_h
+#define SpeechRecognitionClient_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class Page;
+class SpeechGrammarList;
+class SpeechRecognition;
+
+class SpeechRecognitionClient {
+public:
+ virtual void start(SpeechRecognition*, const SpeechGrammarList*, const String& lang, bool continuous) = 0;
+ virtual void stop(SpeechRecognition*) = 0;
+ virtual void abort(SpeechRecognition*) = 0;
+ virtual void visibilityHidden() = 0;
+ virtual void unregisterSpeechRecognition(SpeechRecognition*) = 0;
+
+ virtual ~SpeechRecognitionClient() { }
+};
+
+void provideSpeechRecognitionTo(Page*, SpeechRecognitionClient*);
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // SpeechRecognitionClient_h
Copied: trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.cpp (from rev 110949, trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl) (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.cpp 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SpeechRecognitionController.h"
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+namespace WebCore {
+
+const AtomicString& SpeechRecognitionController::supplementName()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechRecognitionController"));
+ return name;
+}
+
+SpeechRecognitionController::SpeechRecognitionController(SpeechRecognitionClient* client)
+ : m_client(client)
+{
+}
+
+SpeechRecognitionController::~SpeechRecognitionController()
+{
+ // FIXME: Call m_client->pageDestroyed(); once we have implemented a client.
+}
+
+PassOwnPtr<SpeechRecognitionController> SpeechRecognitionController::create(SpeechRecognitionClient* client)
+{
+ return adoptPtr(new SpeechRecognitionController(client));
+}
+
+void provideSpeechRecognitionTo(Page* page, SpeechRecognitionClient* client)
+{
+ SpeechRecognitionController::provideTo(page, SpeechRecognitionController::supplementName(), SpeechRecognitionController::create(client));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h (0 => 110950)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h 2012-03-16 06:35:17 UTC (rev 110950)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SpeechRecognitionController_h
+#define SpeechRecognitionController_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "Page.h"
+#include "SpeechRecognitionClient.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SpeechRecognitionController : public Supplement<Page> {
+public:
+ virtual ~SpeechRecognitionController();
+
+ void start(SpeechRecognition* recognition, const SpeechGrammarList* grammars, const String& lang, bool continuous) { m_client->start(recognition, grammars, lang, continuous); }
+ void stop(SpeechRecognition* recognition) { m_client->stop(recognition); }
+ void abort(SpeechRecognition* recognition) { m_client->abort(recognition); }
+ void visibilityHidden() { m_client->visibilityHidden(); }
+ void unregisterSpeechRecognition(SpeechRecognition* recognition) { m_client->unregisterSpeechRecognition(recognition); }
+
+ static PassOwnPtr<SpeechRecognitionController> create(SpeechRecognitionClient*);
+ static const AtomicString& supplementName();
+ static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); }
+
+private:
+ SpeechRecognitionController(SpeechRecognitionClient*);
+
+ SpeechRecognitionClient* m_client;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // SpeechRecognitionController_h
Modified: trunk/Source/WebCore/WebCore.gypi (110949 => 110950)
--- trunk/Source/WebCore/WebCore.gypi 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebCore/WebCore.gypi 2012-03-16 06:35:17 UTC (rev 110950)
@@ -776,6 +776,7 @@
'Modules/speech/DOMWindowSpeech.idl',
'Modules/speech/SpeechGrammar.idl',
'Modules/speech/SpeechGrammarList.idl',
+ 'Modules/speech/SpeechRecognition.idl',
'Modules/speech/SpeechRecognitionAlternative.idl',
'Modules/speech/SpeechRecognitionError.idl',
'Modules/speech/SpeechRecognitionEvent.idl',
@@ -1428,8 +1429,13 @@
'Modules/speech/SpeechGrammar.h',
'Modules/speech/SpeechGrammarList.cpp',
'Modules/speech/SpeechGrammarList.h',
+ 'Modules/speech/SpeechRecognition.cpp',
+ 'Modules/speech/SpeechRecognition.h',
'Modules/speech/SpeechRecognitionAlternative.cpp',
'Modules/speech/SpeechRecognitionAlternative.h',
+ 'Modules/speech/SpeechRecognitionClient.h',
+ 'Modules/speech/SpeechRecognitionController.cpp',
+ 'Modules/speech/SpeechRecognitionController.h',
'Modules/speech/SpeechRecognitionError.cpp',
'Modules/speech/SpeechRecognitionError.h',
'Modules/speech/SpeechRecognitionEvent.cpp',
Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (110949 => 110950)
--- trunk/Source/WebCore/dom/EventTargetFactory.in 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in 2012-03-16 06:35:17 UTC (rev 110950)
@@ -21,6 +21,7 @@
Notification conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS
SharedWorker conditional=SHARED_WORKERS
SharedWorkerContext conditional=SHARED_WORKERS
+SpeechRecognition conditional=SCRIPTED_SPEECH
SVGElementInstance conditional=SVG
TextTrack conditional=VIDEO_TRACK
TextTrackCue conditional=VIDEO_TRACK
Modified: trunk/Source/WebKit/chromium/ChangeLog (110949 => 110950)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-16 06:35:17 UTC (rev 110950)
@@ -1,3 +1,16 @@
+2012-03-15 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: SpeechRecognition, Controller and Client
+ https://bugs.webkit.org/show_bug.cgi?id=81096
+
+ Reviewed by Adam Barth.
+
+ Provide a SpeechRecognitionController to Page, with a NULL client for
+ now.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
2012-03-15 Dana Jansens <[email protected]>
[chromium] Fix some assertions in occlusion tracker unit tests
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (110949 => 110950)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-03-16 06:18:45 UTC (rev 110949)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-03-16 06:35:17 UTC (rev 110950)
@@ -106,6 +106,7 @@
#include "Settings.h"
#include "SharedGraphicsContext3D.h"
#include "SpeechInputClientImpl.h"
+#include "SpeechRecognitionClient.h"
#include "TextIterator.h"
#include "Timer.h"
#include "TraceEvent.h"
@@ -389,6 +390,9 @@
#if ENABLE(INPUT_SPEECH)
provideSpeechInputTo(m_page.get(), m_speechInputClient.get());
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ provideSpeechRecognitionTo(m_page.get(), 0); // FIXME: Provide a real implementation.
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
provideNotification(m_page.get(), notificationPresenterImpl());
#endif