Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 1079323002: Support text track selection in video controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and addressed fs' comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // \-MediaControlTextTrackListItem (-internal-media-controls -text-track-list-item)
157 // +-MediaControlTextTrackListItemInput (-internal-media-controls -text-track-list-item-input)
158 // +-MediaControlTextTrackListItemCaptions (-internal-media-controls -text-track-list-kind-captions)
159 // +-MediaControlTextTrackListItemSubtitles (-internal-media-controls -text-track-list-kind-subtitles)
154 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) 160 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button)
155 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) 161 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button)
156 void MediaControls::initializeControls() 162 void MediaControls::initializeControls()
157 { 163 {
158 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); 164 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
159 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); 165 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this);
160 166
161 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { 167 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) {
162 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); 168 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this);
163 m_overlayPlayButton = overlayPlayButton.get(); 169 m_overlayPlayButton = overlayPlayButton.get();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 m_castButton = castButton.get(); 224 m_castButton = castButton.get();
219 panel->appendChild(castButton.release()); 225 panel->appendChild(castButton.release());
220 226
221 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); 227 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this);
222 m_fullScreenButton = fullscreenButton.get(); 228 m_fullScreenButton = fullscreenButton.get();
223 panel->appendChild(fullscreenButton.release()); 229 panel->appendChild(fullscreenButton.release());
224 230
225 m_panel = panel.get(); 231 m_panel = panel.get();
226 enclosure->appendChild(panel.release()); 232 enclosure->appendChild(panel.release());
227 233
234 RefPtrWillBeRawPtr<MediaControlTextTrackListElement> textTrackList = MediaCo ntrolTextTrackListElement::create(*this);
235 m_textTrackList = textTrackList.get();
236 enclosure->appendChild(textTrackList.release());
237
228 m_enclosure = enclosure.get(); 238 m_enclosure = enclosure.get();
229 appendChild(enclosure.release()); 239 appendChild(enclosure.release());
230 } 240 }
231 241
232 void MediaControls::reset() 242 void MediaControls::reset()
233 { 243 {
234 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); 244 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
235 BatchedControlUpdate batch(this); 245 BatchedControlUpdate batch(this);
236 246
237 m_allowHiddenVolumeControls = useNewUi; 247 m_allowHiddenVolumeControls = useNewUi;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 { 454 {
445 m_toggleClosedCaptionsButton->updateDisplayType(); 455 m_toggleClosedCaptionsButton->updateDisplayType();
446 } 456 }
447 457
448 void MediaControls::refreshClosedCaptionsButtonVisibility() 458 void MediaControls::refreshClosedCaptionsButtonVisibility()
449 { 459 {
450 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions() ); 460 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions() );
451 BatchedControlUpdate batch(this); 461 BatchedControlUpdate batch(this);
452 } 462 }
453 463
464 void MediaControls::toggleTextTrackList()
465 {
466 if (!mediaElement().hasClosedCaptions())
467 return;
468
469 if (!m_textTrackList->isHidden()) {
470 m_textTrackList->displayTextTrackList(false);
471 } else {
472 m_textTrackList->refreshTextTrackListMenu();
473 m_textTrackList->displayTextTrackList(true);
474 }
475 }
476
454 void MediaControls::refreshCastButtonVisibility() 477 void MediaControls::refreshCastButtonVisibility()
455 { 478 {
456 refreshCastButtonVisibilityWithoutUpdate(); 479 refreshCastButtonVisibilityWithoutUpdate();
457 BatchedControlUpdate batch(this); 480 BatchedControlUpdate batch(this);
458 } 481 }
459 482
460 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() 483 void MediaControls::refreshCastButtonVisibilityWithoutUpdate()
461 { 484 {
462 if (!shouldShowCastButton(mediaElement())) { 485 if (!shouldShowCastButton(mediaElement())) {
463 m_castButton->setIsWanted(false); 486 m_castButton->setIsWanted(false);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 visitor->trace(m_overlayEnclosure); 766 visitor->trace(m_overlayEnclosure);
744 visitor->trace(m_playButton); 767 visitor->trace(m_playButton);
745 visitor->trace(m_currentTimeDisplay); 768 visitor->trace(m_currentTimeDisplay);
746 visitor->trace(m_timeline); 769 visitor->trace(m_timeline);
747 visitor->trace(m_muteButton); 770 visitor->trace(m_muteButton);
748 visitor->trace(m_volumeSlider); 771 visitor->trace(m_volumeSlider);
749 visitor->trace(m_toggleClosedCaptionsButton); 772 visitor->trace(m_toggleClosedCaptionsButton);
750 visitor->trace(m_fullScreenButton); 773 visitor->trace(m_fullScreenButton);
751 visitor->trace(m_durationDisplay); 774 visitor->trace(m_durationDisplay);
752 visitor->trace(m_enclosure); 775 visitor->trace(m_enclosure);
776 visitor->trace(m_textTrackList);
753 visitor->trace(m_castButton); 777 visitor->trace(m_castButton);
754 visitor->trace(m_overlayCastButton); 778 visitor->trace(m_overlayCastButton);
755 HTMLDivElement::trace(visitor); 779 HTMLDivElement::trace(visitor);
756 } 780 }
757 781
758 } // namespace blink 782 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698