OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 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 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2739 } | 2739 } |
2740 | 2740 |
2741 m_audioTracks->removeAll(); | 2741 m_audioTracks->removeAll(); |
2742 m_videoTracks->removeAll(); | 2742 m_videoTracks->removeAll(); |
2743 | 2743 |
2744 m_audioTracksTimer.stop(); | 2744 m_audioTracksTimer.stop(); |
2745 } | 2745 } |
2746 | 2746 |
2747 PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicStr
ing& kind, const AtomicString& label, const AtomicString& language, ExceptionSta
te& exceptionState) | 2747 PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicStr
ing& kind, const AtomicString& label, const AtomicString& language, ExceptionSta
te& exceptionState) |
2748 { | 2748 { |
2749 // 4.8.10.12.4 Text track API | 2749 // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-ad
dtexttrack |
2750 // The addTextTrack(kind, label, language) method of media elements, when in
voked, must run the following steps: | |
2751 | 2750 |
2752 // 1. If kind is not one of the following strings, then throw a SyntaxError
exception and abort these steps | 2751 // The addTextTrack(kind, label, language) method of media elements, when |
2753 if (!TextTrack::isValidKindKeyword(kind)) { | 2752 // invoked, must run the following steps: |
2754 exceptionState.throwDOMException(SyntaxError, "The 'kind' provided ('" +
kind + "') is invalid."); | |
2755 return nullptr; | |
2756 } | |
2757 | 2753 |
2758 // 2. If the label argument was omitted, let label be the empty string. | 2754 // 1. Create a new TextTrack object. |
2759 // 3. If the language argument was omitted, let language be the empty string
. | 2755 // 2. Create a new text track corresponding to the new object, and set its |
2760 // 4. Create a new TextTrack object. | 2756 // text track kind to kind, its text track label to label, its text |
| 2757 // track language to language, ..., and its text track list of cues to |
| 2758 // an empty list. |
| 2759 RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(kind, label, lan
guage); |
| 2760 // ..., its text track readiness state to the text track loaded state, ..
. |
| 2761 textTrack->setReadinessState(TextTrack::Loaded); |
2761 | 2762 |
2762 // 5. Create a new text track corresponding to the new object, and set its t
ext track kind to kind, its text | 2763 // 3. Add the new text track to the media element's list of text tracks. |
2763 // track label to label, its text track language to language... | 2764 // 4. Queue a task to fire a trusted event with the name addtrack, that |
2764 RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(kind, label, lan
guage); | 2765 // does not bubble and is not cancelable, and that uses the TrackEvent |
2765 | 2766 // interface, with the track attribute initialised to the new text |
2766 // Note, due to side effects when changing track parameters, we have to | 2767 // track's TextTrack object, at the media element's textTracks |
2767 // first append the track to the text track list. | 2768 // attribute's TextTrackList object. |
2768 | |
2769 // 6. Add the new text track to the media element's list of text tracks. | |
2770 addTextTrack(textTrack.get()); | 2769 addTextTrack(textTrack.get()); |
2771 | 2770 |
2772 // ... its text track readiness state to the text track loaded state ... | 2771 // Note: Due to side effects when changing track parameters, we have to |
2773 textTrack->setReadinessState(TextTrack::Loaded); | 2772 // first append the track to the text track list. |
| 2773 // FIXME: Since setMode() will cause a 'change' event to be queued on the |
| 2774 // same task source as the 'addtrack' event (see above), the order is |
| 2775 // wrong. (The 'change' event shouldn't be fired at all in this case...) |
2774 | 2776 |
2775 // ... its text track mode to the text track hidden mode, and its text track
list of cues to an empty list ... | 2777 // ..., its text track mode to the text track hidden mode, ... |
2776 textTrack->setMode(TextTrack::hiddenKeyword()); | 2778 textTrack->setMode(TextTrack::hiddenKeyword()); |
2777 | 2779 |
| 2780 // 5. Return the new TextTrack object. |
2778 return textTrack.release(); | 2781 return textTrack.release(); |
2779 } | 2782 } |
2780 | 2783 |
2781 TextTrackList* HTMLMediaElement::textTracks() | 2784 TextTrackList* HTMLMediaElement::textTracks() |
2782 { | 2785 { |
2783 if (!m_textTracks) | 2786 if (!m_textTracks) |
2784 m_textTracks = TextTrackList::create(this); | 2787 m_textTracks = TextTrackList::create(this); |
2785 | 2788 |
2786 return m_textTracks.get(); | 2789 return m_textTracks.get(); |
2787 } | 2790 } |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 | 4109 |
4107 #if ENABLE(WEB_AUDIO) | 4110 #if ENABLE(WEB_AUDIO) |
4108 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4111 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4109 { | 4112 { |
4110 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4113 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4111 audioSourceProvider()->setClient(nullptr); | 4114 audioSourceProvider()->setClient(nullptr); |
4112 } | 4115 } |
4113 #endif | 4116 #endif |
4114 | 4117 |
4115 } | 4118 } |
OLD | NEW |