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

Unified Diff: ash/wm/panels/panel_layout_manager.cc

Issue 196723009: Not submitted - Fixing invalid visibility states with layers which showed up in unittests ... (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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/panels/panel_layout_manager.cc
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index 9392303b8518bb5a68eb7cfd85da073e0c6fd955..6ac06745bf842f40eb1e0f6f2de4a1e6cfc56d44 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -57,6 +57,11 @@ const int kPanelSlideInOffset = 20;
const int kArrowWidth = 18;
const int kArrowHeight = 9;
+// When a window layer gets hidden, and the window remains "logically visible",
+// it is illegal to fade the layer to 0. We therefore use a fraction which is
+// resolving to an alpha of 0 but tells a comparison otherwise.
+const float kWindowLayerNotShown = 0.001f;
+
class CalloutWidgetBackground : public views::Background {
public:
CalloutWidgetBackground() : alignment_(SHELF_ALIGNMENT_BOTTOM) {
@@ -243,7 +248,7 @@ class PanelCalloutWidget : public views::Widget {
background_ = new CalloutWidgetBackground;
content_view->set_background(background_);
SetContentsView(content_view);
- GetNativeWindow()->layer()->SetOpacity(0);
+ GetNativeWindow()->layer()->SetOpacity(kWindowLayerNotShown);
}
// Weak pointer owned by this widget's content view.
@@ -366,7 +371,7 @@ void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (child != dragged_panel_) {
// Set the panel to 0 opacity until it has been positioned to prevent it
// from flashing briefly at position (0, 0).
- child->layer()->SetOpacity(0);
+ child->layer()->SetOpacity(kWindowLayerNotShown);
panel_info.slide_in = true;
}
panel_windows_.push_back(panel_info);
@@ -561,7 +566,7 @@ void PanelLayoutManager::MinimizePanel(aura::Window* panel) {
PanelList::iterator found =
std::find(panel_windows_.begin(), panel_windows_.end(), panel);
if (found != panel_windows_.end()) {
- layer->SetOpacity(0);
+ layer->SetOpacity(kWindowLayerNotShown);
// The next time the window is visible it should slide into place.
found->slide_in = true;
}
@@ -857,12 +862,12 @@ void PanelLayoutManager::UpdateCallouts() {
panel->layer()->GetTargetTransform().IsIdentity()) {
if (distance_until_over_panel > 0 &&
slide_distance >= distance_until_over_panel) {
- layer->SetOpacity(0);
+ layer->SetOpacity(kWindowLayerNotShown);
// If the panel is not yet over the callout, then delay fading in
// the callout until after the panel should be over it.
int delay = kPanelSlideDurationMilliseconds *
distance_until_over_panel / slide_distance;
- layer->SetOpacity(0);
+ layer->SetOpacity(kWindowLayerNotShown);
layer->GetAnimator()->StopAnimating();
layer->GetAnimator()->SchedulePauseForProperties(
base::TimeDelta::FromMilliseconds(delay),

Powered by Google App Engine
This is Rietveld 408576698