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

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

Issue 2563853003: [MediaControls] Listen to durationchange instead of letting HTML call methods of MediaControls (Closed)
Patch Set: doing the same as timeupdate Created 4 years 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) 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // become transparent in that case. 698 // become transparent in that case.
699 if (mediaElement().paused()) { 699 if (mediaElement().paused()) {
700 makeOpaque(); 700 makeOpaque();
701 return; 701 return;
702 } 702 }
703 703
704 if (isVisible() && shouldHideMediaControls()) 704 if (isVisible() && shouldHideMediaControls())
705 makeTransparent(); 705 makeTransparent();
706 } 706 }
707 707
708 void MediaControls::onDurationChange() {
709 m_timeline->setDuration(mediaElement().duration());
710 updateCurrentTimeDisplay();
711
712 // 'durationchange' might be called in a paused state. The controls should not
713 // become transparent in that case.
714 if (mediaElement().paused()) {
715 makeOpaque();
716 return;
717 }
718
719 if (isVisible() && shouldHideMediaControls())
720 makeTransparent();
mlamouri (slow - plz ping) 2016/12/13 20:00:00 I don't think you need to do all the transparency
Zhiqiang Zhang (Slow) 2016/12/13 20:13:20 Done.
721 }
722
708 void MediaControls::onPlay() { 723 void MediaControls::onPlay() {
709 updatePlayState(); 724 updatePlayState();
710 m_timeline->setPosition(mediaElement().currentTime()); 725 m_timeline->setPosition(mediaElement().currentTime());
711 updateCurrentTimeDisplay(); 726 updateCurrentTimeDisplay();
712 727
713 startHideMediaControlsTimer(); 728 startHideMediaControlsTimer();
714 } 729 }
715 730
716 void MediaControls::onPause() { 731 void MediaControls::onPause() {
717 updatePlayState(); 732 updatePlayState();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 visitor->trace(m_overflowMenu); 936 visitor->trace(m_overflowMenu);
922 visitor->trace(m_overflowList); 937 visitor->trace(m_overflowList);
923 visitor->trace(m_castButton); 938 visitor->trace(m_castButton);
924 visitor->trace(m_overlayCastButton); 939 visitor->trace(m_overlayCastButton);
925 visitor->trace(m_mediaEventListener); 940 visitor->trace(m_mediaEventListener);
926 visitor->trace(m_windowEventListener); 941 visitor->trace(m_windowEventListener);
927 HTMLDivElement::trace(visitor); 942 HTMLDivElement::trace(visitor);
928 } 943 }
929 944
930 } // namespace blink 945 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698