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

Side by Side Diff: ash/wm/panels/panel_layout_manager.cc

Issue 203793004: Fixing invalid visibility states with layers (opacity==0, visibility==true) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/system_modal_container_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/panels/panel_layout_manager.h" 5 #include "ash/wm/panels/panel_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 callout_bounds.set_y(bounds.y() - callout_bounds.height()); 841 callout_bounds.set_y(bounds.y() - callout_bounds.height());
842 break; 842 break;
843 } 843 }
844 callout_bounds = ScreenUtil::ConvertRectFromScreen( 844 callout_bounds = ScreenUtil::ConvertRectFromScreen(
845 callout_widget->GetNativeWindow()->parent(), 845 callout_widget->GetNativeWindow()->parent(),
846 callout_bounds); 846 callout_bounds);
847 847
848 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); 848 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds);
849 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), 849 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(),
850 panel); 850 panel);
851 callout_widget->Show();
852 851
853 ui::Layer* layer = callout_widget->GetNativeWindow()->layer(); 852 ui::Layer* layer = callout_widget->GetNativeWindow()->layer();
854 // If the panel is not over the callout position or has just become visible 853 // If the panel is not over the callout position or has just become visible
855 // then fade in the callout. 854 // then fade in the callout.
856 if ((distance_until_over_panel > 0 || layer->GetTargetOpacity() < 1) && 855 if ((distance_until_over_panel > 0 || layer->GetTargetOpacity() < 1)) {
857 panel->layer()->GetTargetTransform().IsIdentity()) {
858 if (distance_until_over_panel > 0 && 856 if (distance_until_over_panel > 0 &&
859 slide_distance >= distance_until_over_panel) { 857 slide_distance >= distance_until_over_panel) {
860 layer->SetOpacity(0);
861 // If the panel is not yet over the callout, then delay fading in 858 // If the panel is not yet over the callout, then delay fading in
862 // the callout until after the panel should be over it. 859 // the callout until after the panel should be over it.
863 int delay = kPanelSlideDurationMilliseconds * 860 int delay = kPanelSlideDurationMilliseconds *
864 distance_until_over_panel / slide_distance; 861 distance_until_over_panel / slide_distance;
865 layer->SetOpacity(0); 862 layer->SetOpacity(0);
866 layer->GetAnimator()->StopAnimating(); 863 layer->GetAnimator()->StopAnimating();
867 layer->GetAnimator()->SchedulePauseForProperties( 864 layer->GetAnimator()->SchedulePauseForProperties(
868 base::TimeDelta::FromMilliseconds(delay), 865 base::TimeDelta::FromMilliseconds(delay),
869 ui::LayerAnimationElement::OPACITY); 866 ui::LayerAnimationElement::OPACITY);
870 } 867 }
871 { 868 ui::ScopedLayerAnimationSettings callout_settings(layer->GetAnimator());
872 ui::ScopedLayerAnimationSettings callout_settings(layer->GetAnimator()); 869 callout_settings.SetPreemptionStrategy(
873 callout_settings.SetPreemptionStrategy( 870 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
874 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 871 callout_settings.SetTransitionDuration(
875 callout_settings.SetTransitionDuration( 872 base::TimeDelta::FromMilliseconds(
876 base::TimeDelta::FromMilliseconds( 873 kCalloutFadeDurationMilliseconds));
877 kCalloutFadeDurationMilliseconds)); 874 layer->SetOpacity(1);
878 layer->SetOpacity(1);
879 }
880 } 875 }
876
877 // Show the window after we have started the opacity animation.
sky 2014/03/18 20:13:11 I'll say it again, don't document what the code do
Mr4D (OOO till 08-26) 2014/03/18 21:32:05 Done.
878 callout_widget->Show();
881 } 879 }
882 } 880 }
883 881
884 //////////////////////////////////////////////////////////////////////////////// 882 ////////////////////////////////////////////////////////////////////////////////
885 // keyboard::KeyboardControllerObserver implementation: 883 // keyboard::KeyboardControllerObserver implementation:
886 884
887 void PanelLayoutManager::OnKeyboardBoundsChanging( 885 void PanelLayoutManager::OnKeyboardBoundsChanging(
888 const gfx::Rect& keyboard_bounds) { 886 const gfx::Rect& keyboard_bounds) {
889 // This bounds change will have caused a change to the Shelf which does not 887 // This bounds change will have caused a change to the Shelf which does not
890 // propogate automatically to this class, so manually recalculate bounds. 888 // propogate automatically to this class, so manually recalculate bounds.
891 OnWindowResized(); 889 OnWindowResized();
892 } 890 }
893 891
894 } // namespace internal 892 } // namespace internal
895 } // namespace ash 893 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/system_modal_container_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698