Diff
Modified: trunk/LayoutTests/ChangeLog (120816 => 120817)
--- trunk/LayoutTests/ChangeLog 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/LayoutTests/ChangeLog 2012-06-20 12:35:41 UTC (rev 120817)
@@ -1,3 +1,15 @@
+2012-06-20 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: add SpeechRecognition.maxAlternatives attribute
+ https://bugs.webkit.org/show_bug.cgi?id=89459
+
+ Reviewed by Eric Seidel.
+
+ Update the basic test to check for presence of the maxAlternatives attribute.
+
+ * fast/speech/scripted/basics-expected.txt:
+ * fast/speech/scripted/basics.html:
+
2012-06-20 Takashi Sakamoto <[email protected]>
applyAuthorStyles makes rules declared in all enclosing shadow dom subtrees applicable.
Modified: trunk/LayoutTests/fast/speech/scripted/basics-expected.txt (120816 => 120817)
--- trunk/LayoutTests/fast/speech/scripted/basics-expected.txt 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/LayoutTests/fast/speech/scripted/basics-expected.txt 2012-06-20 12:35:41 UTC (rev 120817)
@@ -11,6 +11,7 @@
PASS speechReco.grammars.length === 0 is true
PASS 'lang' in speechReco is true
PASS 'continuous' in speechReco is true
+PASS 'maxAlternatives' in speechReco is true
PASS 'start' in speechReco is true
PASS 'stop' in speechReco is true
PASS 'abort' in speechReco is true
@@ -29,4 +30,7 @@
PASS 'addEventListener' in speechReco is true
PASS 'removeEventListener' in speechReco is true
PASS 'dispatchEvent' in speechReco is true
+PASS speechReco.lang is ''
+PASS speechReco.continuous is false
+PASS speechReco.maxAlternatives is 1
Modified: trunk/LayoutTests/fast/speech/scripted/basics.html (120816 => 120817)
--- trunk/LayoutTests/fast/speech/scripted/basics.html 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/LayoutTests/fast/speech/scripted/basics.html 2012-06-20 12:35:41 UTC (rev 120817)
@@ -20,6 +20,7 @@
shouldBeTrue("speechReco.grammars.length === 0");
shouldBeTrue("'lang' in speechReco");
shouldBeTrue("'continuous' in speechReco");
+ shouldBeTrue("'maxAlternatives' in speechReco");
shouldBeTrue("'start' in speechReco");
shouldBeTrue("'stop' in speechReco");
shouldBeTrue("'abort' in speechReco");
@@ -40,6 +41,12 @@
shouldBeTrue("'removeEventListener' in speechReco");
shouldBeTrue("'dispatchEvent' in speechReco");
+ // Check default values.
+ // FIXME: The spec should say what the default value for .grammars is.
+ shouldBe("speechReco.lang", "''");
+ shouldBe("speechReco.continuous", "false");
+ shouldBe("speechReco.maxAlternatives", "1");
+
finishJSTest();
}
Modified: trunk/Source/WebCore/ChangeLog (120816 => 120817)
--- trunk/Source/WebCore/ChangeLog 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/ChangeLog 2012-06-20 12:35:41 UTC (rev 120817)
@@ -1,3 +1,28 @@
+2012-06-20 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: add SpeechRecognition.maxAlternatives attribute
+ https://bugs.webkit.org/show_bug.cgi?id=89459
+
+ Reviewed by Eric Seidel.
+
+ Add the SpeechRecognition.maxAlternatives attribute.
+
+ Test: fast/speech/scripted/basics.html:
+
+ * Modules/speech/SpeechRecognition.cpp:
+ (WebCore::SpeechRecognition::start):
+ (WebCore::SpeechRecognition::SpeechRecognition):
+ * Modules/speech/SpeechRecognition.h:
+ (WebCore::SpeechRecognition::maxAlternatives):
+ (WebCore::SpeechRecognition::setMaxAlternatives):
+ (SpeechRecognition):
+ * Modules/speech/SpeechRecognition.idl:
+ * Modules/speech/SpeechRecognitionClient.h:
+ (SpeechRecognitionClient):
+ * Modules/speech/SpeechRecognitionController.h:
+ (WebCore::SpeechRecognitionController::start):
+ (SpeechRecognitionController):
+
2012-06-20 Takashi Sakamoto <[email protected]>
applyAuthorStyles makes rules declared in all enclosing shadow dom subtrees applicable.
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp (120816 => 120817)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp 2012-06-20 12:35:41 UTC (rev 120817)
@@ -47,7 +47,7 @@
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);
+ m_controller->start(this, m_grammars.get(), m_lang, m_continuous, m_maxAlternatives);
}
void SpeechRecognition::stopFunction()
@@ -137,6 +137,7 @@
: 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_maxAlternatives(1)
, m_controller(0)
{
ASSERT(scriptExecutionContext()->isDocument());
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.h (120816 => 120817)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.h 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.h 2012-06-20 12:35:41 UTC (rev 120817)
@@ -58,6 +58,9 @@
bool continuous() { return m_continuous; }
void setContinuous(bool continuous) { m_continuous = continuous; }
+ unsigned long maxAlternatives() { return m_maxAlternatives; }
+ void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives = maxAlternatives; }
+
// Callable by the user.
void start();
void stopFunction();
@@ -112,6 +115,7 @@
RefPtr<SpeechGrammarList> m_grammars;
String m_lang;
bool m_continuous;
+ unsigned long m_maxAlternatives;
EventTargetData m_eventTargetData;
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl (120816 => 120817)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.idl 2012-06-20 12:35:41 UTC (rev 120817)
@@ -34,6 +34,7 @@
attribute SpeechGrammarList grammars;
attribute DOMString lang;
attribute boolean continuous;
+ attribute unsigned long maxAlternatives;
void start();
[ImplementedAs=stopFunction] void stop();
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h (120816 => 120817)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionClient.h 2012-06-20 12:35:41 UTC (rev 120817)
@@ -38,7 +38,7 @@
class SpeechRecognitionClient {
public:
- virtual void start(SpeechRecognition*, const SpeechGrammarList*, const String& lang, bool continuous) = 0;
+ virtual void start(SpeechRecognition*, const SpeechGrammarList*, const String& lang, bool continuous, unsigned long maxAlternatives) = 0;
virtual void stop(SpeechRecognition*) = 0;
virtual void abort(SpeechRecognition*) = 0;
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h (120816 => 120817)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h 2012-06-20 12:35:41 UTC (rev 120817)
@@ -38,7 +38,11 @@
public:
virtual ~SpeechRecognitionController();
- void start(SpeechRecognition* recognition, const SpeechGrammarList* grammars, const String& lang, bool continuous) { m_client->start(recognition, grammars, lang, continuous); }
+ void start(SpeechRecognition* recognition, const SpeechGrammarList* grammars, const String& lang, bool continuous, unsigned long maxAlternatives)
+ {
+ m_client->start(recognition, grammars, lang, continuous, maxAlternatives);
+ }
+
void stop(SpeechRecognition* recognition) { m_client->stop(recognition); }
void abort(SpeechRecognition* recognition) { m_client->abort(recognition); }
Modified: trunk/Source/WebKit/chromium/ChangeLog (120816 => 120817)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-20 12:35:41 UTC (rev 120817)
@@ -1,3 +1,21 @@
+2012-06-20 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: add SpeechRecognition.maxAlternatives attribute
+ https://bugs.webkit.org/show_bug.cgi?id=89459
+
+ Reviewed by Eric Seidel.
+
+ Plumbing for the maxAlternatives attribute.
+
+ * public/WebSpeechRecognitionParams.h:
+ (WebKit::WebSpeechRecognitionParams::WebSpeechRecognitionParams):
+ (WebKit::WebSpeechRecognitionParams::maxAlternatives):
+ (WebSpeechRecognitionParams):
+ * src/SpeechRecognitionClientProxy.cpp:
+ (WebKit::SpeechRecognitionClientProxy::start):
+ * src/SpeechRecognitionClientProxy.h:
+ (SpeechRecognitionClientProxy):
+
2012-06-20 Hironori Bono <[email protected]>
[chromium] Select the marker range when right-clicking on a marker.
Modified: trunk/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h (120816 => 120817)
--- trunk/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h 2012-06-20 12:35:41 UTC (rev 120817)
@@ -37,10 +37,11 @@
class WebSpeechRecognitionParams {
public:
- WebSpeechRecognitionParams(const WebVector<WebSpeechGrammar>& grammars, const WebString& language, bool continuous, const WebSecurityOrigin& origin)
+ WebSpeechRecognitionParams(const WebVector<WebSpeechGrammar>& grammars, const WebString& language, bool continuous, unsigned long maxAlternatives, const WebSecurityOrigin& origin)
: m_grammars(grammars)
, m_language(language)
, m_continuous(continuous)
+ , m_maxAlternatives(maxAlternatives)
, m_origin(origin)
{
}
@@ -48,12 +49,14 @@
const WebVector<WebSpeechGrammar>& grammars() const { return m_grammars; }
const WebString& language() const { return m_language; }
bool continuous() const { return m_continuous; }
+ unsigned long maxAlternatives() const { return m_maxAlternatives; }
const WebSecurityOrigin& origin() const { return m_origin; }
private:
WebVector<WebSpeechGrammar> m_grammars;
WebString m_language;
bool m_continuous;
+ unsigned long m_maxAlternatives;
WebSecurityOrigin m_origin;
};
Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp (120816 => 120817)
--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp 2012-06-20 12:35:41 UTC (rev 120817)
@@ -55,13 +55,13 @@
return adoptPtr(new SpeechRecognitionClientProxy(recognizer));
}
-void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous)
+void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous, unsigned long maxAlternatives)
{
WebVector<WebSpeechGrammar> webSpeechGrammars(static_cast<size_t>(grammarList->length()));
for (unsigned long i = 0; i < grammarList->length(); ++i)
webSpeechGrammars[i] = grammarList->item(i);
- WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, WebSecurityOrigin(recognition->scriptExecutionContext()->securityOrigin()));
+ WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, maxAlternatives, WebSecurityOrigin(recognition->scriptExecutionContext()->securityOrigin()));
m_recognizer->start(WebSpeechRecognitionHandle(recognition), params, this);
}
Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h (120816 => 120817)
--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h 2012-06-20 11:48:24 UTC (rev 120816)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h 2012-06-20 12:35:41 UTC (rev 120817)
@@ -46,7 +46,7 @@
static PassOwnPtr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*);
// WebCore::SpeechRecognitionClient:
- virtual void start(WebCore::SpeechRecognition*, const WebCore::SpeechGrammarList*, const String& lang, bool continuous) OVERRIDE;
+ virtual void start(WebCore::SpeechRecognition*, const WebCore::SpeechGrammarList*, const String& lang, bool continuous, unsigned long maxAlternatives) OVERRIDE;
virtual void stop(WebCore::SpeechRecognition*) OVERRIDE;
virtual void abort(WebCore::SpeechRecognition*) OVERRIDE;