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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 text_input_client->GetAttachedWindow()->GetToplevelWindow(); | 143 text_input_client->GetAttachedWindow()->GetToplevelWindow(); |
144 if (!window || !window_->Contains(window)) | 144 if (!window || !window_->Contains(window)) |
145 return; | 145 return; |
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 = window->GetBoundsInScreen(); |
flackr
2014/08/26 18:13:51
GetBoundsInScreen will be incorrect if this happen
rsadam
2014/08/26 18:46:28
Done.
| |
154 window_, | |
155 window->GetTargetBounds()); | |
156 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); | 154 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); |
157 int shift = std::min(intersect.height(), | 155 int vertical_displacement = intersect.height() + |
156 std::max(0, window_bounds.y() - new_bounds.y()); | |
flackr
2014/08/26 18:13:52
This is somewhat confusing. Couldn't we just say w
rsadam
2014/08/26 18:46:28
Done.
| |
157 | |
158 // Prevent window from being pushed out of the work space. | |
159 int shift = std::min(vertical_displacement, | |
158 window->bounds().y() - work_area_in_parent_.y()); | 160 window->bounds().y() - work_area_in_parent_.y()); |
159 if (shift > 0) { | 161 if (shift > 0) { |
160 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); | 162 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); |
161 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); | 163 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); |
162 } | 164 } |
163 } else if (window_state->HasRestoreBounds()) { | 165 } else if (window_state->HasRestoreBounds()) { |
164 // Keyboard hidden, restore original bounds if they exist. | 166 // Keyboard hidden, restore original bounds if they exist. |
165 window_state->SetAndClearRestoreBounds(); | 167 window_state->SetAndClearRestoreBounds(); |
166 } | 168 } |
167 } | 169 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 bool is_fullscreen = GetRootWindowController( | 320 bool is_fullscreen = GetRootWindowController( |
319 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 321 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
320 if (is_fullscreen != is_fullscreen_) { | 322 if (is_fullscreen != is_fullscreen_) { |
321 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 323 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
322 is_fullscreen, window_->GetRootWindow()); | 324 is_fullscreen, window_->GetRootWindow()); |
323 is_fullscreen_ = is_fullscreen; | 325 is_fullscreen_ = is_fullscreen; |
324 } | 326 } |
325 } | 327 } |
326 | 328 |
327 } // namespace ash | 329 } // namespace ash |
OLD | NEW |