| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 , m_overlayCastButton(nullptr) | 106 , m_overlayCastButton(nullptr) |
| 107 , m_enclosure(nullptr) | 107 , m_enclosure(nullptr) |
| 108 , m_panel(nullptr) | 108 , m_panel(nullptr) |
| 109 , m_playButton(nullptr) | 109 , m_playButton(nullptr) |
| 110 , m_timeline(nullptr) | 110 , m_timeline(nullptr) |
| 111 , m_currentTimeDisplay(nullptr) | 111 , m_currentTimeDisplay(nullptr) |
| 112 , m_durationDisplay(nullptr) | 112 , m_durationDisplay(nullptr) |
| 113 , m_muteButton(nullptr) | 113 , m_muteButton(nullptr) |
| 114 , m_volumeSlider(nullptr) | 114 , m_volumeSlider(nullptr) |
| 115 , m_toggleClosedCaptionsButton(nullptr) | 115 , m_toggleClosedCaptionsButton(nullptr) |
| 116 , m_textTrackList(nullptr) |
| 116 , m_castButton(nullptr) | 117 , m_castButton(nullptr) |
| 117 , m_fullScreenButton(nullptr) | 118 , m_fullScreenButton(nullptr) |
| 118 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired
) | 119 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired
) |
| 119 , m_hideTimerBehaviorFlags(IgnoreNone) | 120 , m_hideTimerBehaviorFlags(IgnoreNone) |
| 120 , m_isMouseOverControls(false) | 121 , m_isMouseOverControls(false) |
| 121 , m_isPausedForScrubbing(false) | 122 , m_isPausedForScrubbing(false) |
| 122 , m_panelWidthChangedTimer(this, &MediaControls::panelWidthChangedTimerFired
) | 123 , m_panelWidthChangedTimer(this, &MediaControls::panelWidthChangedTimerFired
) |
| 123 , m_panelWidth(0) | 124 , m_panelWidth(0) |
| 124 , m_allowHiddenVolumeControls(RuntimeEnabledFeatures::newMediaPlaybackUiEnab
led()) | 125 , m_allowHiddenVolumeControls(RuntimeEnabledFeatures::newMediaPlaybackUiEnab
led()) |
| 125 { | 126 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 // +-MediaControlTimelineElement (-webkit-media-controls-t
imeline) | 148 // +-MediaControlTimelineElement (-webkit-media-controls-t
imeline) |
| 148 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c
urrent-time-display) | 149 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c
urrent-time-display) |
| 149 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t
ime-remaining-display) | 150 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t
ime-remaining-display) |
| 150 // | {if RTE::newMediaPlaybackUi()} | 151 // | {if RTE::newMediaPlaybackUi()} |
| 151 // +-MediaControlTimelineElement (-webkit-media-controls-t
imeline) | 152 // +-MediaControlTimelineElement (-webkit-media-controls-t
imeline) |
| 152 // +-MediaControlMuteButtonElement (-webkit-media-controls-m
ute-button) | 153 // +-MediaControlMuteButtonElement (-webkit-media-controls-m
ute-button) |
| 153 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v
olume-slider) | 154 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v
olume-slider) |
| 154 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t
oggle-closed-captions-button) | 155 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t
oggle-closed-captions-button) |
| 155 // +-MediaControlCastButtonElement (-internal-media-controls
-cast-button) | 156 // +-MediaControlCastButtonElement (-internal-media-controls
-cast-button) |
| 156 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f
ullscreen-button) | 157 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f
ullscreen-button) |
| 158 // +-MediaControlTextTrackListElement (-internal-media-controls-t
ext-track-list) |
| 159 // | {for each renderable text track} |
| 160 // \-MediaControlTextTrackListItem (-internal-media-controls-te
xt-track-list-item) |
| 161 // +-MediaControlTextTrackListItemInput (-internal-media-controls-te
xt-track-list-item-input) |
| 162 // +-MediaControlTextTrackListItemCaptions (-internal-media-controls-te
xt-track-list-kind-captions) |
| 163 // +-MediaControlTextTrackListItemSubtitles (-internal-media-controls-te
xt-track-list-kind-subtitles) |
| 157 void MediaControls::initializeControls() | 164 void MediaControls::initializeControls() |
| 158 { | 165 { |
| 159 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | 166 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
| 160 RawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(*this); | 167 RawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(*this); |
| 161 | 168 |
| 162 if (document().settings() && document().settings()->mediaControlsOverlayPlay
ButtonEnabled()) { | 169 if (document().settings() && document().settings()->mediaControlsOverlayPlay
ButtonEnabled()) { |
| 163 RawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(*this); | 170 RawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(*this); |
| 164 m_overlayPlayButton = overlayPlayButton.get(); | 171 m_overlayPlayButton = overlayPlayButton.get(); |
| 165 overlayEnclosure->appendChild(overlayPlayButton.release()); | 172 overlayEnclosure->appendChild(overlayPlayButton.release()); |
| 166 } | 173 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 228 |
| 222 RawPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(*this); | 229 RawPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(*this); |
| 223 m_fullScreenButton = fullscreenButton.get(); | 230 m_fullScreenButton = fullscreenButton.get(); |
| 224 panel->appendChild(fullscreenButton.release()); | 231 panel->appendChild(fullscreenButton.release()); |
| 225 | 232 |
| 226 m_panel = panel.get(); | 233 m_panel = panel.get(); |
| 227 enclosure->appendChild(panel.release()); | 234 enclosure->appendChild(panel.release()); |
| 228 | 235 |
| 229 m_enclosure = enclosure.get(); | 236 m_enclosure = enclosure.get(); |
| 230 appendChild(enclosure.release()); | 237 appendChild(enclosure.release()); |
| 238 |
| 239 RawPtr<MediaControlTextTrackListElement> textTrackList = MediaControlTextTra
ckListElement::create(*this); |
| 240 m_textTrackList = textTrackList.get(); |
| 241 appendChild(textTrackList.release()); |
| 231 } | 242 } |
| 232 | 243 |
| 233 void MediaControls::reset() | 244 void MediaControls::reset() |
| 234 { | 245 { |
| 235 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; | 246 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; |
| 236 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | 247 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
| 237 BatchedControlUpdate batch(this); | 248 BatchedControlUpdate batch(this); |
| 238 | 249 |
| 239 m_allowHiddenVolumeControls = useNewUi; | 250 m_allowHiddenVolumeControls = useNewUi; |
| 240 | 251 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // Don't hide if the mouse is over the video area. | 335 // Don't hide if the mouse is over the video area. |
| 325 const bool ignoreVideoHover = behaviorFlags & IgnoreVideoHover; | 336 const bool ignoreVideoHover = behaviorFlags & IgnoreVideoHover; |
| 326 if (!ignoreVideoHover && m_isMouseOverControls) | 337 if (!ignoreVideoHover && m_isMouseOverControls) |
| 327 return false; | 338 return false; |
| 328 // Don't hide if focus is on the HTMLMediaElement or within the | 339 // Don't hide if focus is on the HTMLMediaElement or within the |
| 329 // controls/shadow tree. (Perform the checks separately to avoid going | 340 // controls/shadow tree. (Perform the checks separately to avoid going |
| 330 // through all the potential ancestor hosts for the focused element.) | 341 // through all the potential ancestor hosts for the focused element.) |
| 331 const bool ignoreFocus = behaviorFlags & IgnoreFocus; | 342 const bool ignoreFocus = behaviorFlags & IgnoreFocus; |
| 332 if (!ignoreFocus && (mediaElement().focused() || contains(document().focused
Element()))) | 343 if (!ignoreFocus && (mediaElement().focused() || contains(document().focused
Element()))) |
| 333 return false; | 344 return false; |
| 345 // Don't hide the media controls when the text track list is showing. |
| 346 if (m_textTrackList->isWanted()) |
| 347 return false; |
| 334 return true; | 348 return true; |
| 335 } | 349 } |
| 336 | 350 |
| 337 void MediaControls::playbackStarted() | 351 void MediaControls::playbackStarted() |
| 338 { | 352 { |
| 339 BatchedControlUpdate batch(this); | 353 BatchedControlUpdate batch(this); |
| 340 | 354 |
| 341 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { | 355 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { |
| 342 m_currentTimeDisplay->setIsWanted(true); | 356 m_currentTimeDisplay->setIsWanted(true); |
| 343 m_durationDisplay->setIsWanted(false); | 357 m_durationDisplay->setIsWanted(false); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 { | 464 { |
| 451 m_toggleClosedCaptionsButton->updateDisplayType(); | 465 m_toggleClosedCaptionsButton->updateDisplayType(); |
| 452 } | 466 } |
| 453 | 467 |
| 454 void MediaControls::refreshClosedCaptionsButtonVisibility() | 468 void MediaControls::refreshClosedCaptionsButtonVisibility() |
| 455 { | 469 { |
| 456 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions()
); | 470 m_toggleClosedCaptionsButton->setIsWanted(mediaElement().hasClosedCaptions()
); |
| 457 BatchedControlUpdate batch(this); | 471 BatchedControlUpdate batch(this); |
| 458 } | 472 } |
| 459 | 473 |
| 474 void MediaControls::toggleTextTrackList() |
| 475 { |
| 476 if (!mediaElement().hasClosedCaptions()) { |
| 477 m_textTrackList->setVisible(false); |
| 478 return; |
| 479 } |
| 480 |
| 481 m_textTrackList->setVisible(!m_textTrackList->isWanted()); |
| 482 } |
| 483 |
| 460 void MediaControls::refreshCastButtonVisibility() | 484 void MediaControls::refreshCastButtonVisibility() |
| 461 { | 485 { |
| 462 refreshCastButtonVisibilityWithoutUpdate(); | 486 refreshCastButtonVisibilityWithoutUpdate(); |
| 463 BatchedControlUpdate batch(this); | 487 BatchedControlUpdate batch(this); |
| 464 } | 488 } |
| 465 | 489 |
| 466 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() | 490 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() |
| 467 { | 491 { |
| 468 if (!shouldShowCastButton(mediaElement())) { | 492 if (!shouldShowCastButton(mediaElement())) { |
| 469 m_castButton->setIsWanted(false); | 493 m_castButton->setIsWanted(false); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 visitor->trace(m_overlayEnclosure); | 773 visitor->trace(m_overlayEnclosure); |
| 750 visitor->trace(m_playButton); | 774 visitor->trace(m_playButton); |
| 751 visitor->trace(m_currentTimeDisplay); | 775 visitor->trace(m_currentTimeDisplay); |
| 752 visitor->trace(m_timeline); | 776 visitor->trace(m_timeline); |
| 753 visitor->trace(m_muteButton); | 777 visitor->trace(m_muteButton); |
| 754 visitor->trace(m_volumeSlider); | 778 visitor->trace(m_volumeSlider); |
| 755 visitor->trace(m_toggleClosedCaptionsButton); | 779 visitor->trace(m_toggleClosedCaptionsButton); |
| 756 visitor->trace(m_fullScreenButton); | 780 visitor->trace(m_fullScreenButton); |
| 757 visitor->trace(m_durationDisplay); | 781 visitor->trace(m_durationDisplay); |
| 758 visitor->trace(m_enclosure); | 782 visitor->trace(m_enclosure); |
| 783 visitor->trace(m_textTrackList); |
| 759 visitor->trace(m_castButton); | 784 visitor->trace(m_castButton); |
| 760 visitor->trace(m_overlayCastButton); | 785 visitor->trace(m_overlayCastButton); |
| 761 HTMLDivElement::trace(visitor); | 786 HTMLDivElement::trace(visitor); |
| 762 } | 787 } |
| 763 | 788 |
| 764 } // namespace blink | 789 } // namespace blink |
| OLD | NEW |