Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp

Issue 2367693003: Fix SpeechSynthesisEvent.elapsedTime (Closed)
Patch Set: Fix expectation Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 void SpeechSynthesis::resume() 133 void SpeechSynthesis::resume()
134 { 134 {
135 if (!currentSpeechUtterance()) 135 if (!currentSpeechUtterance())
136 return; 136 return;
137 m_platformSpeechSynthesizer->resume(); 137 m_platformSpeechSynthesizer->resume();
138 } 138 }
139 139
140 void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtteran ce* utterance, unsigned long charIndex, const String& name) 140 void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtteran ce* utterance, unsigned long charIndex, const String& name)
141 { 141 {
142 if (getExecutionContext() && !getExecutionContext()->activeDOMObjectsAreStop ped()) 142 if (getExecutionContext() && !getExecutionContext()->activeDOMObjectsAreStop ped()) {
143 utterance->dispatchEvent(SpeechSynthesisEvent::create(type, utterance, c harIndex, (currentTime() - utterance->startTime()), name)); 143 double elapsedTimeMillis = (monotonicallyIncreasingTime() - utterance->s tartTime()) * 1000.0;
144 utterance->dispatchEvent(SpeechSynthesisEvent::create(type, utterance, c harIndex, elapsedTimeMillis, name));
145 }
144 } 146 }
145 147
146 void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc e, bool errorOccurred) 148 void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc e, bool errorOccurred)
147 { 149 {
148 ASSERT(utterance); 150 ASSERT(utterance);
149 151
150 bool shouldStartSpeaking = false; 152 bool shouldStartSpeaking = false;
151 // If the utterance that completed was the one we're currently speaking, 153 // If the utterance that completed was the one we're currently speaking,
152 // remove it from the queue and start speaking the next one. 154 // remove it from the queue and start speaking the next one.
153 if (utterance == currentSpeechUtterance()) { 155 if (utterance == currentSpeechUtterance()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 234 {
233 visitor->trace(m_platformSpeechSynthesizer); 235 visitor->trace(m_platformSpeechSynthesizer);
234 visitor->trace(m_voiceList); 236 visitor->trace(m_voiceList);
235 visitor->trace(m_utteranceQueue); 237 visitor->trace(m_utteranceQueue);
236 PlatformSpeechSynthesizerClient::trace(visitor); 238 PlatformSpeechSynthesizerClient::trace(visitor);
237 EventTargetWithInlineData::trace(visitor); 239 EventTargetWithInlineData::trace(visitor);
238 ContextLifecycleObserver::trace(visitor); 240 ContextLifecycleObserver::trace(visitor);
239 } 241 }
240 242
241 } // namespace blink 243 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698