OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 , m_overlayCastButton(nullptr) | 105 , m_overlayCastButton(nullptr) |
106 , m_enclosure(nullptr) | 106 , m_enclosure(nullptr) |
107 , m_panel(nullptr) | 107 , m_panel(nullptr) |
108 , m_playButton(nullptr) | 108 , m_playButton(nullptr) |
109 , m_timeline(nullptr) | 109 , m_timeline(nullptr) |
110 , m_currentTimeDisplay(nullptr) | 110 , m_currentTimeDisplay(nullptr) |
111 , m_durationDisplay(nullptr) | 111 , m_durationDisplay(nullptr) |
112 , m_muteButton(nullptr) | 112 , m_muteButton(nullptr) |
113 , m_volumeSlider(nullptr) | 113 , m_volumeSlider(nullptr) |
114 , m_toggleClosedCaptionsButton(nullptr) | 114 , m_toggleClosedCaptionsButton(nullptr) |
115 , m_textTrackList(nullptr) | |
115 , m_castButton(nullptr) | 116 , m_castButton(nullptr) |
116 , m_fullScreenButton(nullptr) | 117 , m_fullScreenButton(nullptr) |
117 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) | 118 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) |
118 , m_hideTimerBehaviorFlags(IgnoreNone) | 119 , m_hideTimerBehaviorFlags(IgnoreNone) |
119 , m_isMouseOverControls(false) | 120 , m_isMouseOverControls(false) |
120 , m_isPausedForScrubbing(false) | 121 , m_isPausedForScrubbing(false) |
121 , m_panelWidthChangedTimer(this, &MediaControls::panelWidthChangedTimerFired ) | 122 , m_panelWidthChangedTimer(this, &MediaControls::panelWidthChangedTimerFired ) |
122 , m_panelWidth(0) | 123 , m_panelWidth(0) |
123 , m_allowHiddenVolumeControls(RuntimeEnabledFeatures::newMediaPlaybackUiEnab led()) | 124 , m_allowHiddenVolumeControls(RuntimeEnabledFeatures::newMediaPlaybackUiEnab led()) |
124 { | 125 { |
(...skipping 19 matching lines...) Expand all Loading... | |
144 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) | 145 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) |
145 // | {if !RTE::newMediaPlaybackUi()} | 146 // | {if !RTE::newMediaPlaybackUi()} |
146 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) | 147 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) |
147 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) | 148 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) |
148 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) | 149 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) |
149 // | {if RTE::newMediaPlaybackUi()} | 150 // | {if RTE::newMediaPlaybackUi()} |
150 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) | 151 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) |
151 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) | 152 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) |
152 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) | 153 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) |
153 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) | 154 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) |
155 // +-MediaControlTextTrackListElement (-internal-media-controls -text-track-list) | |
156 // | +-MediaControlTextTrackListHeader (-internal-media-controls -text-track-list-header) | |
fs
2016/02/23 13:16:44
Maybe add some indication that there can one/zero
srivats
2016/02/24 05:20:17
Would a comment be appropriate here?
The structure
fs
2016/02/24 10:14:57
Could be something like:
N*MediaControlTextTrackL
srivats
2016/02/25 21:47:56
Done.
| |
157 // | +-MediaControlTextTrackListItem (-internal-media-controls -text-track-list-item) | |
fs
2016/02/23 13:16:44
uNit: I think we've used '\' for these kinds of "t
srivats
2016/02/24 05:20:17
Done.
| |
158 // | +-MediaControlTextTrackListItemInput (-internal-media-controls -text-track-list-item-input) | |
159 // | +-MediaControlTextTrackListItemCaptions (-internal-media-controls -text-track-list-kind-captions) | |
160 // | +-MediaControlTextTrackListItemSubtitles (-internal-media-controls -text-track-list-kind-subtitles) | |
154 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) | 161 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) |
155 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) | 162 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) |
156 void MediaControls::initializeControls() | 163 void MediaControls::initializeControls() |
157 { | 164 { |
158 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | 165 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
159 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); | 166 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); |
160 | 167 |
161 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { | 168 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { |
162 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); | 169 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); |
163 m_overlayPlayButton = overlayPlayButton.get(); | 170 m_overlayPlayButton = overlayPlayButton.get(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 m_castButton = castButton.get(); | 225 m_castButton = castButton.get(); |
219 panel->appendChild(castButton.release()); | 226 panel->appendChild(castButton.release()); |
220 | 227 |
221 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); | 228 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); |
222 m_fullScreenButton = fullscreenButton.get(); | 229 m_fullScreenButton = fullscreenButton.get(); |
223 panel->appendChild(fullscreenButton.release()); | 230 panel->appendChild(fullscreenButton.release()); |
224 | 231 |
225 m_panel = panel.get(); | 232 m_panel = panel.get(); |
226 enclosure->appendChild(panel.release()); | 233 enclosure->appendChild(panel.release()); |
227 | 234 |
235 RefPtrWillBeRawPtr<MediaControlTextTrackListElement> textTrackList = MediaCo ntrolTextTrackListElement::create(*this); | |
236 m_textTrackList = textTrackList.get(); | |
237 enclosure->appendChild(textTrackList.release()); | |
238 | |
228 m_enclosure = enclosure.get(); | 239 m_enclosure = enclosure.get(); |
229 appendChild(enclosure.release()); | 240 appendChild(enclosure.release()); |
230 } | 241 } |
231 | 242 |
232 void MediaControls::reset() | 243 void MediaControls::reset() |
233 { | 244 { |
234 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | 245 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
235 BatchedControlUpdate batch(this); | 246 BatchedControlUpdate batch(this); |
236 | 247 |
237 m_allowHiddenVolumeControls = useNewUi; | 248 m_allowHiddenVolumeControls = useNewUi; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 { | 455 { |
445 m_toggleClosedCaptionsButton->updateDisplayType(); | 456 m_toggleClosedCaptionsButton->updateDisplayType(); |
446 } | 457 } |
447 | 458 |
448 void MediaControls::refreshClosedCaptionsButtonVisibility() | 459 void MediaControls::refreshClosedCaptionsButtonVisibility() |
449 { | 460 { |
450 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions() ); | 461 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions() ); |
451 BatchedControlUpdate batch(this); | 462 BatchedControlUpdate batch(this); |
452 } | 463 } |
453 | 464 |
465 void MediaControls::toggleTextTrackList() | |
466 { | |
467 if (!mediaElement().hasClosedCaptions()) | |
468 return; | |
469 | |
470 if (!m_textTrackList->isHidden()) { | |
471 m_textTrackList->setIsWanted(false); | |
fs
2016/02/23 13:16:44
I'm not sure the "is wanted" mechanism is really a
srivats
2016/02/24 05:20:18
Added a wrapper that calls setIsWanted within that
fs
2016/02/24 10:14:57
Well, the refresh call could be handled by the hel
srivats
2016/02/25 21:47:56
Done.
| |
472 } else { | |
473 m_textTrackList->refreshTextTrackListMenu(); | |
474 m_textTrackList->setIsWanted(true); | |
475 } | |
476 } | |
477 | |
454 void MediaControls::refreshCastButtonVisibility() | 478 void MediaControls::refreshCastButtonVisibility() |
455 { | 479 { |
456 refreshCastButtonVisibilityWithoutUpdate(); | 480 refreshCastButtonVisibilityWithoutUpdate(); |
457 BatchedControlUpdate batch(this); | 481 BatchedControlUpdate batch(this); |
458 } | 482 } |
459 | 483 |
460 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() | 484 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() |
461 { | 485 { |
462 if (!shouldShowCastButton(mediaElement())) { | 486 if (!shouldShowCastButton(mediaElement())) { |
463 m_castButton->setIsWanted(false); | 487 m_castButton->setIsWanted(false); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
743 visitor->trace(m_overlayEnclosure); | 767 visitor->trace(m_overlayEnclosure); |
744 visitor->trace(m_playButton); | 768 visitor->trace(m_playButton); |
745 visitor->trace(m_currentTimeDisplay); | 769 visitor->trace(m_currentTimeDisplay); |
746 visitor->trace(m_timeline); | 770 visitor->trace(m_timeline); |
747 visitor->trace(m_muteButton); | 771 visitor->trace(m_muteButton); |
748 visitor->trace(m_volumeSlider); | 772 visitor->trace(m_volumeSlider); |
749 visitor->trace(m_toggleClosedCaptionsButton); | 773 visitor->trace(m_toggleClosedCaptionsButton); |
750 visitor->trace(m_fullScreenButton); | 774 visitor->trace(m_fullScreenButton); |
751 visitor->trace(m_durationDisplay); | 775 visitor->trace(m_durationDisplay); |
752 visitor->trace(m_enclosure); | 776 visitor->trace(m_enclosure); |
777 visitor->trace(m_textTrackList); | |
753 visitor->trace(m_castButton); | 778 visitor->trace(m_castButton); |
754 visitor->trace(m_overlayCastButton); | 779 visitor->trace(m_overlayCastButton); |
755 HTMLDivElement::trace(visitor); | 780 HTMLDivElement::trace(visitor); |
756 } | 781 } |
757 | 782 |
758 } // namespace blink | 783 } // namespace blink |
OLD | NEW |