Chromium Code Reviews| 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) | |
|
philipj_slow
2016/03/01 13:01:17
This doesn't match initializeControls(), the Media
srivats
2016/03/30 00:46:43
I moved track list element under MediaControls dir
| |
| 156 // | {for each renderable text track} | |
| 157 // \-MediaControlTextTrackListItem (-internal-media-controls -text-track-list-item) | |
| 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; | |
|
philipj_slow
2016/03/01 13:01:16
Won't this early return leave the track list perpe
srivats
2016/03/30 00:46:43
Good catch! I set the visibility to false before r
| |
| 469 | |
| 470 m_textTrackList->changeVisibility(m_textTrackList->isHidden()); | |
| 471 } | |
| 472 | |
| 454 void MediaControls::refreshCastButtonVisibility() | 473 void MediaControls::refreshCastButtonVisibility() |
| 455 { | 474 { |
| 456 refreshCastButtonVisibilityWithoutUpdate(); | 475 refreshCastButtonVisibilityWithoutUpdate(); |
| 457 BatchedControlUpdate batch(this); | 476 BatchedControlUpdate batch(this); |
| 458 } | 477 } |
| 459 | 478 |
| 460 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() | 479 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() |
| 461 { | 480 { |
| 462 if (!shouldShowCastButton(mediaElement())) { | 481 if (!shouldShowCastButton(mediaElement())) { |
| 463 m_castButton->setIsWanted(false); | 482 m_castButton->setIsWanted(false); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 visitor->trace(m_overlayEnclosure); | 762 visitor->trace(m_overlayEnclosure); |
| 744 visitor->trace(m_playButton); | 763 visitor->trace(m_playButton); |
| 745 visitor->trace(m_currentTimeDisplay); | 764 visitor->trace(m_currentTimeDisplay); |
| 746 visitor->trace(m_timeline); | 765 visitor->trace(m_timeline); |
| 747 visitor->trace(m_muteButton); | 766 visitor->trace(m_muteButton); |
| 748 visitor->trace(m_volumeSlider); | 767 visitor->trace(m_volumeSlider); |
| 749 visitor->trace(m_toggleClosedCaptionsButton); | 768 visitor->trace(m_toggleClosedCaptionsButton); |
| 750 visitor->trace(m_fullScreenButton); | 769 visitor->trace(m_fullScreenButton); |
| 751 visitor->trace(m_durationDisplay); | 770 visitor->trace(m_durationDisplay); |
| 752 visitor->trace(m_enclosure); | 771 visitor->trace(m_enclosure); |
| 772 visitor->trace(m_textTrackList); | |
| 753 visitor->trace(m_castButton); | 773 visitor->trace(m_castButton); |
| 754 visitor->trace(m_overlayCastButton); | 774 visitor->trace(m_overlayCastButton); |
| 755 HTMLDivElement::trace(visitor); | 775 HTMLDivElement::trace(visitor); |
| 756 } | 776 } |
| 757 | 777 |
| 758 } // namespace blink | 778 } // namespace blink |
| OLD | NEW |