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 // 4.8.14.12.5 Text track API |
philipj_slow
2015/01/19 14:26:29
Given the direct link this isn't very useful, and
fs
2015/01/19 14:55:06
Dropped.
| |
2753 if (!TextTrack::isValidKindKeyword(kind)) { | 2752 // The addTextTrack(kind, label, language) method of media elements, when |
2754 exceptionState.throwDOMException(SyntaxError, "The 'kind' provided ('" + kind + "') is invalid."); | 2753 // invoked, must run the following steps: |
2755 return nullptr; | |
2756 } | |
2757 | 2754 |
2758 // 2. If the label argument was omitted, let label be the empty string. | 2755 // 1. Create a new TextTrack object. |
2759 // 3. If the language argument was omitted, let language be the empty string . | 2756 // 2. Create a new text track corresponding to the new object, and set its |
2760 // 4. Create a new TextTrack object. | 2757 // text track kind to kind, its text track label to label, its text |
2758 // track language to language, ..., and its text track list of cues to | |
2759 // an empty list. | |
2760 RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(kind, label, lan guage); | |
2761 // ..., its text track readiness state to the text track loaded state, .. . | |
2762 textTrack->setReadinessState(TextTrack::Loaded); | |
2761 | 2763 |
2762 // 5. Create a new text track corresponding to the new object, and set its t ext track kind to kind, its text | 2764 // 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... | 2765 // 4. Queue a task to fire a trusted event with the name addtrack, that |
2764 RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(kind, label, lan guage); | 2766 // does not bubble and is not cancelable, and that uses the TrackEvent |
2765 | 2767 // interface, with the track attribute initialised to the new text |
2766 // Note, due to side effects when changing track parameters, we have to | 2768 // track's TextTrack object, at the media element's textTracks |
2767 // first append the track to the text track list. | 2769 // 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()); | 2770 addTextTrack(textTrack.get()); |
2771 | 2771 |
2772 // ... its text track readiness state to the text track loaded state ... | 2772 // Note: Due to side effects when changing track parameters, we have to |
2773 textTrack->setReadinessState(TextTrack::Loaded); | 2773 // first append the track to the text track list. |
2774 // FIXME: Since setMode() will cause a 'change' event to be queued on the | |
2775 // same task source as the 'addtrack' event (see above), meaning the order | |
philipj_slow
2015/01/19 14:26:29
s/meaning//
fs
2015/01/19 14:55:06
Done.
| |
2776 // is wrong. (If the 'change' event should be fired at all in this case...) | |
philipj_slow
2015/01/19 14:26:29
The spec says "Whenever a text track that is in a
fs
2015/01/19 14:55:06
Yes, my interpretation was that 'change' should no
| |
2774 | 2777 |
2775 // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ... | 2778 // ..., its text track mode to the text track hidden mode, ... |
2776 textTrack->setMode(TextTrack::hiddenKeyword()); | 2779 textTrack->setMode(TextTrack::hiddenKeyword()); |
2777 | 2780 |
2781 // 5. Return the new TextTrack object. | |
2778 return textTrack.release(); | 2782 return textTrack.release(); |
2779 } | 2783 } |
2780 | 2784 |
2781 TextTrackList* HTMLMediaElement::textTracks() | 2785 TextTrackList* HTMLMediaElement::textTracks() |
2782 { | 2786 { |
2783 if (!m_textTracks) | 2787 if (!m_textTracks) |
2784 m_textTracks = TextTrackList::create(this); | 2788 m_textTracks = TextTrackList::create(this); |
2785 | 2789 |
2786 return m_textTracks.get(); | 2790 return m_textTracks.get(); |
2787 } | 2791 } |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4106 | 4110 |
4107 #if ENABLE(WEB_AUDIO) | 4111 #if ENABLE(WEB_AUDIO) |
4108 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4112 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4109 { | 4113 { |
4110 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4114 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4111 audioSourceProvider()->setClient(nullptr); | 4115 audioSourceProvider()->setClient(nullptr); |
4112 } | 4116 } |
4113 #endif | 4117 #endif |
4114 | 4118 |
4115 } | 4119 } |
OLD | NEW |