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

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

Issue 2301823002: Reordering media controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media-controls
Patch Set: addressed comments Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 MediaControlMuteButtonElement* muteButton = MediaControlMuteButtonElement::c reate(*this); 216 MediaControlMuteButtonElement* muteButton = MediaControlMuteButtonElement::c reate(*this);
217 m_muteButton = muteButton; 217 m_muteButton = muteButton;
218 panel->appendChild(muteButton); 218 panel->appendChild(muteButton);
219 219
220 MediaControlVolumeSliderElement* slider = MediaControlVolumeSliderElement::c reate(*this); 220 MediaControlVolumeSliderElement* slider = MediaControlVolumeSliderElement::c reate(*this);
221 m_volumeSlider = slider; 221 m_volumeSlider = slider;
222 panel->appendChild(slider); 222 panel->appendChild(slider);
223 if (m_allowHiddenVolumeControls && preferHiddenVolumeControls(document())) 223 if (m_allowHiddenVolumeControls && preferHiddenVolumeControls(document()))
224 m_volumeSlider->setIsWanted(false); 224 m_volumeSlider->setIsWanted(false);
225 225
226 MediaControlToggleClosedCaptionsButtonElement* toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this);
227 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton;
228 panel->appendChild(toggleClosedCaptionsButton);
229
230 MediaControlCastButtonElement* castButton = MediaControlCastButtonElement::c reate(*this, false);
231 m_castButton = castButton;
232 panel->appendChild(castButton);
233
234 MediaControlFullscreenButtonElement* fullscreenButton = MediaControlFullscre enButtonElement::create(*this); 226 MediaControlFullscreenButtonElement* fullscreenButton = MediaControlFullscre enButtonElement::create(*this);
235 m_fullscreenButton = fullscreenButton; 227 m_fullscreenButton = fullscreenButton;
236 panel->appendChild(fullscreenButton); 228 panel->appendChild(fullscreenButton);
237 229
238 MediaControlDownloadButtonElement* downloadButton = MediaControlDownloadButt onElement::create(*this); 230 MediaControlDownloadButtonElement* downloadButton = MediaControlDownloadButt onElement::create(*this);
239 m_downloadButton = downloadButton; 231 m_downloadButton = downloadButton;
240 panel->appendChild(downloadButton); 232 panel->appendChild(downloadButton);
241 233
234 MediaControlCastButtonElement* castButton = MediaControlCastButtonElement::c reate(*this, false);
235 m_castButton = castButton;
236 panel->appendChild(castButton);
237
238 MediaControlToggleClosedCaptionsButtonElement* toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this);
239 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton;
240 panel->appendChild(toggleClosedCaptionsButton);
241
242 m_panel = panel; 242 m_panel = panel;
243 enclosure->appendChild(panel); 243 enclosure->appendChild(panel);
244 244
245 m_enclosure = enclosure; 245 m_enclosure = enclosure;
246 appendChild(enclosure); 246 appendChild(enclosure);
247 247
248 MediaControlTextTrackListElement* textTrackList = MediaControlTextTrackListE lement::create(*this); 248 MediaControlTextTrackListElement* textTrackList = MediaControlTextTrackListE lement::create(*this);
249 m_textTrackList = textTrackList; 249 m_textTrackList = textTrackList;
250 appendChild(textTrackList); 250 appendChild(textTrackList);
251 251
252 MediaControlOverflowMenuButtonElement* overflowMenu = MediaControlOverflowMe nuButtonElement::create(*this); 252 MediaControlOverflowMenuButtonElement* overflowMenu = MediaControlOverflowMe nuButtonElement::create(*this);
253 m_overflowMenu = overflowMenu; 253 m_overflowMenu = overflowMenu;
254 panel->appendChild(overflowMenu); 254 panel->appendChild(overflowMenu);
255 255
256 MediaControlOverflowMenuListElement* overflowList = MediaControlOverflowMenu ListElement::create(*this); 256 MediaControlOverflowMenuListElement* overflowList = MediaControlOverflowMenu ListElement::create(*this);
257 m_overflowList = overflowList; 257 m_overflowList = overflowList;
258 appendChild(overflowList); 258 appendChild(overflowList);
259 259
260 // The order in which we append elements to the overflow list does matter. 260 // The order in which we append elements to the overflow list is significant
261 // because it determines how the elements show up in the overflow menu relat ive to each other.
262 // The first item appended appears at the top of the overflow menu.
263 m_overflowList->appendChild(m_playButton->createOverflowElement(*this, Media ControlPlayButtonElement::create(*this)));
264 m_overflowList->appendChild(m_fullscreenButton->createOverflowElement(*this, MediaControlFullscreenButtonElement::create(*this)));
265 m_overflowList->appendChild(m_downloadButton->createOverflowElement(*this, M ediaControlDownloadButtonElement::create(*this)));
261 m_overflowList->appendChild(m_muteButton->createOverflowElement(*this, Media ControlMuteButtonElement::create(*this))); 266 m_overflowList->appendChild(m_muteButton->createOverflowElement(*this, Media ControlMuteButtonElement::create(*this)));
262 m_overflowList->appendChild(m_castButton->createOverflowElement(*this, Media ControlCastButtonElement::create(*this, false))); 267 m_overflowList->appendChild(m_castButton->createOverflowElement(*this, Media ControlCastButtonElement::create(*this, false)));
263 m_overflowList->appendChild(m_toggleClosedCaptionsButton->createOverflowElem ent(*this, MediaControlToggleClosedCaptionsButtonElement::create(*this))); 268 m_overflowList->appendChild(m_toggleClosedCaptionsButton->createOverflowElem ent(*this, MediaControlToggleClosedCaptionsButtonElement::create(*this)));
264 m_overflowList->appendChild(m_fullscreenButton->createOverflowElement(*this, MediaControlFullscreenButtonElement::create(*this)));
265 m_overflowList->appendChild(m_playButton->createOverflowElement(*this, Media ControlPlayButtonElement::create(*this)));
266 m_overflowList->appendChild(m_downloadButton->createOverflowElement(*this, M ediaControlDownloadButtonElement::create(*this)));
267 } 269 }
268 270
269 void MediaControls::reset() 271 void MediaControls::reset()
270 { 272 {
271 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; 273 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow;
272 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); 274 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
273 BatchedControlUpdate batch(this); 275 BatchedControlUpdate batch(this);
274 276
275 m_allowHiddenVolumeControls = useNewUi; 277 m_allowHiddenVolumeControls = useNewUi;
276 278
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 711
710 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) 712 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled())
711 return; 713 return;
712 714
713 // Controls that we'll hide / show, in order of decreasing priority. 715 // Controls that we'll hide / show, in order of decreasing priority.
714 MediaControlElement* elements[] = { 716 MediaControlElement* elements[] = {
715 // Exclude m_overflowMenu; we handle it specially. 717 // Exclude m_overflowMenu; we handle it specially.
716 m_playButton.get(), 718 m_playButton.get(),
717 m_fullscreenButton.get(), 719 m_fullscreenButton.get(),
718 m_downloadButton.get(), 720 m_downloadButton.get(),
721 m_timeline.get(),
722 m_muteButton.get(),
723 m_volumeSlider.get(),
719 m_toggleClosedCaptionsButton.get(), 724 m_toggleClosedCaptionsButton.get(),
720 m_timeline.get(), 725 m_castButton.get(),
721 m_currentTimeDisplay.get(), 726 m_currentTimeDisplay.get(),
722 m_volumeSlider.get(),
723 m_castButton.get(),
724 m_muteButton.get(),
725 m_durationDisplay.get(), 727 m_durationDisplay.get(),
726 }; 728 };
727 729
728 int usedWidth = 0; 730 int usedWidth = 0;
729 731
730 // Assume that all controls require 48px, unless we can get the computed 732 // Assume that all controls require 48px, unless we can get the computed
731 // style for the play button. Since the play button or overflow is always 733 // style for the play button. Since the play button or overflow is always
732 // shown, one of the two buttons should be available the first time we're 734 // shown, one of the two buttons should be available the first time we're
733 // called after layout. This will 735 // called after layout. This will
734 // also be the first time we have m_panelWidth!=0, so it won't matter if 736 // also be the first time we have m_panelWidth!=0, so it won't matter if
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 visitor->trace(m_enclosure); 868 visitor->trace(m_enclosure);
867 visitor->trace(m_textTrackList); 869 visitor->trace(m_textTrackList);
868 visitor->trace(m_overflowMenu); 870 visitor->trace(m_overflowMenu);
869 visitor->trace(m_overflowList); 871 visitor->trace(m_overflowList);
870 visitor->trace(m_castButton); 872 visitor->trace(m_castButton);
871 visitor->trace(m_overlayCastButton); 873 visitor->trace(m_overlayCastButton);
872 HTMLDivElement::trace(visitor); 874 HTMLDivElement::trace(visitor);
873 } 875 }
874 876
875 } // namespace blink 877 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698