void MediaControls::reset() { const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); BatchedControlUpdate batch(this); m_allowHiddenVolumeControls = useNewUi; m_keepMuteButton = false; const double duration = mediaElement().duration(); m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION); m_durationDisplay->setCurrentValue(duration); if (useNewUi) { // Show everything that we might hide. // If we don't have a duration, then mark it to be hidden. For the // old UI case, want / don't want is the same as show / hide since // it is never marked as not fitting. m_durationDisplay->setIsWanted(std::isfinite(duration)); m_currentTimeDisplay->setIsWanted(true); m_timeline->setIsWanted(true); } updatePlayState(); updateCurrentTimeDisplay(); m_timeline->setDuration(duration); m_timeline->setPosition(mediaElement().currentTime()); updateVolume(); refreshClosedCaptionsButtonVisibility(); m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); refreshCastButtonVisibilityWithoutUpdate(); makeOpaque(); // Set the panel width here, and force a layout, before the controls update. // This would be harmless for the !useNewUi case too, but it causes // compositing/geometry/video-fixed-scrolling.html to fail with two extra // 0 height nodes in the render tree. if (useNewUi) m_panelWidth = m_panel->clientWidth(); }
void MediaControls::reset() { EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); BatchedControlUpdate batch(this); m_allowHiddenVolumeControls = useNewUi; const double duration = mediaElement().duration(); m_durationDisplay->setTextContent( LayoutTheme::theme().formatMediaControlsTime(duration)); m_durationDisplay->setCurrentValue(duration); if (useNewUi) { // Show everything that we might hide. // If we don't have a duration, then mark it to be hidden. For the // old UI case, want / don't want is the same as show / hide since // it is never marked as not fitting. m_durationDisplay->setIsWanted(std::isfinite(duration)); m_currentTimeDisplay->setIsWanted(true); m_timeline->setIsWanted(true); } // If the player has entered an error state, force it into the paused state. if (mediaElement().error()) mediaElement().pause(); updatePlayState(); updateCurrentTimeDisplay(); m_timeline->setDuration(duration); m_timeline->setPosition(mediaElement().currentTime()); updateVolume(); refreshClosedCaptionsButtonVisibility(); m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); refreshCastButtonVisibilityWithoutUpdate(); m_downloadButton->setIsWanted( m_downloadButton->shouldDisplayDownloadButton()); }
void MediaControls::reset() { const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); BatchedControlUpdate batch(this); m_allowHiddenVolumeControls = useNewUi; const double duration = mediaElement().duration(); m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION); m_durationDisplay->setCurrentValue(duration); if (useNewUi) { // Show everything that we might hide. // If we don't have a duration, then mark it to be hidden. For the // old UI case, want / don't want is the same as show / hide since // it is never marked as not fitting. m_durationDisplay->setIsWanted(std::isfinite(duration)); m_currentTimeDisplay->setIsWanted(true); m_timeline->setIsWanted(true); } updatePlayState(); updateCurrentTimeDisplay(); m_timeline->setDuration(duration); m_timeline->setPosition(mediaElement().currentTime()); updateVolume(); refreshClosedCaptionsButtonVisibility(); m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); refreshCastButtonVisibilityWithoutUpdate(); }
void MediaControls::refreshCastButtonVisibility() { refreshCastButtonVisibilityWithoutUpdate(); BatchedControlUpdate batch(this); }