OLD | NEW |
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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 wm::WindowState* window_state = wm::GetWindowState(window); | 146 wm::WindowState* window_state = wm::GetWindowState(window); |
147 if (!new_bounds.IsEmpty()) { | 147 if (!new_bounds.IsEmpty()) { |
148 // Store existing bounds to be restored before resizing for keyboard if it | 148 // Store existing bounds to be restored before resizing for keyboard if it |
149 // is not already stored. | 149 // is not already stored. |
150 if (!window_state->HasRestoreBounds()) | 150 if (!window_state->HasRestoreBounds()) |
151 window_state->SaveCurrentBoundsForRestore(); | 151 window_state->SaveCurrentBoundsForRestore(); |
152 | 152 |
153 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( | 153 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( |
154 window_, | 154 window_, |
155 window->GetTargetBounds()); | 155 window->GetTargetBounds()); |
156 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); | 156 int vertical_displacement = |
157 int shift = std::min(intersect.height(), | 157 std::max(0, window_bounds.bottom() - new_bounds.y()); |
158 window->bounds().y() - work_area_in_parent_.y()); | 158 int shift = std::min(vertical_displacement, |
| 159 window_bounds.y() - work_area_in_parent_.y()); |
159 if (shift > 0) { | 160 if (shift > 0) { |
160 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); | 161 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift); |
161 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); | 162 SetChildBounds(window, gfx::Rect(origin, window_bounds.size())); |
162 } | 163 } |
163 } else if (window_state->HasRestoreBounds()) { | 164 } else if (window_state->HasRestoreBounds()) { |
164 // Keyboard hidden, restore original bounds if they exist. | 165 // Keyboard hidden, restore original bounds if they exist. |
165 window_state->SetAndClearRestoreBounds(); | 166 window_state->SetAndClearRestoreBounds(); |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 ////////////////////////////////////////////////////////////////////////////// | 170 ////////////////////////////////////////////////////////////////////////////// |
170 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 171 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
171 | 172 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 bool is_fullscreen = GetRootWindowController( | 319 bool is_fullscreen = GetRootWindowController( |
319 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 320 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
320 if (is_fullscreen != is_fullscreen_) { | 321 if (is_fullscreen != is_fullscreen_) { |
321 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 322 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
322 is_fullscreen, window_->GetRootWindow()); | 323 is_fullscreen, window_->GetRootWindow()); |
323 is_fullscreen_ = is_fullscreen; | 324 is_fullscreen_ = is_fullscreen; |
324 } | 325 } |
325 } | 326 } |
326 | 327 |
327 } // namespace ash | 328 } // namespace ash |
OLD | NEW |