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

Side by Side Diff: Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp

Issue 7472040: Merge 91337 - [chromium] Media player controls do not fade out. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 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 | « Source/WebCore/html/shadow/MediaControlRootElementChromium.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) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 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 12 matching lines...) Expand all
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 28
29 #if ENABLE(VIDEO) 29 #if ENABLE(VIDEO)
30 #include "MediaControlRootElementChromium.h" 30 #include "MediaControlRootElementChromium.h"
31 31
32 #include "MediaControlElements.h" 32 #include "MediaControlElements.h"
33 #include "MouseEvent.h"
33 #include "Page.h" 34 #include "Page.h"
34 #include "RenderTheme.h" 35 #include "RenderTheme.h"
35 36
36 using namespace std; 37 using namespace std;
37 38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 MediaControlRootElementChromium::MediaControlRootElementChromium(HTMLMediaElemen t* mediaElement) 41 MediaControlRootElementChromium::MediaControlRootElementChromium(HTMLMediaElemen t* mediaElement)
41 : MediaControls(mediaElement) 42 : MediaControls(mediaElement)
42 , m_mediaElement(mediaElement) 43 , m_mediaElement(mediaElement)
43 , m_playButton(0) 44 , m_playButton(0)
44 , m_currentTimeDisplay(0) 45 , m_currentTimeDisplay(0)
45 , m_timeline(0) 46 , m_timeline(0)
46 , m_timelineContainer(0) 47 , m_timelineContainer(0)
47 , m_panelMuteButton(0) 48 , m_panelMuteButton(0)
48 , m_volumeSlider(0) 49 , m_volumeSlider(0)
49 , m_volumeSliderContainer(0) 50 , m_volumeSliderContainer(0)
50 , m_panel(0) 51 , m_panel(0)
51 , m_opaque(true) 52 , m_opaque(true)
53 , m_isMouseOverControls(false)
52 { 54 {
53 } 55 }
54 56
55 PassRefPtr<MediaControls> MediaControls::create(HTMLMediaElement* mediaElement) 57 PassRefPtr<MediaControls> MediaControls::create(HTMLMediaElement* mediaElement)
56 { 58 {
57 return MediaControlRootElementChromium::create(mediaElement); 59 return MediaControlRootElementChromium::create(mediaElement);
58 } 60 }
59 61
60 PassRefPtr<MediaControlRootElementChromium> MediaControlRootElementChromium::cre ate(HTMLMediaElement* mediaElement) 62 PassRefPtr<MediaControlRootElementChromium> MediaControlRootElementChromium::cre ate(HTMLMediaElement* mediaElement)
61 { 63 {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 { 204 {
203 m_playButton->updateDisplayType(); 205 m_playButton->updateDisplayType();
204 m_timeline->setPosition(m_mediaElement->currentTime()); 206 m_timeline->setPosition(m_mediaElement->currentTime());
205 updateTimeDisplay(); 207 updateTimeDisplay();
206 } 208 }
207 209
208 void MediaControlRootElementChromium::playbackProgressed() 210 void MediaControlRootElementChromium::playbackProgressed()
209 { 211 {
210 m_timeline->setPosition(m_mediaElement->currentTime()); 212 m_timeline->setPosition(m_mediaElement->currentTime());
211 updateTimeDisplay(); 213 updateTimeDisplay();
214
215 if (!m_isMouseOverControls && m_mediaElement->hasVideo())
216 makeTransparent();
212 } 217 }
213 218
214 void MediaControlRootElementChromium::playbackStopped() 219 void MediaControlRootElementChromium::playbackStopped()
215 { 220 {
216 m_playButton->updateDisplayType(); 221 m_playButton->updateDisplayType();
217 m_timeline->setPosition(m_mediaElement->currentTime()); 222 m_timeline->setPosition(m_mediaElement->currentTime());
218 updateTimeDisplay(); 223 updateTimeDisplay();
219 makeOpaque(); 224 makeOpaque();
220 } 225 }
221 226
(...skipping 30 matching lines...) Expand all
252 bool MediaControlRootElementChromium::shouldHideControls() 257 bool MediaControlRootElementChromium::shouldHideControls()
253 { 258 {
254 return !m_panel->hovered(); 259 return !m_panel->hovered();
255 } 260 }
256 261
257 void MediaControlRootElementChromium::loadedMetadata() 262 void MediaControlRootElementChromium::loadedMetadata()
258 { 263 {
259 reset(); 264 reset();
260 } 265 }
261 266
267 bool MediaControlRootElementChromium::containsRelatedTarget(Event* event)
268 {
269 if (!event->isMouseEvent())
270 return false;
271 EventTarget* relatedTarget = static_cast<MouseEvent*>(event)->relatedTarget( );
272 if (!relatedTarget)
273 return false;
274 return contains(relatedTarget->toNode());
275 }
276
277 void MediaControlRootElementChromium::defaultEventHandler(Event* event)
278 {
279 MediaControls::defaultEventHandler(event);
280
281 if (event->type() == eventNames().mouseoverEvent) {
282 if (!containsRelatedTarget(event)) {
283 m_isMouseOverControls = true;
284 if (!m_mediaElement->canPlay())
285 makeOpaque();
286 }
287 } else if (event->type() == eventNames().mouseoutEvent) {
288 if (!containsRelatedTarget(event))
289 m_isMouseOverControls = false;
290 }
291 }
292
262 void MediaControlRootElementChromium::changedClosedCaptionsVisibility() 293 void MediaControlRootElementChromium::changedClosedCaptionsVisibility()
263 { 294 {
264 } 295 }
265 296
266 void MediaControlRootElementChromium::changedMute() 297 void MediaControlRootElementChromium::changedMute()
267 { 298 {
268 m_panelMuteButton->changedMute(); 299 m_panelMuteButton->changedMute();
269 } 300 }
270 301
271 void MediaControlRootElementChromium::changedVolume() 302 void MediaControlRootElementChromium::changedVolume()
(...skipping 19 matching lines...) Expand all
291 322
292 const AtomicString& MediaControlRootElementChromium::shadowPseudoId() const 323 const AtomicString& MediaControlRootElementChromium::shadowPseudoId() const
293 { 324 {
294 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls")); 325 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls"));
295 return id; 326 return id;
296 } 327 }
297 328
298 } 329 }
299 330
300 #endif 331 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/html/shadow/MediaControlRootElementChromium.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698