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

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

Issue 2477203002: Media Controls: delegate 'volumechange' and 'focusin' handling to an EventListener. (Closed)
Patch Set: add comment Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 UserMetricsAction("Media.Controls.Mute")); 292 UserMetricsAction("Media.Controls.Mute"));
293 293
294 mediaElement().setMuted(!mediaElement().muted()); 294 mediaElement().setMuted(!mediaElement().muted());
295 event->setDefaultHandled(); 295 event->setDefaultHandled();
296 } 296 }
297 297
298 MediaControlInputElement::defaultEventHandler(event); 298 MediaControlInputElement::defaultEventHandler(event);
299 } 299 }
300 300
301 void MediaControlMuteButtonElement::updateDisplayType() { 301 void MediaControlMuteButtonElement::updateDisplayType() {
302 setDisplayType(mediaElement().muted() ? MediaUnMuteButton : MediaMuteButton); 302 // TODO(mlamouri): checking for volume == 0 because the mute button will look
303 // 'muted' when the volume is 0 even if the element is not muted. This allows
304 // the painting and the display type to actually match.
305 setDisplayType((mediaElement().muted() || mediaElement().volume() == 0)
306 ? MediaUnMuteButton
307 : MediaMuteButton);
303 updateOverflowString(); 308 updateOverflowString();
304 } 309 }
305 310
306 WebLocalizedString::Name 311 WebLocalizedString::Name
307 MediaControlMuteButtonElement::getOverflowStringName() { 312 MediaControlMuteButtonElement::getOverflowStringName() {
308 if (mediaElement().muted()) 313 if (mediaElement().muted())
309 return WebLocalizedString::OverflowMenuUnmute; 314 return WebLocalizedString::OverflowMenuUnmute;
310 return WebLocalizedString::OverflowMenuMute; 315 return WebLocalizedString::OverflowMenuMute;
311 } 316 }
312 317
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 MediaControlCurrentTimeDisplayElement* 1040 MediaControlCurrentTimeDisplayElement*
1036 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1041 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1037 MediaControlCurrentTimeDisplayElement* element = 1042 MediaControlCurrentTimeDisplayElement* element =
1038 new MediaControlCurrentTimeDisplayElement(mediaControls); 1043 new MediaControlCurrentTimeDisplayElement(mediaControls);
1039 element->setShadowPseudoId( 1044 element->setShadowPseudoId(
1040 AtomicString("-webkit-media-controls-current-time-display")); 1045 AtomicString("-webkit-media-controls-current-time-display"));
1041 return element; 1046 return element;
1042 } 1047 }
1043 1048
1044 } // namespace blink 1049 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698