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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp

Issue 2873493004: [Media Controls] Prevent flicker when enter/exit fullscreen (Closed)
Patch Set: Add virtual/new-remote-playback-pipeline variants to SlowTests Created 3 years, 7 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
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } 565 }
566 566
567 LayoutObject* MediaControlsImpl::PanelLayoutObject() { 567 LayoutObject* MediaControlsImpl::PanelLayoutObject() {
568 return panel_->GetLayoutObject(); 568 return panel_->GetLayoutObject();
569 } 569 }
570 570
571 LayoutObject* MediaControlsImpl::ContainerLayoutObject() { 571 LayoutObject* MediaControlsImpl::ContainerLayoutObject() {
572 return GetLayoutObject(); 572 return GetLayoutObject();
573 } 573 }
574 574
575 void MediaControlsImpl::Show() { 575 void MediaControlsImpl::MaybeShow() {
576 MakeOpaque();
577 panel_->SetIsWanted(true); 576 panel_->SetIsWanted(true);
578 panel_->SetIsDisplayed(true); 577 panel_->SetIsDisplayed(true);
579 if (overlay_play_button_) 578 if (overlay_play_button_)
580 overlay_play_button_->UpdateDisplayType(); 579 overlay_play_button_->UpdateDisplayType();
580 // Only make the controls visible if they won't get hidden by OnTimeUpdate.
581 if (MediaElement().paused() || !ShouldHideMediaControls())
582 MakeOpaque();
581 } 583 }
582 584
583 void MediaControlsImpl::Hide() { 585 void MediaControlsImpl::Hide() {
584 panel_->SetIsWanted(false); 586 panel_->SetIsWanted(false);
585 panel_->SetIsDisplayed(false); 587 panel_->SetIsDisplayed(false);
586 if (overlay_play_button_) 588 if (overlay_play_button_)
587 overlay_play_button_->SetIsWanted(false); 589 overlay_play_button_->SetIsWanted(false);
588 } 590 }
589 591
590 bool MediaControlsImpl::IsVisible() const { 592 bool MediaControlsImpl::IsVisible() const {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 BatchedControlUpdate batch(this); 906 BatchedControlUpdate batch(this);
905 volume_slider_->SetIsWanted(MediaElement().HasAudio() && 907 volume_slider_->SetIsWanted(MediaElement().HasAudio() &&
906 !PreferHiddenVolumeControls(GetDocument())); 908 !PreferHiddenVolumeControls(GetDocument()));
907 mute_button_->SetIsWanted(MediaElement().HasAudio()); 909 mute_button_->SetIsWanted(MediaElement().HasAudio());
908 } 910 }
909 911
910 void MediaControlsImpl::OnFocusIn() { 912 void MediaControlsImpl::OnFocusIn() {
911 if (!MediaElement().ShouldShowControls()) 913 if (!MediaElement().ShouldShowControls())
912 return; 914 return;
913 915
914 Show();
915 ResetHideMediaControlsTimer(); 916 ResetHideMediaControlsTimer();
917 MaybeShow();
916 } 918 }
917 919
918 void MediaControlsImpl::OnTimeUpdate() { 920 void MediaControlsImpl::OnTimeUpdate() {
919 timeline_->SetPosition(MediaElement().currentTime()); 921 timeline_->SetPosition(MediaElement().currentTime());
920 UpdateCurrentTimeDisplay(); 922 UpdateCurrentTimeDisplay();
921 923
922 // 'timeupdate' might be called in a paused state. The controls should not 924 // 'timeupdate' might be called in a paused state. The controls should not
923 // become transparent in that case. 925 // become transparent in that case.
924 if (MediaElement().paused()) { 926 if (MediaElement().paused()) {
925 MakeOpaque(); 927 MakeOpaque();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 visitor->Trace(overlay_cast_button_); 1217 visitor->Trace(overlay_cast_button_);
1216 visitor->Trace(media_event_listener_); 1218 visitor->Trace(media_event_listener_);
1217 visitor->Trace(window_event_listener_); 1219 visitor->Trace(window_event_listener_);
1218 visitor->Trace(orientation_lock_delegate_); 1220 visitor->Trace(orientation_lock_delegate_);
1219 visitor->Trace(rotate_to_fullscreen_delegate_); 1221 visitor->Trace(rotate_to_fullscreen_delegate_);
1220 MediaControls::Trace(visitor); 1222 MediaControls::Trace(visitor);
1221 HTMLDivElement::Trace(visitor); 1223 HTMLDivElement::Trace(visitor);
1222 } 1224 }
1223 1225
1224 } // namespace blink 1226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698