OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 SpeechSynthesisUtterance* SpeechSynthesisUtterance::create( | 32 SpeechSynthesisUtterance* SpeechSynthesisUtterance::create( |
33 ExecutionContext* context, | 33 ExecutionContext* context, |
34 const String& text) { | 34 const String& text) { |
35 return new SpeechSynthesisUtterance(context, text); | 35 return new SpeechSynthesisUtterance(context, text); |
36 } | 36 } |
37 | 37 |
38 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ExecutionContext* context, | 38 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ExecutionContext* context, |
39 const String& text) | 39 const String& text) |
40 : m_executionContext(context), | 40 : ContextClient(context), |
41 m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this)) { | 41 m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this)) { |
42 m_platformUtterance->setText(text); | 42 m_platformUtterance->setText(text); |
43 } | 43 } |
44 | 44 |
45 SpeechSynthesisUtterance::~SpeechSynthesisUtterance() {} | 45 SpeechSynthesisUtterance::~SpeechSynthesisUtterance() {} |
46 | 46 |
47 ExecutionContext* SpeechSynthesisUtterance::getExecutionContext() const { | |
48 return m_executionContext; | |
49 } | |
50 | |
51 const AtomicString& SpeechSynthesisUtterance::interfaceName() const { | 47 const AtomicString& SpeechSynthesisUtterance::interfaceName() const { |
52 return EventTargetNames::SpeechSynthesisUtterance; | 48 return EventTargetNames::SpeechSynthesisUtterance; |
53 } | 49 } |
54 | 50 |
55 SpeechSynthesisVoice* SpeechSynthesisUtterance::voice() const { | 51 SpeechSynthesisVoice* SpeechSynthesisUtterance::voice() const { |
56 return m_voice; | 52 return m_voice; |
57 } | 53 } |
58 | 54 |
59 void SpeechSynthesisUtterance::setVoice(SpeechSynthesisVoice* voice) { | 55 void SpeechSynthesisUtterance::setVoice(SpeechSynthesisVoice* voice) { |
60 // Cache our own version of the SpeechSynthesisVoice so that we don't have to | 56 // Cache our own version of the SpeechSynthesisVoice so that we don't have to |
61 // do some lookup to go from the platform voice back to the speech synthesis | 57 // do some lookup to go from the platform voice back to the speech synthesis |
62 // voice in the read property. | 58 // voice in the read property. |
63 m_voice = voice; | 59 m_voice = voice; |
64 | 60 |
65 if (voice) | 61 if (voice) |
66 m_platformUtterance->setVoice(voice->platformVoice()); | 62 m_platformUtterance->setVoice(voice->platformVoice()); |
67 } | 63 } |
68 | 64 |
69 DEFINE_TRACE(SpeechSynthesisUtterance) { | 65 DEFINE_TRACE(SpeechSynthesisUtterance) { |
70 visitor->trace(m_executionContext); | |
71 visitor->trace(m_platformUtterance); | 66 visitor->trace(m_platformUtterance); |
72 visitor->trace(m_voice); | 67 visitor->trace(m_voice); |
| 68 ContextClient::trace(visitor); |
73 EventTargetWithInlineData::trace(visitor); | 69 EventTargetWithInlineData::trace(visitor); |
74 } | 70 } |
75 | 71 |
76 } // namespace blink | 72 } // namespace blink |
OLD | NEW |