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

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

Issue 249063003: Revert of Remove remaining window states where window is shown with opacity 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « ash/wm/panels/panel_layout_manager.h ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8954e57f39e4dbb41c8799e48962fe1a5320cf57..9266f94bb1cff1be678a2133d81299322debe184 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -11,7 +11,6 @@
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_types.h"
-#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -364,9 +363,13 @@
PanelInfo panel_info;
panel_info.window = child;
panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
- panel_info.slide_in = child != dragged_panel_;
+ 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);
+ panel_info.slide_in = true;
+ }
panel_windows_.push_back(panel_info);
- child->AddObserver(this);
wm::GetWindowState(child)->AddObserver(this);
Relayout();
}
@@ -383,9 +386,6 @@
delete found->callout_widget;
panel_windows_.erase(found);
}
- if (restore_windows_on_shelf_visible_)
- restore_windows_on_shelf_visible_->Remove(child);
- child->RemoveObserver(this);
wm::GetWindowState(child)->RemoveObserver(this);
if (dragged_panel_ == child)
@@ -458,18 +458,6 @@
/////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowObserver implementation:
-
-void PanelLayoutManager::OnWindowPropertyChanged(aura::Window* window,
- const void* key,
- intptr_t old) {
- // Trigger a relayout to position the panels whenever the panel icon is set
- // or changes.
- if (key == kShelfID)
- Relayout();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// PanelLayoutManager, WindowStateObserver implementation:
void PanelLayoutManager::OnPostWindowStateTypeChange(
wm::WindowState* window_state,
@@ -564,17 +552,20 @@
shelf_->shelf_widget()->GetAlignment()));
SetChildBoundsDirect(panel, bounds);
panel->Hide();
- layer->SetOpacity(0);
+ PanelList::iterator found =
+ std::find(panel_windows_.begin(), panel_windows_.end(), panel);
+ if (found != panel_windows_.end()) {
+ layer->SetOpacity(0);
+ // The next time the window is visible it should slide into place.
+ found->slide_in = true;
+ }
if (wm::IsActiveWindow(panel))
wm::DeactivateWindow(panel);
Relayout();
}
void PanelLayoutManager::RestorePanel(aura::Window* panel) {
- PanelList::iterator found =
- std::find(panel_windows_.begin(), panel_windows_.end(), panel);
- DCHECK(found != panel_windows_.end());
- found->slide_in = true;
+ panel->Show();
Relayout();
}
@@ -604,7 +595,7 @@
// Consider the dragged panel as part of the layout as long as it is
// touching the shelf.
- if ((!panel->IsVisible() && !iter->slide_in) ||
+ if (!panel->IsVisible() ||
(panel == dragged_panel_ &&
!BoundsAdjacent(panel->bounds(), shelf_bounds))) {
continue;
@@ -707,8 +698,7 @@
ui::Layer* layer = visible_panels[i].window->layer();
if (slide_in) {
- // New windows shift up from the shelf into position and fade in.
- layer->SetOpacity(0);
+ // New windows shift up from the shelf into position.
gfx::Rect initial_bounds(bounds);
initial_bounds.Offset(GetSlideInAnimationOffset(alignment));
SetChildBoundsDirect(visible_panels[i].window, initial_bounds);
@@ -724,10 +714,8 @@
panel_slide_settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds));
SetChildBoundsDirect(visible_panels[i].window, bounds);
- if (slide_in) {
+ if (slide_in)
layer->SetOpacity(1);
- visible_panels[i].window->Show();
- }
} else {
// If the shelf moved don't animate, move immediately to the new
// target location.
« no previous file with comments | « ash/wm/panels/panel_layout_manager.h ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698