|
Lines 259-264
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
a/Source/WebCore/html/HTMLMediaElement.cpp_sec1
|
| 259 |
, m_lastTextTrackUpdateTime(-1) |
259 |
, m_lastTextTrackUpdateTime(-1) |
| 260 |
, m_textTracks(0) |
260 |
, m_textTracks(0) |
| 261 |
, m_ignoreTrackDisplayUpdate(0) |
261 |
, m_ignoreTrackDisplayUpdate(0) |
|
|
262 |
, m_ignoreDefaultTracks(false) |
| 262 |
#endif |
263 |
#endif |
| 263 |
#if ENABLE(WEB_AUDIO) |
264 |
#if ENABLE(WEB_AUDIO) |
| 264 |
, m_audioSourceNode(0) |
265 |
, m_audioSourceNode(0) |
|
Lines 736-742
void HTMLMediaElement::prepareForLoad()
a/Source/WebCore/html/HTMLMediaElement.cpp_sec2
|
| 736 |
|
737 |
|
| 737 |
m_playedTimeRanges = TimeRanges::create(); |
738 |
m_playedTimeRanges = TimeRanges::create(); |
| 738 |
m_lastSeekTime = 0; |
739 |
m_lastSeekTime = 0; |
| 739 |
m_closedCaptionsVisible = false; |
|
|
| 740 |
|
740 |
|
| 741 |
// The spec doesn't say to block the load event until we actually run the asynchronous section |
741 |
// The spec doesn't say to block the load event until we actually run the asynchronous section |
| 742 |
// algorithm, but do it now because we won't start that until after the timer fires and the |
742 |
// algorithm, but do it now because we won't start that until after the timer fires and the |
|
Lines 2789-2794
bool HTMLMediaElement::userIsInterestedInThisTrackKind(String kind) const
a/Source/WebCore/html/HTMLMediaElement.cpp_sec3
|
| 2789 |
if (!settings) |
2789 |
if (!settings) |
| 2790 |
return false; |
2790 |
return false; |
| 2791 |
|
2791 |
|
|
|
2792 |
if (m_ignoreDefaultTracks) |
| 2793 |
return false; |
| 2794 |
|
| 2795 |
if (m_closedCaptionsVisible) |
| 2796 |
return true; |
| 2797 |
|
| 2792 |
if (kind == TextTrack::subtitlesKeyword()) |
2798 |
if (kind == TextTrack::subtitlesKeyword()) |
| 2793 |
return settings->shouldDisplaySubtitles(); |
2799 |
return settings->shouldDisplaySubtitles(); |
| 2794 |
if (kind == TextTrack::captionsKeyword()) |
2800 |
if (kind == TextTrack::captionsKeyword()) |
|
Lines 3920-3926
PlatformLayer* HTMLMediaElement::platformLayer() const
a/Source/WebCore/html/HTMLMediaElement.cpp_sec4
|
| 3920 |
|
3926 |
|
| 3921 |
bool HTMLMediaElement::hasClosedCaptions() const |
3927 |
bool HTMLMediaElement::hasClosedCaptions() const |
| 3922 |
{ |
3928 |
{ |
| 3923 |
return m_player && m_player->hasClosedCaptions(); |
3929 |
if (m_player && m_player->hasClosedCaptions()) |
|
|
3930 |
return true; |
| 3931 |
|
| 3932 |
#if ENABLE(VIDEO_TRACK) |
| 3933 |
if (RuntimeEnabledFeatures::webkitVideoTrackEnabled() && m_textTracks) |
| 3934 |
for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
| 3935 |
if (m_textTracks->item(i)->kind() == TextTrack::captionsKeyword() |
| 3936 |
|| m_textTracks->item(i)->kind() == TextTrack::subtitlesKeyword()) |
| 3937 |
return true; |
| 3938 |
} |
| 3939 |
#endif |
| 3940 |
return false; |
| 3924 |
} |
3941 |
} |
| 3925 |
|
3942 |
|
| 3926 |
bool HTMLMediaElement::closedCaptionsVisible() const |
3943 |
bool HTMLMediaElement::closedCaptionsVisible() const |
|
Lines 3932-3944
void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
a/Source/WebCore/html/HTMLMediaElement.cpp_sec5
|
| 3932 |
{ |
3949 |
{ |
| 3933 |
LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString(closedCaptionVisible)); |
3950 |
LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString(closedCaptionVisible)); |
| 3934 |
|
3951 |
|
| 3935 |
if (!m_player ||!hasClosedCaptions()) |
3952 |
if (!m_player || !hasClosedCaptions()) |
| 3936 |
return; |
3953 |
return; |
| 3937 |
|
3954 |
|
| 3938 |
m_closedCaptionsVisible = closedCaptionVisible; |
3955 |
m_closedCaptionsVisible = closedCaptionVisible; |
|
|
3956 |
m_ignoreDefaultTracks = !m_closedCaptionsVisible; |
| 3939 |
m_player->setClosedCaptionsVisible(closedCaptionVisible); |
3957 |
m_player->setClosedCaptionsVisible(closedCaptionVisible); |
|
|
3958 |
|
| 3959 |
#if ENABLE(VIDEO_TRACK) |
| 3960 |
if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) { |
| 3961 |
// Check whether existing caption/subtitle tracks should change visibility. |
| 3962 |
for (Node* node = firstChild(); node; node = node->nextSibling()) { |
| 3963 |
if (!node->hasTagName(trackTag)) |
| 3964 |
continue; |
| 3965 |
HTMLTrackElement* trackElement = static_cast<HTMLTrackElement*>(node); |
| 3966 |
trackElement->setHasBeenConfigured(false); |
| 3967 |
} |
| 3968 |
|
| 3969 |
configureNewTextTracks(); |
| 3970 |
} |
| 3971 |
#else |
| 3940 |
if (hasMediaControls()) |
3972 |
if (hasMediaControls()) |
| 3941 |
mediaControls()->changedClosedCaptionsVisibility(); |
3973 |
mediaControls()->changedClosedCaptionsVisibility(); |
|
|
3974 |
#endif |
| 3942 |
} |
3975 |
} |
| 3943 |
|
3976 |
|
| 3944 |
void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible) |
3977 |
void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible) |
|
Lines 4102-4113
void HTMLMediaElement::configureTextTrackDisplay()
a/Source/WebCore/html/HTMLMediaElement.cpp_sec6
|
| 4102 |
if (m_haveVisibleTextTrack == haveVisibleTextTrack) |
4135 |
if (m_haveVisibleTextTrack == haveVisibleTextTrack) |
| 4103 |
return; |
4136 |
return; |
| 4104 |
m_haveVisibleTextTrack = haveVisibleTextTrack; |
4137 |
m_haveVisibleTextTrack = haveVisibleTextTrack; |
|
|
4138 |
m_closedCaptionsVisible = m_haveVisibleTextTrack; |
| 4105 |
|
4139 |
|
| 4106 |
if (!m_haveVisibleTextTrack && !hasMediaControls()) |
4140 |
if (!m_haveVisibleTextTrack && !hasMediaControls()) |
| 4107 |
return; |
4141 |
return; |
| 4108 |
if (!hasMediaControls() && !createMediaControls()) |
4142 |
if (!hasMediaControls() && !createMediaControls()) |
| 4109 |
return; |
4143 |
return; |
| 4110 |
mediaControls()->updateTextTrackDisplay(); |
4144 |
|
|
|
4145 |
updateClosedCaptionsControls(); |
| 4146 |
} |
| 4147 |
|
| 4148 |
void HTMLMediaElement::updateClosedCaptionsControls() |
| 4149 |
{ |
| 4150 |
if (hasMediaControls()) { |
| 4151 |
mediaControls()->changedClosedCaptionsVisibility(); |
| 4152 |
|
| 4153 |
if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) |
| 4154 |
mediaControls()->updateTextTrackDisplay(); |
| 4155 |
} |
| 4111 |
} |
4156 |
} |
| 4112 |
#endif |
4157 |
#endif |
| 4113 |
|
4158 |
|