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 25 matching lines...) Expand all Loading... |
36 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ExecutionContext* context, co
nst String& text) | 36 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ExecutionContext* context, co
nst String& text) |
37 : ContextLifecycleObserver(context) | 37 : ContextLifecycleObserver(context) |
38 , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this)) | 38 , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this)) |
39 { | 39 { |
40 ScriptWrappable::init(this); | 40 ScriptWrappable::init(this); |
41 m_platformUtterance->setText(text); | 41 m_platformUtterance->setText(text); |
42 } | 42 } |
43 | 43 |
44 SpeechSynthesisUtterance::~SpeechSynthesisUtterance() | 44 SpeechSynthesisUtterance::~SpeechSynthesisUtterance() |
45 { | 45 { |
46 m_platformUtterance->setClient(0); | |
47 } | 46 } |
48 | 47 |
49 ExecutionContext* SpeechSynthesisUtterance::executionContext() const | 48 ExecutionContext* SpeechSynthesisUtterance::executionContext() const |
50 { | 49 { |
51 return ContextLifecycleObserver::executionContext(); | 50 return ContextLifecycleObserver::executionContext(); |
52 } | 51 } |
53 | 52 |
54 const AtomicString& SpeechSynthesisUtterance::interfaceName() const | 53 const AtomicString& SpeechSynthesisUtterance::interfaceName() const |
55 { | 54 { |
56 return EventTargetNames::SpeechSynthesisUtterance; | 55 return EventTargetNames::SpeechSynthesisUtterance; |
57 } | 56 } |
58 | 57 |
59 SpeechSynthesisVoice* SpeechSynthesisUtterance::voice() const | 58 SpeechSynthesisVoice* SpeechSynthesisUtterance::voice() const |
60 { | 59 { |
61 return m_voice.get(); | 60 return m_voice.get(); |
62 } | 61 } |
63 | 62 |
64 void SpeechSynthesisUtterance::setVoice(SpeechSynthesisVoice* voice) | 63 void SpeechSynthesisUtterance::setVoice(SpeechSynthesisVoice* voice) |
65 { | 64 { |
66 // Cache our own version of the SpeechSynthesisVoice so that we don't have t
o do some lookup | 65 // Cache our own version of the SpeechSynthesisVoice so that we don't have t
o do some lookup |
67 // to go from the platform voice back to the speech synthesis voice in the r
ead property. | 66 // to go from the platform voice back to the speech synthesis voice in the r
ead property. |
68 m_voice = voice; | 67 m_voice = voice; |
69 | 68 |
70 if (voice) | 69 if (voice) |
71 m_platformUtterance->setVoice(voice->platformVoice()); | 70 m_platformUtterance->setVoice(voice->platformVoice()); |
72 } | 71 } |
73 | 72 |
74 void SpeechSynthesisUtterance::trace(Visitor* visitor) | 73 void SpeechSynthesisUtterance::trace(Visitor* visitor) |
75 { | 74 { |
| 75 visitor->trace(m_platformUtterance); |
76 visitor->trace(m_voice); | 76 visitor->trace(m_voice); |
77 EventTargetWithInlineData::trace(visitor); | 77 EventTargetWithInlineData::trace(visitor); |
78 } | 78 } |
79 | 79 |
80 } // namespace WebCore | 80 } // namespace WebCore |
OLD | NEW |