Diff
Modified: trunk/LayoutTests/ChangeLog (110419 => 110420)
--- trunk/LayoutTests/ChangeLog 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/ChangeLog 2012-03-12 11:27:51 UTC (rev 110420)
@@ -1,3 +1,21 @@
+2012-03-12 Hans Wennborg <h...@chromium.org>
+
+ Speech _javascript_ API: SpeechRecognitionEvent
+ https://bugs.webkit.org/show_bug.cgi?id=80513
+
+ Reviewed by Adam Barth.
+
+ Add test for SpeechRecognitionEvent.
+ Update Skipped files for all ports except Chromium.
+
+ * fast/events/constructors/speech-recognition-event-constructor-expected.txt: Added.
+ * fast/events/constructors/speech-recognition-event-constructor.html: Added.
+ * platform/gtk/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wincairo/Skipped:
+
2012-03-12 Andrey Kosyakov <ca...@chromium.org>
Unreviewed, remove flakiness flags for timeline-start-time.html following a fix in r100417.
Added: trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor-expected.txt (0 => 110420)
--- trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor-expected.txt 2012-03-12 11:27:51 UTC (rev 110420)
@@ -0,0 +1,17 @@
+This tests the constructor for the SpeechRecognitionEvent DOM class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new webkitSpeechRecognitionEvent('eventType').bubbles is false
+PASS new webkitSpeechRecognitionEvent('eventType').cancelable is false
+PASS new webkitSpeechRecognitionEvent('eventType').result is null
+PASS new webkitSpeechRecognitionEvent('eventType').error is null
+PASS new webkitSpeechRecognitionEvent('eventType').resultIndex is 0
+PASS new webkitSpeechRecognitionEvent('eventType').resultHistory is null
+PASS new webkitSpeechRecognitionEvent('eventType', { bubbles: false }).bubbles is false
+PASS new webkitSpeechRecognitionEvent('eventType', { bubbles: true }).bubbles is true
+PASS new webkitSpeechRecognitionEvent('eventType', { cancelable: false }).cancelable is false
+PASS new webkitSpeechRecognitionEvent('eventType', { cancelable: true }).cancelable is true
+PASS new webkitSpeechRecognitionEvent('eventType', { resultIndex: 42 }).resultIndex is 42
+
Property changes on: trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html (0 => 110420)
--- trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html 2012-03-12 11:27:51 UTC (rev 110420)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests the constructor for the SpeechRecognitionEvent DOM class.");
+
+// Test constructor without initializer.
+shouldBe("new webkitSpeechRecognitionEvent('eventType').bubbles", "false");
+shouldBe("new webkitSpeechRecognitionEvent('eventType').cancelable", "false");
+shouldBe("new webkitSpeechRecognitionEvent('eventType').result", "null");
+shouldBe("new webkitSpeechRecognitionEvent('eventType').error", "null");
+shouldBe("new webkitSpeechRecognitionEvent('eventType').resultIndex", "0");
+shouldBe("new webkitSpeechRecognitionEvent('eventType').resultHistory", "null");
+
+// Test passing bubbles in the initializer.
+shouldBe("new webkitSpeechRecognitionEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new webkitSpeechRecognitionEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// Test passing cancelable in the initializer.
+shouldBe("new webkitSpeechRecognitionEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new webkitSpeechRecognitionEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// Test passing resultIndex in the initializer.
+shouldBe("new webkitSpeechRecognitionEvent('eventType', { resultIndex: 42 }).resultIndex", "42");
+
+</script>
+<script src=""
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/gtk/Skipped (110419 => 110420)
--- trunk/LayoutTests/platform/gtk/Skipped 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/platform/gtk/Skipped 2012-03-12 11:27:51 UTC (rev 110420)
@@ -258,6 +258,9 @@
# Speech input is not yet enabled.
fast/speech
+# Speech _javascript_ API is not yet enabled.
+fast/events/constructors/speech-recognition-event-constructor.html
+
# Web Timing is not enabled.
# https://bugs.webkit.org/show_bug.cgi?id=42432
fast/dom/Window/window-properties-performance.html
Modified: trunk/LayoutTests/platform/mac/Skipped (110419 => 110420)
--- trunk/LayoutTests/platform/mac/Skipped 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-03-12 11:27:51 UTC (rev 110420)
@@ -230,6 +230,9 @@
# Speech input is not yet enabled.
fast/speech
+# Speech _javascript_ API is not yet enabled.
+fast/events/constructors/speech-recognition-event-constructor.html
+
# Media Stream API is not yet enabled.
fast/dom/MediaStream
Modified: trunk/LayoutTests/platform/qt/Skipped (110419 => 110420)
--- trunk/LayoutTests/platform/qt/Skipped 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-03-12 11:27:51 UTC (rev 110420)
@@ -88,6 +88,9 @@
# ENABLE(INPUT_SPEECH) is disabled.
fast/speech
+# ENABLE(SCRIPTEDSPEECH) is disabled.
+fast/events/constructors/speech-recognition-event-constructor.html
+
# ENABLE(MEDIA_STREAM) is disabled.
fast/dom/MediaStream
fast/mediastream
Modified: trunk/LayoutTests/platform/win/Skipped (110419 => 110420)
--- trunk/LayoutTests/platform/win/Skipped 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/platform/win/Skipped 2012-03-12 11:27:51 UTC (rev 110420)
@@ -1173,6 +1173,9 @@
# Speech input is not yet enabled.
fast/speech
+# Speech _javascript_ API is not yet enabled.
+fast/events/constructors/speech-recognition-event-constructor.html
+
# Media Stream API is not yet enabled.
fast/dom/MediaStream
Modified: trunk/LayoutTests/platform/wincairo/Skipped (110419 => 110420)
--- trunk/LayoutTests/platform/wincairo/Skipped 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/LayoutTests/platform/wincairo/Skipped 2012-03-12 11:27:51 UTC (rev 110420)
@@ -1690,6 +1690,9 @@
# Speech input is not yet enabled.
fast/speech
+# Speech _javascript_ API is not yet enabled.
+fast/events/constructors/speech-recognition-event-constructor.html
+
# Media Stream API is not yet enabled.
fast/dom/MediaStream
Modified: trunk/Source/WebCore/ChangeLog (110419 => 110420)
--- trunk/Source/WebCore/ChangeLog 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/ChangeLog 2012-03-12 11:27:51 UTC (rev 110420)
@@ -1,3 +1,48 @@
+2012-03-12 Hans Wennborg <h...@chromium.org>
+
+ Speech _javascript_ API: SpeechRecognitionEvent
+ https://bugs.webkit.org/show_bug.cgi?id=80513
+
+ Reviewed by Adam Barth.
+
+ Implement SpeechRecognitionEvent.
+ (Spec: http://speech-_javascript_-api-spec.googlecode.com/git/speechapi.html)
+
+ Test: fast/events/constructors/speech-recognition-event-constructor.html
+
+ * Modules/speech/DOMWindowSpeech.idl:
+ * Modules/speech/SpeechRecognitionEvent.cpp: Added.
+ (WebCore):
+ (WebCore::SpeechRecognitionEventInit::SpeechRecognitionEventInit):
+ (WebCore::SpeechRecognitionEvent::create):
+ (WebCore::SpeechRecognitionEvent::createResult):
+ (WebCore::SpeechRecognitionEvent::createNoMatch):
+ (WebCore::SpeechRecognitionEvent::createResultDeleted):
+ (WebCore::SpeechRecognitionEvent::createError):
+ (WebCore::SpeechRecognitionEvent::interfaceName):
+ (WebCore::SpeechRecognitionEvent::SpeechRecognitionEvent):
+ * Modules/speech/SpeechRecognitionEvent.h: Added.
+ (WebCore):
+ (SpeechRecognitionEventInit):
+ (SpeechRecognitionEvent):
+ (WebCore::SpeechRecognitionEvent::result):
+ (WebCore::SpeechRecognitionEvent::error):
+ (WebCore::SpeechRecognitionEvent::resultIndex):
+ (WebCore::SpeechRecognitionEvent::resultHistory):
+ * Modules/speech/SpeechRecognitionEvent.idl:
+ * WebCore.gypi:
+ * bindings/generic/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::webkitSpeechRecognitionEventEnabled):
+ * bindings/v8/OptionsObject.cpp:
+ (WebCore::OptionsObject::get):
+ (WebCore):
+ * bindings/v8/OptionsObject.h:
+ (WebCore):
+ (OptionsObject):
+ * dom/EventNames.h:
+ (WebCore):
+ * dom/EventNames.in:
+
2012-03-12 Kent Tamura <tk...@chromium.org>
Use ICU C API instead of C++ API in LocalizedNumberICU
Modified: trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl (110419 => 110420)
--- trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl 2012-03-12 11:27:51 UTC (rev 110420)
@@ -29,6 +29,7 @@
Supplemental=DOMWindow
] DOMWindowSpeech {
attribute [V8EnabledAtRuntime] SpeechRecognitionErrorConstructor webkitSpeechRecognitionError;
+ attribute [V8EnabledAtRuntime] SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent;
attribute [V8EnabledAtRuntime] SpeechGrammarConstructor webkitSpeechGrammar;
attribute [V8EnabledAtRuntime] SpeechGrammarListConstructor webkitSpeechGrammarList;
};
Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp (0 => 110420)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp 2012-03-12 11:27:51 UTC (rev 110420)
@@ -0,0 +1,106 @@
+/*
+ * 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 "SpeechRecognitionEvent.h"
+
+namespace WebCore {
+
+SpeechRecognitionEventInit::SpeechRecognitionEventInit()
+ : resultIndex(0)
+{
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::create()
+{
+ return adoptRef(new SpeechRecognitionEvent());
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::create(const AtomicString& eventName, const SpeechRecognitionEventInit& initializer)
+{
+ return adoptRef(new SpeechRecognitionEvent(eventName, initializer));
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createResult(PassRefPtr<SpeechRecognitionResult> result, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
+{
+ return adoptRef(new SpeechRecognitionEvent(eventNames().resultEvent, result, resultIndex, resultHistory));
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createNoMatch(PassRefPtr<SpeechRecognitionResult> result)
+{
+ return adoptRef(new SpeechRecognitionEvent(eventNames().nomatchEvent, result, 0, 0));
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createResultDeleted(short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
+{
+ return adoptRef(new SpeechRecognitionEvent(eventNames().resultdeletedEvent, 0, resultIndex, resultHistory));
+}
+
+PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createError(PassRefPtr<SpeechRecognitionError> error)
+{
+ return adoptRef(new SpeechRecognitionEvent(error));
+}
+
+const AtomicString& SpeechRecognitionEvent::interfaceName() const
+{
+ return eventNames().interfaceForSpeechRecognitionEvent;
+}
+
+SpeechRecognitionEvent::SpeechRecognitionEvent()
+ : m_resultIndex(0)
+{
+}
+
+SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, const SpeechRecognitionEventInit& initializer)
+ : Event(eventName, initializer)
+ , m_result(initializer.result)
+ , m_error(initializer.error)
+ , m_resultIndex(initializer.resultIndex)
+ , m_resultHistory(initializer.resultHistory)
+{
+}
+
+SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult> result, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
+ : Event(eventName, /*canBubble=*/false, /*cancelable=*/false)
+ , m_result(result)
+ , m_error(0)
+ , m_resultIndex(resultIndex)
+ , m_resultHistory(resultHistory)
+{
+}
+
+SpeechRecognitionEvent::SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError> error)
+ : Event(eventNames().errorEvent, /*canBubble=*/false, /*cancelable=*/false) // FIXME: The spec should say whether these bubble or not.
+ , m_error(error)
+ , m_resultIndex(0)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
Property changes on: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h (0 => 110420)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h 2012-03-12 11:27:51 UTC (rev 110420)
@@ -0,0 +1,86 @@
+/*
+ * 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 SpeechRecognitionEvent_h
+#define SpeechRecognitionEvent_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "Event.h"
+#include "SpeechRecognitionError.h"
+#include "SpeechRecognitionResult.h"
+#include "SpeechRecognitionResultList.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SpeechRecognitionError;
+class SpeechRecognitionResult;
+class SpeechRecognitionResultList;
+
+struct SpeechRecognitionEventInit : public EventInit {
+ SpeechRecognitionEventInit();
+
+ RefPtr<SpeechRecognitionResult> result;
+ RefPtr<SpeechRecognitionError> error;
+ short resultIndex;
+ RefPtr<SpeechRecognitionResultList> resultHistory;
+};
+
+class SpeechRecognitionEvent : public Event {
+public:
+ static PassRefPtr<SpeechRecognitionEvent> create();
+ static PassRefPtr<SpeechRecognitionEvent> create(const AtomicString&, const SpeechRecognitionEventInit&);
+
+ static PassRefPtr<SpeechRecognitionEvent> createResult(PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
+ static PassRefPtr<SpeechRecognitionEvent> createNoMatch(PassRefPtr<SpeechRecognitionResult>);
+ static PassRefPtr<SpeechRecognitionEvent> createResultDeleted(short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
+ static PassRefPtr<SpeechRecognitionEvent> createError(PassRefPtr<SpeechRecognitionError>);
+
+ SpeechRecognitionResult* result() const { return m_result.get(); }
+ SpeechRecognitionError* error() const { return m_error.get(); }
+ short resultIndex() const { return m_resultIndex; } // FIXME: Spec says this should be short, but other indices are unsigned ints.
+ SpeechRecognitionResultList* resultHistory() const { return m_resultHistory.get(); }
+
+ // Event
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+private:
+ SpeechRecognitionEvent();
+ SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit&);
+ SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
+ SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>);
+
+ RefPtr<SpeechRecognitionResult> m_result;
+ RefPtr<SpeechRecognitionError> m_error;
+ short m_resultIndex;
+ RefPtr<SpeechRecognitionResultList> m_resultHistory;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // SpeechRecognitionEvent_h
Property changes on: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h
___________________________________________________________________
Added: svn:eol-style
Copied: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl (from rev 110419, trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl) (0 => 110420)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl 2012-03-12 11:27:51 UTC (rev 110420)
@@ -0,0 +1,36 @@
+/*
+ * 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 events {
+ interface [
+ Conditional=SCRIPTED_SPEECH,
+ ConstructorTemplate=Event
+ ] SpeechRecognitionEvent : Event {
+ readonly attribute [InitializedByEventConstructor] SpeechRecognitionResult result;
+ readonly attribute [InitializedByEventConstructor] SpeechRecognitionError error;
+ readonly attribute [InitializedByEventConstructor] short resultIndex;
+ readonly attribute [InitializedByEventConstructor] SpeechRecognitionResultList resultHistory;
+ };
+}
Modified: trunk/Source/WebCore/WebCore.gypi (110419 => 110420)
--- trunk/Source/WebCore/WebCore.gypi 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/WebCore.gypi 2012-03-12 11:27:51 UTC (rev 110420)
@@ -769,6 +769,7 @@
'Modules/speech/SpeechGrammarList.idl',
'Modules/speech/SpeechRecognitionAlternative.idl',
'Modules/speech/SpeechRecognitionError.idl',
+ 'Modules/speech/SpeechRecognitionEvent.idl',
'Modules/speech/SpeechRecognitionResult.idl',
'Modules/speech/SpeechRecognitionResultList.idl',
'Modules/webdatabase/DOMWindowSQLDatabase.idl',
@@ -1418,6 +1419,8 @@
'Modules/speech/SpeechRecognitionAlternative.h',
'Modules/speech/SpeechRecognitionError.cpp',
'Modules/speech/SpeechRecognitionError.h',
+ 'Modules/speech/SpeechRecognitionEvent.cpp',
+ 'Modules/speech/SpeechRecognitionEvent.h',
'Modules/speech/SpeechRecognitionResult.cpp',
'Modules/speech/SpeechRecognitionResult.h',
'Modules/speech/SpeechRecognitionResultList.cpp',
Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (110419 => 110420)
--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-03-12 11:27:51 UTC (rev 110420)
@@ -152,6 +152,7 @@
static bool scriptedSpeechEnabled() { return isScriptedSpeechEnabled; }
static bool webkitSpeechRecognitionEnabled() { return isScriptedSpeechEnabled; }
static bool webkitSpeechRecognitionErrorEnabled() { return isScriptedSpeechEnabled; }
+ static bool webkitSpeechRecognitionEventEnabled() { return isScriptedSpeechEnabled; }
static bool webkitSpeechGrammarEnabled() { return isScriptedSpeechEnabled; }
static bool webkitSpeechGrammarListEnabled() { return isScriptedSpeechEnabled; }
#endif
Modified: trunk/Source/WebCore/bindings/v8/OptionsObject.cpp (110419 => 110420)
--- trunk/Source/WebCore/bindings/v8/OptionsObject.cpp 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/bindings/v8/OptionsObject.cpp 2012-03-12 11:27:51 UTC (rev 110420)
@@ -43,6 +43,15 @@
#include "V8TextTrack.h"
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+#include "SpeechRecognitionError.h"
+#include "SpeechRecognitionResult.h"
+#include "SpeechRecognitionResultList.h"
+#include "V8SpeechRecognitionError.h"
+#include "V8SpeechRecognitionResult.h"
+#include "V8SpeechRecognitionResultList.h"
+#endif
+
namespace WebCore {
OptionsObject::OptionsObject()
@@ -168,6 +177,19 @@
return true;
}
+bool OptionsObject::get(const String& key, short& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
+ if (v8Int32.IsEmpty())
+ return false;
+ value = static_cast<short>(v8Int32->Value());
+ return true;
+}
+
bool OptionsObject::get(const String& key, unsigned& value) const
{
v8::Local<v8::Value> v8Value;
@@ -293,4 +315,58 @@
}
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+bool OptionsObject::get(const String& key, RefPtr<SpeechRecognitionError>& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ SpeechRecognitionError* source = 0;
+ if (v8Value->IsObject()) {
+ v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
+ v8::Handle<v8::Object> speechRecognitionError = V8DOMWrapper::lookupDOMWrapper(V8SpeechRecognitionError::GetTemplate(), wrapper);
+ if (!speechRecognitionError.IsEmpty())
+ source = V8SpeechRecognitionError::toNative(speechRecognitionError);
+ }
+ value = source;
+ return true;
+}
+
+bool OptionsObject::get(const String& key, RefPtr<SpeechRecognitionResult>& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ SpeechRecognitionResult* source = 0;
+ if (v8Value->IsObject()) {
+ v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
+ v8::Handle<v8::Object> speechRecognitionResult = V8DOMWrapper::lookupDOMWrapper(V8SpeechRecognitionResult::GetTemplate(), wrapper);
+ if (!speechRecognitionResult.IsEmpty())
+ source = V8SpeechRecognitionResult::toNative(speechRecognitionResult);
+ }
+ value = source;
+ return true;
+}
+
+bool OptionsObject::get(const String& key, RefPtr<SpeechRecognitionResultList>& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ SpeechRecognitionResultList* source = 0;
+ if (v8Value->IsObject()) {
+ v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
+ v8::Handle<v8::Object> speechRecognitionResultList = V8DOMWrapper::lookupDOMWrapper(V8SpeechRecognitionResultList::GetTemplate(), wrapper);
+ if (!speechRecognitionResultList.IsEmpty())
+ source = V8SpeechRecognitionResultList::toNative(speechRecognitionResultList);
+ }
+ value = source;
+ return true;
+}
+
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/OptionsObject.h (110419 => 110420)
--- trunk/Source/WebCore/bindings/v8/OptionsObject.h 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/bindings/v8/OptionsObject.h 2012-03-12 11:27:51 UTC (rev 110420)
@@ -40,6 +40,9 @@
class IDBKeyRange;
class Storage;
class TrackBase;
+class SpeechRecognitionError;
+class SpeechRecognitionResult;
+class SpeechRecognitionResultList;
class OptionsObject {
public:
@@ -57,6 +60,7 @@
bool get(const String&, double&) const;
bool get(const String&, String&) const;
bool get(const String&, ScriptValue&) const;
+ bool get(const String&, short&) const;
bool get(const String&, unsigned short&) const;
bool get(const String&, unsigned&) const;
bool get(const String&, unsigned long long&) const;
@@ -66,6 +70,11 @@
#if ENABLE(VIDEO_TRACK)
bool get(const String&, RefPtr<TrackBase>&) const;
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ bool get(const String&, RefPtr<SpeechRecognitionError>&) const;
+ bool get(const String&, RefPtr<SpeechRecognitionResult>&) const;
+ bool get(const String&, RefPtr<SpeechRecognitionResultList>&) const;
+#endif
bool get(const String&, HashSet<AtomicString>&) const;
bool getWithUndefinedOrNullCheck(const String&, String&) const;
Modified: trunk/Source/WebCore/dom/EventNames.h (110419 => 110420)
--- trunk/Source/WebCore/dom/EventNames.h 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/dom/EventNames.h 2012-03-12 11:27:51 UTC (rev 110420)
@@ -185,6 +185,18 @@
\
macro(webkitspeechchange) \
\
+ macro(audiostart) \
+ macro(soundstart) \
+ macro(speechstart) \
+ macro(speechend) \
+ macro(soundend) \
+ macro(audioend) \
+ macro(result) \
+ macro(nomatch) \
+ macro(resultdeleted) \
+ macro(start) \
+ macro(end) \
+ \
macro(webglcontextlost) \
macro(webglcontextrestored) \
macro(webglcontextcreationerror) \
Modified: trunk/Source/WebCore/dom/EventNames.in (110419 => 110420)
--- trunk/Source/WebCore/dom/EventNames.in 2012-03-12 09:50:38 UTC (rev 110419)
+++ trunk/Source/WebCore/dom/EventNames.in 2012-03-12 11:27:51 UTC (rev 110420)
@@ -31,6 +31,7 @@
OfflineAudioCompletionEvent conditional=WEB_AUDIO
MediaStreamEvent conditional=MEDIA_STREAM
SpeechInputEvent conditional=INPUT_SPEECH
+SpeechRecognitionEvent conditional=SCRIPTED_SPEECH
WebGLContextEvent conditional=WEBGL
StorageEvent
SVGEvents interfaceName=Event, conditional=SVG