Commit 1ca79d4a authored by oshima@chromium.org's avatar oshima@chromium.org

Snap widgets to pixel boundary on ash

Introduced SnapToPixelLayoutManager and used where it makes sense.
WorkspaceLayoutManager uses WindowState, so it's the property is manually set there.


This depends on the following CL:
https://codereview.chromium.org/375693006/

BUG=391822

Review URL: https://codereview.chromium.org/357063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284119 0039d316-1c4b-4281-b951-d872f2087c98
parent 388f6742
...@@ -249,6 +249,8 @@ ...@@ -249,6 +249,8 @@
'shell_init_params.cc', 'shell_init_params.cc',
'shell_init_params.h', 'shell_init_params.h',
'shell_window_ids.h', 'shell_window_ids.h',
'snap_to_pixel_layout_manager.cc',
'snap_to_pixel_layout_manager.h',
'sticky_keys/sticky_keys_state.h', 'sticky_keys/sticky_keys_state.h',
'sticky_keys/sticky_keys_controller.cc', 'sticky_keys/sticky_keys_controller.cc',
'sticky_keys/sticky_keys_controller.h', 'sticky_keys/sticky_keys_controller.h',
......
...@@ -856,6 +856,10 @@ void RootWindowController::InitLayoutManagers() { ...@@ -856,6 +856,10 @@ void RootWindowController::InitLayoutManagers() {
new DockedWindowLayoutManager(docked_container, workspace_controller()); new DockedWindowLayoutManager(docked_container, workspace_controller());
docked_container->SetLayoutManager(docked_layout_manager_); docked_container->SetLayoutManager(docked_layout_manager_);
// Installs SnapLayoutManager to containers who set the
// |kSnapsChildrenToPhysicalPixelBoundary| property.
wm::InstallSnapLayoutManagerToContainers(root_window);
// Create Panel layout manager // Create Panel layout manager
aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer);
panel_layout_manager_ = new PanelLayoutManager(panel_container); panel_layout_manager_ = new PanelLayoutManager(panel_container);
...@@ -955,6 +959,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -955,6 +959,7 @@ void RootWindowController::CreateContainersInRootWindow(
"DefaultContainer", "DefaultContainer",
non_lock_screen_containers); non_lock_screen_containers);
::wm::SetChildWindowVisibilityChangesAnimated(default_container); ::wm::SetChildWindowVisibilityChangesAnimated(default_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(default_container);
SetUsesScreenCoordinates(default_container); SetUsesScreenCoordinates(default_container);
SetUsesEasyResizeTargeter(default_container); SetUsesEasyResizeTargeter(default_container);
...@@ -963,6 +968,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -963,6 +968,7 @@ void RootWindowController::CreateContainersInRootWindow(
"AlwaysOnTopContainer", "AlwaysOnTopContainer",
non_lock_screen_containers); non_lock_screen_containers);
::wm::SetChildWindowVisibilityChangesAnimated(always_on_top_container); ::wm::SetChildWindowVisibilityChangesAnimated(always_on_top_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(always_on_top_container);
SetUsesScreenCoordinates(always_on_top_container); SetUsesScreenCoordinates(always_on_top_container);
aura::Window* docked_container = CreateContainer( aura::Window* docked_container = CreateContainer(
...@@ -970,6 +976,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -970,6 +976,7 @@ void RootWindowController::CreateContainersInRootWindow(
"DockedContainer", "DockedContainer",
non_lock_screen_containers); non_lock_screen_containers);
::wm::SetChildWindowVisibilityChangesAnimated(docked_container); ::wm::SetChildWindowVisibilityChangesAnimated(docked_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(docked_container);
SetUsesScreenCoordinates(docked_container); SetUsesScreenCoordinates(docked_container);
SetUsesEasyResizeTargeter(docked_container); SetUsesEasyResizeTargeter(docked_container);
...@@ -977,6 +984,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -977,6 +984,7 @@ void RootWindowController::CreateContainersInRootWindow(
CreateContainer(kShellWindowId_ShelfContainer, CreateContainer(kShellWindowId_ShelfContainer,
"ShelfContainer", "ShelfContainer",
non_lock_screen_containers); non_lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(shelf_container);
SetUsesScreenCoordinates(shelf_container); SetUsesScreenCoordinates(shelf_container);
DescendantShouldStayInSameRootWindow(shelf_container); DescendantShouldStayInSameRootWindow(shelf_container);
...@@ -984,12 +992,14 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -984,12 +992,14 @@ void RootWindowController::CreateContainersInRootWindow(
kShellWindowId_PanelContainer, kShellWindowId_PanelContainer,
"PanelContainer", "PanelContainer",
non_lock_screen_containers); non_lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(panel_container);
SetUsesScreenCoordinates(panel_container); SetUsesScreenCoordinates(panel_container);
aura::Window* shelf_bubble_container = aura::Window* shelf_bubble_container =
CreateContainer(kShellWindowId_ShelfBubbleContainer, CreateContainer(kShellWindowId_ShelfBubbleContainer,
"ShelfBubbleContainer", "ShelfBubbleContainer",
non_lock_screen_containers); non_lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(shelf_bubble_container);
SetUsesScreenCoordinates(shelf_bubble_container); SetUsesScreenCoordinates(shelf_bubble_container);
DescendantShouldStayInSameRootWindow(shelf_bubble_container); DescendantShouldStayInSameRootWindow(shelf_bubble_container);
...@@ -997,12 +1007,14 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -997,12 +1007,14 @@ void RootWindowController::CreateContainersInRootWindow(
CreateContainer(kShellWindowId_AppListContainer, CreateContainer(kShellWindowId_AppListContainer,
"AppListContainer", "AppListContainer",
non_lock_screen_containers); non_lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(app_list_container);
SetUsesScreenCoordinates(app_list_container); SetUsesScreenCoordinates(app_list_container);
aura::Window* modal_container = CreateContainer( aura::Window* modal_container = CreateContainer(
kShellWindowId_SystemModalContainer, kShellWindowId_SystemModalContainer,
"SystemModalContainer", "SystemModalContainer",
non_lock_screen_containers); non_lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(modal_container);
modal_container->SetLayoutManager( modal_container->SetLayoutManager(
new SystemModalContainerLayoutManager(modal_container)); new SystemModalContainerLayoutManager(modal_container));
::wm::SetChildWindowVisibilityChangesAnimated(modal_container); ::wm::SetChildWindowVisibilityChangesAnimated(modal_container);
...@@ -1015,6 +1027,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1015,6 +1027,7 @@ void RootWindowController::CreateContainersInRootWindow(
kShellWindowId_LockScreenContainer, kShellWindowId_LockScreenContainer,
"LockScreenContainer", "LockScreenContainer",
lock_screen_containers); lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(lock_container);
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshDisableLockLayoutManager)) { switches::kAshDisableLockLayoutManager)) {
lock_container->SetLayoutManager( lock_container->SetLayoutManager(
...@@ -1029,6 +1042,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1029,6 +1042,7 @@ void RootWindowController::CreateContainersInRootWindow(
kShellWindowId_LockSystemModalContainer, kShellWindowId_LockSystemModalContainer,
"LockSystemModalContainer", "LockSystemModalContainer",
lock_screen_containers); lock_screen_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(lock_modal_container);
lock_modal_container->SetLayoutManager( lock_modal_container->SetLayoutManager(
new SystemModalContainerLayoutManager(lock_modal_container)); new SystemModalContainerLayoutManager(lock_modal_container));
::wm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); ::wm::SetChildWindowVisibilityChangesAnimated(lock_modal_container);
...@@ -1039,6 +1053,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1039,6 +1053,7 @@ void RootWindowController::CreateContainersInRootWindow(
CreateContainer(kShellWindowId_StatusContainer, CreateContainer(kShellWindowId_StatusContainer,
"StatusContainer", "StatusContainer",
lock_screen_related_containers); lock_screen_related_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(status_container);
SetUsesScreenCoordinates(status_container); SetUsesScreenCoordinates(status_container);
DescendantShouldStayInSameRootWindow(status_container); DescendantShouldStayInSameRootWindow(status_container);
...@@ -1047,6 +1062,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1047,6 +1062,7 @@ void RootWindowController::CreateContainersInRootWindow(
"SettingBubbleContainer", "SettingBubbleContainer",
lock_screen_related_containers); lock_screen_related_containers);
::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container);
SetUsesScreenCoordinates(settings_bubble_container); SetUsesScreenCoordinates(settings_bubble_container);
DescendantShouldStayInSameRootWindow(settings_bubble_container); DescendantShouldStayInSameRootWindow(settings_bubble_container);
...@@ -1055,6 +1071,7 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1055,6 +1071,7 @@ void RootWindowController::CreateContainersInRootWindow(
"MenuContainer", "MenuContainer",
lock_screen_related_containers); lock_screen_related_containers);
::wm::SetChildWindowVisibilityChangesAnimated(menu_container); ::wm::SetChildWindowVisibilityChangesAnimated(menu_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(menu_container);
SetUsesScreenCoordinates(menu_container); SetUsesScreenCoordinates(menu_container);
aura::Window* drag_drop_container = CreateContainer( aura::Window* drag_drop_container = CreateContainer(
...@@ -1062,18 +1079,22 @@ void RootWindowController::CreateContainersInRootWindow( ...@@ -1062,18 +1079,22 @@ void RootWindowController::CreateContainersInRootWindow(
"DragImageAndTooltipContainer", "DragImageAndTooltipContainer",
lock_screen_related_containers); lock_screen_related_containers);
::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container);
wm::SetSnapsChildrenToPhysicalPixelBoundary(drag_drop_container);
SetUsesScreenCoordinates(drag_drop_container); SetUsesScreenCoordinates(drag_drop_container);
aura::Window* overlay_container = CreateContainer( aura::Window* overlay_container = CreateContainer(
kShellWindowId_OverlayContainer, kShellWindowId_OverlayContainer,
"OverlayContainer", "OverlayContainer",
lock_screen_related_containers); lock_screen_related_containers);
wm::SetSnapsChildrenToPhysicalPixelBoundary(overlay_container);
SetUsesScreenCoordinates(overlay_container); SetUsesScreenCoordinates(overlay_container);
aura::Window* virtual_keyboard_parent_container = CreateContainer( aura::Window* virtual_keyboard_parent_container = CreateContainer(
kShellWindowId_VirtualKeyboardParentContainer, kShellWindowId_VirtualKeyboardParentContainer,
"VirtualKeyboardParentContainer", "VirtualKeyboardParentContainer",
root_window); root_window);
wm::SetSnapsChildrenToPhysicalPixelBoundary(
virtual_keyboard_parent_container);
SetUsesScreenCoordinates(virtual_keyboard_parent_container); SetUsesScreenCoordinates(virtual_keyboard_parent_container);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -187,7 +187,8 @@ class ShelfLayoutManager::UpdateShelfObserver ...@@ -187,7 +187,8 @@ class ShelfLayoutManager::UpdateShelfObserver
// ShelfLayoutManager ---------------------------------------------------------- // ShelfLayoutManager ----------------------------------------------------------
ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf)
: root_window_(shelf->GetNativeView()->GetRootWindow()), : SnapToPixelLayoutManager(shelf->GetNativeView()->parent()),
root_window_(shelf->GetNativeView()->GetRootWindow()),
updating_bounds_(false), updating_bounds_(false),
auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
alignment_(SHELF_ALIGNMENT_BOTTOM), alignment_(SHELF_ALIGNMENT_BOTTOM),
...@@ -515,22 +516,9 @@ void ShelfLayoutManager::OnWindowResized() { ...@@ -515,22 +516,9 @@ void ShelfLayoutManager::OnWindowResized() {
LayoutShelf(); LayoutShelf();
} }
void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
}
void ShelfLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
}
void ShelfLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) {
}
void ShelfLayoutManager::SetChildBounds(aura::Window* child, void ShelfLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) { const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds); SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds);
// We may contain other widgets (such as frame maximize bubble) but they don't // We may contain other widgets (such as frame maximize bubble) but they don't
// effect the layout in anyway. // effect the layout in anyway.
if (!updating_bounds_ && if (!updating_bounds_ &&
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_types.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/snap_to_pixel_layout_manager.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "ash/wm/dock/docked_window_layout_manager_observer.h" #include "ash/wm/dock/docked_window_layout_manager_observer.h"
#include "ash/wm/lock_state_observer.h" #include "ash/wm/lock_state_observer.h"
...@@ -22,7 +23,6 @@ ...@@ -22,7 +23,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "ui/aura/layout_manager.h"
#include "ui/gfx/insets.h" #include "ui/gfx/insets.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_controller.h"
...@@ -56,14 +56,14 @@ FORWARD_DECLARE_TEST(WebNotificationTrayTest, PopupAndFullscreen); ...@@ -56,14 +56,14 @@ FORWARD_DECLARE_TEST(WebNotificationTrayTest, PopupAndFullscreen);
// layout to the status area. // layout to the status area.
// To respond to bounds changes in the status area StatusAreaLayoutManager works // To respond to bounds changes in the status area StatusAreaLayoutManager works
// closely with ShelfLayoutManager. // closely with ShelfLayoutManager.
class ASH_EXPORT ShelfLayoutManager : class ASH_EXPORT ShelfLayoutManager
public aura::LayoutManager, : public ash::ShellObserver,
public ash::ShellObserver, public aura::client::ActivationChangeObserver,
public aura::client::ActivationChangeObserver, public DockedWindowLayoutManagerObserver,
public DockedWindowLayoutManagerObserver, public keyboard::KeyboardControllerObserver,
public keyboard::KeyboardControllerObserver, public LockStateObserver,
public LockStateObserver, public SnapToPixelLayoutManager,
public SessionStateObserver { public SessionStateObserver {
public: public:
// We reserve a small area on the edge of the workspace area to ensure that // We reserve a small area on the edge of the workspace area to ensure that
...@@ -164,13 +164,8 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -164,13 +164,8 @@ class ASH_EXPORT ShelfLayoutManager :
// shelf. Specifying 0 leads to use the default. // shelf. Specifying 0 leads to use the default.
void SetAnimationDurationOverride(int duration_override_in_ms); void SetAnimationDurationOverride(int duration_override_in_ms);
// Overridden from aura::LayoutManager: // Overridden from SnapLayoutManager:
virtual void OnWindowResized() OVERRIDE; virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
virtual void OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) OVERRIDE;
virtual void SetChildBounds(aura::Window* child, virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE; const gfx::Rect& requested_bounds) OVERRIDE;
......
...@@ -630,7 +630,8 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container, ...@@ -630,7 +630,8 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container,
shelf_layout_manager_->set_workspace_controller(workspace_controller); shelf_layout_manager_->set_workspace_controller(workspace_controller);
workspace_controller->SetShelf(shelf_layout_manager_); workspace_controller->SetShelf(shelf_layout_manager_);
status_container->SetLayoutManager(new StatusAreaLayoutManager(this)); status_container->SetLayoutManager(
new StatusAreaLayoutManager(status_container, this));
shelf_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new shelf_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new
ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); ShelfWindowTargeter(shelf_container, shelf_layout_manager_)));
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/snap_to_pixel_layout_manager.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ui/aura/window.h"
namespace ash {
SnapToPixelLayoutManager::SnapToPixelLayoutManager(aura::Window* container) {
DCHECK(container->GetProperty(kSnapChildrenToPixelBoundary));
}
SnapToPixelLayoutManager::~SnapToPixelLayoutManager() {
}
void SnapToPixelLayoutManager::OnWindowResized() {
}
void SnapToPixelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void SnapToPixelLayoutManager::OnWillRemoveWindowFromLayout(
aura::Window* child) {
}
void SnapToPixelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
}
void SnapToPixelLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child,
bool visibile) {
}
void SnapToPixelLayoutManager::SetChildBounds(
aura::Window* child,
const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds);
wm::SnapWindowToPixelBoundary(child);
}
} // namespace ash
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_SNAP_TO_PIXEL_LAYOUT_MANAGER_H_
#define ASH_WM_SNAP_TO_PIXEL_LAYOUT_MANAGER_H_
#include "ash/ash_export.h"
#include "base/macros.h"
#include "ui/aura/layout_manager.h"
namespace ash {
// A layout manager that places children's layer at the physical pixel
// boundaries.
class ASH_EXPORT SnapToPixelLayoutManager : public aura::LayoutManager {
public:
explicit SnapToPixelLayoutManager(aura::Window* container);
virtual ~SnapToPixelLayoutManager();
protected:
// Overridden from aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
virtual void OnChildWindowVisibilityChanged(aura::Window* child,
bool visibile) OVERRIDE;
virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(SnapToPixelLayoutManager);
};
} // namespace ash
#endif // ASH_WM_SNAP_TO_PIXEL_LAYOUT_MANAGER_H_
...@@ -402,8 +402,10 @@ class DockedWindowLayoutManager::ShelfWindowObserver : public WindowObserver { ...@@ -402,8 +402,10 @@ class DockedWindowLayoutManager::ShelfWindowObserver : public WindowObserver {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DockedWindowLayoutManager public implementation: // DockedWindowLayoutManager public implementation:
DockedWindowLayoutManager::DockedWindowLayoutManager( DockedWindowLayoutManager::DockedWindowLayoutManager(
aura::Window* dock_container, WorkspaceController* workspace_controller) aura::Window* dock_container,
: dock_container_(dock_container), WorkspaceController* workspace_controller)
: SnapToPixelLayoutManager(dock_container),
dock_container_(dock_container),
in_layout_(false), in_layout_(false),
dragged_window_(NULL), dragged_window_(NULL),
is_dragged_window_docked_(false), is_dragged_window_docked_(false),
...@@ -411,7 +413,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager( ...@@ -411,7 +413,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager(
shelf_(NULL), shelf_(NULL),
workspace_controller_(workspace_controller), workspace_controller_(workspace_controller),
in_fullscreen_(workspace_controller_->GetWindowState() == in_fullscreen_(workspace_controller_->GetWindowState() ==
WORKSPACE_WINDOW_STATE_FULL_SCREEN), WORKSPACE_WINDOW_STATE_FULL_SCREEN),
docked_width_(0), docked_width_(0),
alignment_(DOCKED_ALIGNMENT_NONE), alignment_(DOCKED_ALIGNMENT_NONE),
last_active_window_(NULL), last_active_window_(NULL),
...@@ -716,10 +718,10 @@ void DockedWindowLayoutManager::SetChildBounds( ...@@ -716,10 +718,10 @@ void DockedWindowLayoutManager::SetChildBounds(
actual_new_bounds.set_height( actual_new_bounds.set_height(
std::max(min_size.height(), actual_new_bounds.height())); std::max(min_size.height(), actual_new_bounds.height()));
} }
// Whenever one of our windows is moved or resized enforce layout. SnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds);
SetChildBoundsDirect(child, actual_new_bounds);
if (IsPopupOrTransient(child)) if (IsPopupOrTransient(child))
return; return;
// Whenever one of our windows is moved or resized enforce layout.
ShelfLayoutManager* shelf_layout = ShelfLayoutManager* shelf_layout =
ShelfLayoutManager::ForShelf(dock_container_); ShelfLayoutManager::ForShelf(dock_container_);
if (shelf_layout) if (shelf_layout)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/snap_to_pixel_layout_manager.h"
#include "ash/wm/dock/dock_types.h" #include "ash/wm/dock/dock_types.h"
#include "ash/wm/dock/docked_window_layout_manager_observer.h" #include "ash/wm/dock/docked_window_layout_manager_observer.h"
#include "ash/wm/window_state_observer.h" #include "ash/wm/window_state_observer.h"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
...@@ -67,7 +67,7 @@ struct WindowWithHeight { ...@@ -67,7 +67,7 @@ struct WindowWithHeight {
// TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit
// common functionality. // common functionality.
class ASH_EXPORT DockedWindowLayoutManager class ASH_EXPORT DockedWindowLayoutManager
: public aura::LayoutManager, : public SnapToPixelLayoutManager,
public ash::ShellObserver, public ash::ShellObserver,
public aura::WindowObserver, public aura::WindowObserver,
public aura::client::ActivationChangeObserver, public aura::client::ActivationChangeObserver,
...@@ -134,7 +134,7 @@ class ASH_EXPORT DockedWindowLayoutManager ...@@ -134,7 +134,7 @@ class ASH_EXPORT DockedWindowLayoutManager
// Updates docked layout when shelf bounds change. // Updates docked layout when shelf bounds change.
void OnShelfBoundsChanged(); void OnShelfBoundsChanged();
// aura::LayoutManager: // SnapLayoutManager:
virtual void OnWindowResized() OVERRIDE; virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {}
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
namespace ash { namespace ash {
LockLayoutManager::LockLayoutManager(aura::Window* window) LockLayoutManager::LockLayoutManager(aura::Window* window)
: window_(window), : SnapToPixelLayoutManager(window),
window_(window),
root_window_(window->GetRootWindow()), root_window_(window->GetRootWindow()),
is_observing_keyboard_(false) { is_observing_keyboard_(false) {
Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/snap_to_pixel_layout_manager.h"
#include "ash/wm/wm_types.h" #include "ash/wm/wm_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
...@@ -44,7 +45,7 @@ class WMEvent; ...@@ -44,7 +45,7 @@ class WMEvent;
// For all windows in LockScreenContainer default wm::WindowState is replaced // For all windows in LockScreenContainer default wm::WindowState is replaced
// with LockWindowState. // with LockWindowState.
class ASH_EXPORT LockLayoutManager class ASH_EXPORT LockLayoutManager
: public aura::LayoutManager, : public SnapToPixelLayoutManager,
public aura::WindowObserver, public aura::WindowObserver,
public VirtualKeyboardStateObserver, public VirtualKeyboardStateObserver,
public keyboard::KeyboardControllerObserver { public keyboard::KeyboardControllerObserver {
......
...@@ -16,9 +16,9 @@ namespace ash { ...@@ -16,9 +16,9 @@ namespace ash {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// StatusAreaLayoutManager, public: // StatusAreaLayoutManager, public:
StatusAreaLayoutManager::StatusAreaLayoutManager(ShelfWidget* shelf) StatusAreaLayoutManager::StatusAreaLayoutManager(aura::Window* container,
: in_layout_(false), ShelfWidget* shelf)
shelf_(shelf) { : SnapToPixelLayoutManager(container), in_layout_(false), shelf_(shelf) {
} }
StatusAreaLayoutManager::~StatusAreaLayoutManager() { StatusAreaLayoutManager::~StatusAreaLayoutManager() {
...@@ -31,27 +31,13 @@ void StatusAreaLayoutManager::OnWindowResized() { ...@@ -31,27 +31,13 @@ void StatusAreaLayoutManager::OnWindowResized() {
LayoutStatusArea(); LayoutStatusArea();
} }
void StatusAreaLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void StatusAreaLayoutManager::OnWillRemoveWindowFromLayout(
aura::Window* child) {
}
void StatusAreaLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
}
void StatusAreaLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child, bool visible) {
}
void StatusAreaLayoutManager::SetChildBounds( void StatusAreaLayoutManager::SetChildBounds(
aura::Window* child, aura::Window* child,
const gfx::Rect& requested_bounds) { const gfx::Rect& requested_bounds) {
// Only need to have the shelf do a layout if the child changing is the status // Only need to have the shelf do a layout if the child changing is the status
// area and the shelf isn't in the process of doing a layout. // area and the shelf isn't in the process of doing a layout.
if (child != shelf_->status_area_widget()->GetNativeView() || in_layout_) { if (child != shelf_->status_area_widget()->GetNativeView() || in_layout_) {
SetChildBoundsDirect(child, requested_bounds); SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds);
return; return;
} }
...@@ -60,7 +46,7 @@ void StatusAreaLayoutManager::SetChildBounds( ...@@ -60,7 +46,7 @@ void StatusAreaLayoutManager::SetChildBounds(
if (requested_bounds == child->GetTargetBounds()) if (requested_bounds == child->GetTargetBounds())
return; return;
SetChildBoundsDirect(child, requested_bounds); SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds);
LayoutStatusArea(); LayoutStatusArea();
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ #ifndef ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_
#define ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ #define ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_
#include "ash/snap_to_pixel_layout_manager.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/aura/layout_manager.h" #include "ui/aura/layout_manager.h"
...@@ -15,18 +16,13 @@ class ShelfWidget; ...@@ -15,18 +16,13 @@ class ShelfWidget;
// StatusAreaLayoutManager is a layout manager responsible for the status area. // StatusAreaLayoutManager is a layout manager responsible for the status area.
// In any case when status area needs relayout it redirects this call to // In any case when status area needs relayout it redirects this call to
// ShelfLayoutManager. // ShelfLayoutManager.
class StatusAreaLayoutManager : public aura::LayoutManager { class StatusAreaLayoutManager : public SnapToPixelLayoutManager {
public: public:
explicit StatusAreaLayoutManager(ShelfWidget* shelf); StatusAreaLayoutManager(aura::Window* container, ShelfWidget* shelf);
virtual ~StatusAreaLayoutManager(); virtual ~StatusAreaLayoutManager();
// Overridden from aura::LayoutManager: // Overridden from aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE; virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
virtual void OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) OVERRIDE;
virtual void SetChildBounds(aura::Window* child, virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE; const gfx::Rect& requested_bounds) OVERRIDE;
......
...@@ -46,7 +46,8 @@ const int kCenterPixelDelta = 32; ...@@ -46,7 +46,8 @@ const int kCenterPixelDelta = 32;
SystemModalContainerLayoutManager::SystemModalContainerLayoutManager( SystemModalContainerLayoutManager::SystemModalContainerLayoutManager(
aura::Window* container) aura::Window* container)
: container_(container), : SnapToPixelLayoutManager(container),
container_(container),
modal_background_(NULL) { modal_background_(NULL) {
} }
...@@ -86,19 +87,10 @@ void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout( ...@@ -86,19 +87,10 @@ void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout(
RemoveModalWindow(child); RemoveModalWindow(child);
} }
void SystemModalContainerLayoutManager::OnWindowRemovedFromLayout(
aura::Window* child) {
}
void SystemModalContainerLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child,
bool visible) {
}
void SystemModalContainerLayoutManager::SetChildBounds( void SystemModalContainerLayoutManager::SetChildBounds(
aura::Window* child, aura::Window* child,
const gfx::Rect& requested_bounds) { const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds); SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds);
child->SetProperty(kCenteredKey, DialogIsCentered(requested_bounds)); child->SetProperty(kCenteredKey, DialogIsCentered(requested_bounds));
} }
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#include <vector> #include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/snap_to_pixel_layout_manager.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/keyboard/keyboard_controller_observer.h" #include "ui/keyboard/keyboard_controller_observer.h"
...@@ -32,7 +32,7 @@ namespace ash { ...@@ -32,7 +32,7 @@ namespace ash {
// System modal windows which are centered on the screen will be kept centered // System modal windows which are centered on the screen will be kept centered
// when the container size changes. // when the container size changes.
class ASH_EXPORT SystemModalContainerLayoutManager class ASH_EXPORT SystemModalContainerLayoutManager
: public aura::LayoutManager, : public SnapToPixelLayoutManager,
public aura::WindowObserver, public aura::WindowObserver,
public keyboard::KeyboardControllerObserver { public keyboard::KeyboardControllerObserver {
public: public:
...@@ -41,13 +41,10 @@ class ASH_EXPORT SystemModalContainerLayoutManager ...@@ -41,13 +41,10 @@ class ASH_EXPORT SystemModalContainerLayoutManager
bool has_modal_background() const { return modal_background_ != NULL; } bool has_modal_background() const { return modal_background_ != NULL; }
// Overridden from aura::LayoutManager: // Overridden from SnapToPixelLayoutManager:
virtual void OnWindowResized() OVERRIDE; virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
virtual void OnChildWindowVisibilityChanged(aura::Window* child,
bool visibile) OVERRIDE;
virtual void SetChildBounds(aura::Window* child, virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE; const gfx::Rect& requested_bounds) OVERRIDE;
......
...@@ -21,8 +21,12 @@ DEFINE_WINDOW_PROPERTY_KEY(ui::WindowShowState, ...@@ -21,8 +21,12 @@ DEFINE_WINDOW_PROPERTY_KEY(ui::WindowShowState,
kRestoreShowStateOverrideKey, kRestoreShowStateOverrideKey,
ui::SHOW_STATE_DEFAULT); ui::SHOW_STATE_DEFAULT);
DEFINE_WINDOW_PROPERTY_KEY(bool, kSnapChildrenToPixelBoundary, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kStayInSameRootWindowKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kStayInSameRootWindowKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kUsesScreenCoordinatesKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kUsesScreenCoordinatesKey, false);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(wm::WindowState, DEFINE_OWNED_WINDOW_PROPERTY_KEY(wm::WindowState,
kWindowStateKey, NULL); kWindowStateKey, NULL);
......
...@@ -37,6 +37,10 @@ ASH_EXPORT extern const aura::WindowProperty<gfx::Rect*>* const ...@@ -37,6 +37,10 @@ ASH_EXPORT extern const aura::WindowProperty<gfx::Rect*>* const
ASH_EXPORT extern const aura::WindowProperty<ui::WindowShowState>* const ASH_EXPORT extern const aura::WindowProperty<ui::WindowShowState>* const
kRestoreShowStateOverrideKey; kRestoreShowStateOverrideKey;
// Containers with this property (true) are aligned with physical pixel
// boundary.
extern const aura::WindowProperty<bool>* const kSnapChildrenToPixelBoundary;
// If this is set to true, the window stays in the same root window // If this is set to true, the window stays in the same root window
// even if the bounds outside of its root window is set. // even if the bounds outside of its root window is set.
// This is exported as it's used in the tests. // This is exported as it's used in the tests.
......
...@@ -378,6 +378,7 @@ void WindowState::SetBoundsDirect(const gfx::Rect& bounds) { ...@@ -378,6 +378,7 @@ void WindowState::SetBoundsDirect(const gfx::Rect& bounds) {
std::max(min_size.height(), actual_new_bounds.height())); std::max(min_size.height(), actual_new_bounds.height()));
} }
BoundsSetter().SetBounds(window_, actual_new_bounds); BoundsSetter().SetBounds(window_, actual_new_bounds);
SnapWindowToPixelBoundary(window_);
} }
void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) { void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) {
......
...@@ -330,7 +330,7 @@ class ASH_EXPORT WindowState : public aura::WindowObserver { ...@@ -330,7 +330,7 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
void NotifyPreStateTypeChange(WindowStateType old_window_state_type); void NotifyPreStateTypeChange(WindowStateType old_window_state_type);
void NotifyPostStateTypeChange(WindowStateType old_window_state_type); void NotifyPostStateTypeChange(WindowStateType old_window_state_type);
// Sets |bounds| as is. // Sets |bounds| as is and ensure the layer is aligned with pixel boundary.
void SetBoundsDirect(const gfx::Rect& bounds); void SetBoundsDirect(const gfx::Rect& bounds);
// Sets the window's |bounds| with constraint where the size of the // Sets the window's |bounds| with constraint where the size of the
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/ash_constants.h" #include "ash/ash_constants.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/snap_to_pixel_layout_manager.h"
#include "ash/wm/window_properties.h" #include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "ash/wm/wm_event.h" #include "ash/wm/wm_event.h"
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_delegate.h" #include "ui/aura/window_delegate.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/dip_util.h"
#include "ui/gfx/display.h" #include "ui/gfx/display.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/gfx/screen.h" #include "ui/gfx/screen.h"
...@@ -169,5 +171,40 @@ void ReparentTransientChildrenOfChild(aura::Window* child, ...@@ -169,5 +171,40 @@ void ReparentTransientChildrenOfChild(aura::Window* child,
} }
} }
void SnapWindowToPixelBoundary(aura::Window* window) {
aura::Window* snapped_ancestor = window->parent();
while (snapped_ancestor) {
if (snapped_ancestor->GetProperty(kSnapChildrenToPixelBoundary)) {
ui::SnapLayerToPhysicalPixelBoundary(snapped_ancestor->layer(),
window->layer());
return;
}
snapped_ancestor = snapped_ancestor->parent();
}
}
void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) {
DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary))
<< container->name();
container->SetProperty(kSnapChildrenToPixelBoundary, true);
}
void InstallSnapLayoutManagerToContainers(aura::Window* parent) {
aura::Window::Windows children = parent->children();
for (aura::Window::Windows::iterator iter = children.begin();
iter != children.end();
++iter) {
aura::Window* container = *iter;
if (container->id() < 0) // not a container
continue;
if (container->GetProperty(kSnapChildrenToPixelBoundary)) {
if (!container->layout_manager())
container->SetLayoutManager(new SnapToPixelLayoutManager(container));
} else {
InstallSnapLayoutManagerToContainers(container);
}
}
}
} // namespace wm } // namespace wm
} // namespace ash } // namespace ash
...@@ -14,6 +14,7 @@ class Window; ...@@ -14,6 +14,7 @@ class Window;
} }
namespace gfx { namespace gfx {
class Point;
class Rect; class Rect;
class Size; class Size;
} }
...@@ -96,6 +97,17 @@ void ReparentTransientChildrenOfChild(aura::Window* child, ...@@ -96,6 +97,17 @@ void ReparentTransientChildrenOfChild(aura::Window* child,
aura::Window* old_parent, aura::Window* old_parent,
aura::Window* new_parent); aura::Window* new_parent);
// Snap the window's layer to physical pixel boundary.
void SnapWindowToPixelBoundary(aura::Window* window);
// Mark the container window so that InstallSnapLayoutManagerToContainers
// installs the SnapToPixelLayoutManager.
ASH_EXPORT void SetSnapsChildrenToPhysicalPixelBoundary(
aura::Window* container);
// Traverse the |container| tree and installs SnapToPixelLayoutManager.
void InstallSnapLayoutManagerToContainers(aura::Window* container);
} // namespace wm } // namespace wm
} // namespace ash } // namespace ash
......
...@@ -49,6 +49,7 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) ...@@ -49,6 +49,7 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window)
Shell::GetInstance()->activation_client()->AddObserver(this); Shell::GetInstance()->activation_client()->AddObserver(this);
Shell::GetInstance()->AddShellObserver(this); Shell::GetInstance()->AddShellObserver(this);
root_window_->AddObserver(this); root_window_->AddObserver(this);
DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary));
} }
WorkspaceLayoutManager::~WorkspaceLayoutManager() { WorkspaceLayoutManager::~WorkspaceLayoutManager() {
......
...@@ -523,8 +523,7 @@ TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) { ...@@ -523,8 +523,7 @@ TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) {
EXPECT_FALSE(observer.is_fullscreen()); EXPECT_FALSE(observer.is_fullscreen());
} }
// Following tests were originally written for BaseLayoutManager. // Following "Solo" tests were originally written for BaseLayoutManager.
namespace { namespace {
class WorkspaceLayoutManagerSoloTest : public test::AshTestBase { class WorkspaceLayoutManagerSoloTest : public test::AshTestBase {
...@@ -532,15 +531,6 @@ class WorkspaceLayoutManagerSoloTest : public test::AshTestBase { ...@@ -532,15 +531,6 @@ class WorkspaceLayoutManagerSoloTest : public test::AshTestBase {
WorkspaceLayoutManagerSoloTest() {} WorkspaceLayoutManagerSoloTest() {}
virtual ~WorkspaceLayoutManagerSoloTest() {} virtual ~WorkspaceLayoutManagerSoloTest() {}
virtual void SetUp() OVERRIDE {
test::AshTestBase::SetUp();
UpdateDisplay("800x600");
aura::Window* default_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
default_container->SetLayoutManager(
new WorkspaceLayoutManager(Shell::GetPrimaryRootWindow()));
}
aura::Window* CreateTestWindow(const gfx::Rect& bounds) { aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
return CreateTestWindowInShellWithBounds(bounds); return CreateTestWindowInShellWithBounds(bounds);
} }
...@@ -993,8 +983,8 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { ...@@ -993,8 +983,8 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase {
UpdateDisplay("800x600"); UpdateDisplay("800x600");
aura::Window* default_container = Shell::GetContainer( aura::Window* default_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
layout_manager_ = new WorkspaceLayoutManager(Shell::GetPrimaryRootWindow()); layout_manager_ = static_cast<WorkspaceLayoutManager*>(
default_container->SetLayoutManager(layout_manager_); default_container->layout_manager());
} }
aura::Window* CreateTestWindow(const gfx::Rect& bounds) { aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment