Commit db72bf4a authored by Tommy Steimel's avatar Tommy Steimel Committed by Commit Bot

Media Controls: Remove 'modern' from the code

This CL removes the word 'modern' from the rest of the media controls
code.

Bug: 884215
Change-Id: I502c6717a8ce15d667e3fce0bd1726038aca2f76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677104Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672247}
parent b3cb099c
...@@ -32,7 +32,7 @@ class MediaControlTextTrackListElement final ...@@ -32,7 +32,7 @@ class MediaControlTextTrackListElement final
// the "Off" item when the parameter is null. // the "Off" item when the parameter is null.
Element* CreateTextTrackListItem(TextTrack*); Element* CreateTextTrackListItem(TextTrack*);
// Creates the header element of the text track list (modern only). // Creates the header element of the text track list.
Element* CreateTextTrackHeaderItem(); Element* CreateTextTrackHeaderItem();
}; };
......
...@@ -99,11 +99,9 @@ namespace blink { ...@@ -99,11 +99,9 @@ namespace blink {
namespace { namespace {
// TODO(steimel): When modern media controls launches, remove above constants
// and rename below constants.
// (2px left border + 6px left padding + 56px button + 6px right padding + 2px // (2px left border + 6px left padding + 56px button + 6px right padding + 2px
// right border) = 72px. // right border) = 72px.
constexpr int kModernMinWidthForOverlayPlayButton = 72; constexpr int kMinWidthForOverlayPlayButton = 72;
constexpr int kMinScrubbingMessageWidth = 300; constexpr int kMinScrubbingMessageWidth = 300;
...@@ -119,8 +117,8 @@ const char* kStateCSSClasses[8] = { ...@@ -119,8 +117,8 @@ const char* kStateCSSClasses[8] = {
}; };
// The padding in pixels inside the button panel. // The padding in pixels inside the button panel.
constexpr int kModernControlsAudioButtonPadding = 20; constexpr int kAudioButtonPadding = 20;
constexpr int kModernControlsVideoButtonPadding = 26; constexpr int kVideoButtonPadding = 26;
const char kShowDefaultPosterCSSClass[] = "use-default-poster"; const char kShowDefaultPosterCSSClass[] = "use-default-poster";
const char kActAsAudioControlsCSSClass[] = "audio-only"; const char kActAsAudioControlsCSSClass[] = "audio-only";
...@@ -186,12 +184,11 @@ bool PreferHiddenVolumeControls(const Document& document) { ...@@ -186,12 +184,11 @@ bool PreferHiddenVolumeControls(const Document& document) {
// If you change this value, then also update the corresponding value in // If you change this value, then also update the corresponding value in
// web_tests/media/media-controls.js. // web_tests/media/media-controls.js.
constexpr base::TimeDelta constexpr base::TimeDelta kTimeWithoutMouseMovementBeforeHidingMediaControls =
kModernTimeWithoutMouseMovementBeforeHidingMediaControls = base::TimeDelta::FromSecondsD(2.5);
base::TimeDelta::FromSecondsD(2.5);
base::TimeDelta GetTimeWithoutMouseMovementBeforeHidingMediaControls() { base::TimeDelta GetTimeWithoutMouseMovementBeforeHidingMediaControls() {
return kModernTimeWithoutMouseMovementBeforeHidingMediaControls; return kTimeWithoutMouseMovementBeforeHidingMediaControls;
} }
} // namespace } // namespace
...@@ -424,39 +421,33 @@ MediaControlsImpl* MediaControlsImpl::Create(HTMLMediaElement& media_element, ...@@ -424,39 +421,33 @@ MediaControlsImpl* MediaControlsImpl::Create(HTMLMediaElement& media_element,
// (-webkit-media-controls) // (-webkit-media-controls)
// +-MediaControlLoadingPanelElement // +-MediaControlLoadingPanelElement
// | (-internal-media-controls-loading-panel) // | (-internal-media-controls-loading-panel)
// | {if ModernMediaControlsEnabled}
// +-MediaControlOverlayEnclosureElement // +-MediaControlOverlayEnclosureElement
// | (-webkit-media-controls-overlay-enclosure) // | (-webkit-media-controls-overlay-enclosure)
// | +-MediaControlOverlayPlayButtonElement
// | | (-webkit-media-controls-overlay-play-button)
// | | {if mediaControlsOverlayPlayButtonEnabled}
// | \-MediaControlCastButtonElement // | \-MediaControlCastButtonElement
// | (-internal-media-controls-overlay-cast-button) // | (-internal-media-controls-overlay-cast-button)
// \-MediaControlPanelEnclosureElement // \-MediaControlPanelEnclosureElement
// | (-webkit-media-controls-enclosure) // | (-webkit-media-controls-enclosure)
// \-MediaControlPanelElement // \-MediaControlPanelElement
// | (-webkit-media-controls-panel) // | (-webkit-media-controls-panel)
// | {if ModernMediaControlsEnabled and is video element and is Android}
// +-MediaControlScrubbingMessageElement // +-MediaControlScrubbingMessageElement
// | (-internal-media-controls-scrubbing-message) // | (-internal-media-controls-scrubbing-message)
// | {if ModernMediaControlsEnabled, otherwise // | {if is video element}
// | contents are directly attached to parent.
// +-MediaControlOverlayPlayButtonElement // +-MediaControlOverlayPlayButtonElement
// | (-webkit-media-controls-overlay-play-button) // | (-webkit-media-controls-overlay-play-button)
// | {if ModernMediaControlsEnabled} // | {if mediaControlsOverlayPlayButtonEnabled}
// +-MediaControlButtonPanelElement // +-MediaControlButtonPanelElement
// | | (-internal-media-controls-button-panel) // | | (-internal-media-controls-button-panel)
// | | <video> only, otherwise children are directly attached to parent // | | <video> only, otherwise children are directly attached to parent
// | +-MediaControlPlayButtonElement // | +-MediaControlPlayButtonElement
// | | (-webkit-media-controls-play-button) // | | (-webkit-media-controls-play-button)
// | | {only present if audio only or ModernMediaControls is disabled} // | | {if !mediaControlsOverlayPlayButtonEnabled}
// | +-MediaControlCurrentTimeDisplayElement // | +-MediaControlCurrentTimeDisplayElement
// | | (-webkit-media-controls-current-time-display) // | | (-webkit-media-controls-current-time-display)
// | +-MediaControlRemainingTimeDisplayElement // | +-MediaControlRemainingTimeDisplayElement
// | | (-webkit-media-controls-time-remaining-display) // | | (-webkit-media-controls-time-remaining-display)
// | +-HTMLDivElement // | +-HTMLDivElement
// | | (-internal-media-controls-button-spacer) // | | (-internal-media-controls-button-spacer)
// | | {if ModernMediaControls is enabled and is video element} // | | {if is video element}
// | +-MediaControlVolumeControlContainerElement // | +-MediaControlVolumeControlContainerElement
// | | | (-webkit-media-controls-volume-control-container) // | | | (-webkit-media-controls-volume-control-container)
// | | +-HTMLDivElement // | | +-HTMLDivElement
...@@ -465,20 +456,10 @@ MediaControlsImpl* MediaControlsImpl::Create(HTMLMediaElement& media_element, ...@@ -465,20 +456,10 @@ MediaControlsImpl* MediaControlsImpl::Create(HTMLMediaElement& media_element,
// | | | (-webkit-media-controls-mute-button) // | | | (-webkit-media-controls-mute-button)
// | | +-MediaControlVolumeSliderElement // | | +-MediaControlVolumeSliderElement
// | | (-webkit-media-controls-volume-slider) // | | (-webkit-media-controls-volume-slider)
// | | {if not ModernMediaControlsEnabled}
// | +-MediaControlPictureInPictureButtonElement // | +-MediaControlPictureInPictureButtonElement
// | | (-webkit-media-controls-picture-in-picture-button) // | | (-webkit-media-controls-picture-in-picture-button)
// | +-MediaControlFullscreenButtonElement // | +-MediaControlFullscreenButtonElement
// | | (-webkit-media-controls-fullscreen-button) // | | (-webkit-media-controls-fullscreen-button)
// | +-MediaControlDownloadButtonElement
// | | (-internal-media-controls-download-button)
// | | {on the overflow menu if ModernMediaControls is enabled}
// | +-MediaControlToggleClosedCaptionsButtonElement
// | | (-webkit-media-controls-toggle-closed-captions-button)
// | | {on the overflow menu if ModernMediaControls is enabled}
// | +-MediaControlCastButtonElement
// | (-internal-media-controls-cast-button)
// | {on the overflow menu if ModernMediaControls is enabled}
// \-MediaControlTimelineElement // \-MediaControlTimelineElement
// (-webkit-media-controls-timeline) // (-webkit-media-controls-timeline)
// +-MediaControlTextTrackListElement // +-MediaControlTextTrackListElement
...@@ -521,8 +502,8 @@ void MediaControlsImpl::InitializeControls() { ...@@ -521,8 +502,8 @@ void MediaControlsImpl::InitializeControls() {
panel_ = MakeGarbageCollected<MediaControlPanelElement>(*this); panel_ = MakeGarbageCollected<MediaControlPanelElement>(*this);
// If using the modern media controls, the buttons should belong to a // On the video controls, the buttons belong to a separate button panel. This
// seperate button panel. This is because they are displayed in two lines. // is because they are displayed in two lines.
if (ShouldShowVideoControls()) { if (ShouldShowVideoControls()) {
media_button_panel_ = media_button_panel_ =
MakeGarbageCollected<MediaControlButtonPanelElement>(*this); MakeGarbageCollected<MediaControlButtonPanelElement>(*this);
...@@ -1255,7 +1236,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const { ...@@ -1255,7 +1236,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const {
WebSize overlay_play_button_size = WebSize overlay_play_button_size =
overlay_play_button_->GetSizeOrDefault(); overlay_play_button_->GetSizeOrDefault();
if (controls_size.height >= overlay_play_button_size.height && if (controls_size.height >= overlay_play_button_size.height &&
controls_size.width >= kModernMinWidthForOverlayPlayButton) { controls_size.width >= kMinWidthForOverlayPlayButton) {
overlay_play_button_->SetDoesFit(true); overlay_play_button_->SetDoesFit(true);
controls_size.height -= overlay_play_button_size.height; controls_size.height -= overlay_play_button_size.height;
} else { } else {
...@@ -1263,7 +1244,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const { ...@@ -1263,7 +1244,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const {
} }
} }
controls_size.width -= kModernControlsVideoButtonPadding; controls_size.width -= kVideoButtonPadding;
// Allocate vertical room for the column elements. // Allocate vertical room for the column elements.
for (MediaControlElementBase* element : column_elements) { for (MediaControlElementBase* element : column_elements) {
...@@ -1280,7 +1261,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const { ...@@ -1280,7 +1261,7 @@ void MediaControlsImpl::UpdateOverflowMenuWanted() const {
play_button_->SetIsWanted(!overlay_play_button_ || play_button_->SetIsWanted(!overlay_play_button_ ||
!overlay_play_button_->DoesFit()); !overlay_play_button_->DoesFit());
} else { } else {
controls_size.width -= kModernControlsAudioButtonPadding; controls_size.width -= kAudioButtonPadding;
// Undo any IsWanted/DoesFit changes made in the above block if we're // Undo any IsWanted/DoesFit changes made in the above block if we're
// switching to act as audio controls. // switching to act as audio controls.
...@@ -1740,9 +1721,9 @@ void MediaControlsImpl::OnVolumeChange() { ...@@ -1740,9 +1721,9 @@ void MediaControlsImpl::OnVolumeChange() {
html_names::kDisabledAttr, html_names::kDisabledAttr,
MediaElement().HasAudio() ? AtomicString() : AtomicString("")); MediaElement().HasAudio() ? AtomicString() : AtomicString(""));
// On modern media controls, if the volume slider is being used we don't want // If the volume slider is being used we don't want to update controls
// to update controls visibility, since this can shift the position of the // visibility, since this can shift the position of the volume slider and make
// volume slider and make it unusable. // it unusable.
if (!volume_slider_ || !volume_slider_->IsHovered()) if (!volume_slider_ || !volume_slider_->IsHovered())
BatchedControlUpdate batch(this); BatchedControlUpdate batch(this);
} }
......
This is a testharness.js-based test.
FAIL Test that the controls are hidden if they are tapped assert_false: expected false got true
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment