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

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

Issue 2588823002: Media Controls: change how the MediaControls object is created and handled. (Closed)
Patch Set: Created 3 years, 12 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/Source/core/html/shadow/MediaControls.h ('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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 m_hideMediaControlsTimer(this, 133 m_hideMediaControlsTimer(this,
134 &MediaControls::hideMediaControlsTimerFired), 134 &MediaControls::hideMediaControlsTimerFired),
135 m_hideTimerBehaviorFlags(IgnoreNone), 135 m_hideTimerBehaviorFlags(IgnoreNone),
136 m_isMouseOverControls(false), 136 m_isMouseOverControls(false),
137 m_isPausedForScrubbing(false), 137 m_isPausedForScrubbing(false),
138 m_panelWidthChangedTimer(this, 138 m_panelWidthChangedTimer(this,
139 &MediaControls::panelWidthChangedTimerFired), 139 &MediaControls::panelWidthChangedTimerFired),
140 m_panelWidth(0), 140 m_panelWidth(0),
141 m_keepShowingUntilTimerFires(false) {} 141 m_keepShowingUntilTimerFires(false) {}
142 142
143 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) { 143 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement,
144 ShadowRoot& shadowRoot) {
144 MediaControls* controls = new MediaControls(mediaElement); 145 MediaControls* controls = new MediaControls(mediaElement);
145 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); 146 controls->setShadowPseudoId(AtomicString("-webkit-media-controls"));
146 controls->initializeControls(); 147 controls->initializeControls();
148 controls->reset();
147 149
148 // Initialize the orientation lock when going fullscreen feature. 150 // Initialize the orientation lock when going fullscreen feature.
149 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && 151 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() &&
150 mediaElement.isHTMLVideoElement()) { 152 mediaElement.isHTMLVideoElement()) {
151 controls->m_orientationLockDelegate = 153 controls->m_orientationLockDelegate =
152 new MediaControlsOrientationLockDelegate( 154 new MediaControlsOrientationLockDelegate(
153 toHTMLVideoElement(mediaElement)); 155 toHTMLVideoElement(mediaElement));
154 } 156 }
155 157
158 shadowRoot.appendChild(controls);
156 return controls; 159 return controls;
157 } 160 }
158 161
159 // The media controls DOM structure looks like: 162 // The media controls DOM structure looks like:
160 // 163 //
161 // MediaControls 164 // MediaControls
162 // (-webkit-media-controls) 165 // (-webkit-media-controls)
163 // +-MediaControlOverlayEnclosureElement 166 // +-MediaControlOverlayEnclosureElement
164 // | (-webkit-media-controls-overlay-enclosure) 167 // | (-webkit-media-controls-overlay-enclosure)
165 // | +-MediaControlOverlayPlayButtonElement 168 // | +-MediaControlOverlayPlayButtonElement
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 350
348 updateCurrentTimeDisplay(); 351 updateCurrentTimeDisplay();
349 352
350 m_timeline->setDuration(duration); 353 m_timeline->setDuration(duration);
351 m_timeline->setPosition(mediaElement().currentTime()); 354 m_timeline->setPosition(mediaElement().currentTime());
352 355
353 onVolumeChange(); 356 onVolumeChange();
354 onTextTracksAddedOrRemoved(); 357 onTextTracksAddedOrRemoved();
355 358
356 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); 359 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));
357 m_fullscreenButton->setIsFullscreen(mediaElement().isFullscreen());
Zhiqiang Zhang (Slow) 2016/12/20 12:16:46 nit: why move this to FullscreenButton::create() b
mlamouri (slow - plz ping) 2016/12/20 13:36:24 I moved this here in my previous CL. I realised it
358 360
359 refreshCastButtonVisibilityWithoutUpdate(); 361 refreshCastButtonVisibilityWithoutUpdate();
360 362
361 m_downloadButton->setIsWanted( 363 m_downloadButton->setIsWanted(
362 m_downloadButton->shouldDisplayDownloadButton()); 364 m_downloadButton->shouldDisplayDownloadButton());
363 } 365 }
364 366
365 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() { 367 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() {
366 return m_panel->layoutObject(); 368 return m_panel->layoutObject();
367 } 369 }
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 visitor->trace(m_overflowList); 954 visitor->trace(m_overflowList);
953 visitor->trace(m_castButton); 955 visitor->trace(m_castButton);
954 visitor->trace(m_overlayCastButton); 956 visitor->trace(m_overlayCastButton);
955 visitor->trace(m_mediaEventListener); 957 visitor->trace(m_mediaEventListener);
956 visitor->trace(m_windowEventListener); 958 visitor->trace(m_windowEventListener);
957 visitor->trace(m_orientationLockDelegate); 959 visitor->trace(m_orientationLockDelegate);
958 HTMLDivElement::trace(visitor); 960 HTMLDivElement::trace(visitor);
959 } 961 }
960 962
961 } // namespace blink 963 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698