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

Side by Side Diff: ash/wm/window_state.cc

Issue 357063002: Snap widgets to pixel boundary on ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adjust tests Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_state.h ('k') | ash/wm/window_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/window_state.h" 5 #include "ash/wm/window_state.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 gfx::Size min_size = window_->delegate()->GetMinimumSize(); 371 gfx::Size min_size = window_->delegate()->GetMinimumSize();
372 min_size.SetToMin(gfx::Screen::GetScreenFor( 372 min_size.SetToMin(gfx::Screen::GetScreenFor(
373 window_)->GetDisplayNearestWindow(window_).work_area().size()); 373 window_)->GetDisplayNearestWindow(window_).work_area().size());
374 374
375 actual_new_bounds.set_width( 375 actual_new_bounds.set_width(
376 std::max(min_size.width(), actual_new_bounds.width())); 376 std::max(min_size.width(), actual_new_bounds.width()));
377 actual_new_bounds.set_height( 377 actual_new_bounds.set_height(
378 std::max(min_size.height(), actual_new_bounds.height())); 378 std::max(min_size.height(), actual_new_bounds.height()));
379 } 379 }
380 BoundsSetter().SetBounds(window_, actual_new_bounds); 380 BoundsSetter().SetBounds(window_, actual_new_bounds);
381 SnapWindowToPixelBoundary(window_);
381 } 382 }
382 383
383 void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) { 384 void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) {
384 gfx::Rect work_area_in_parent = 385 gfx::Rect work_area_in_parent =
385 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_); 386 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_);
386 gfx::Rect child_bounds(bounds); 387 gfx::Rect child_bounds(bounds);
387 AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds); 388 AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds);
388 SetBoundsDirect(child_bounds); 389 SetBoundsDirect(child_bounds);
389 } 390 }
390 391
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 451 }
451 return settings; 452 return settings;
452 } 453 }
453 454
454 const WindowState* GetWindowState(const aura::Window* window) { 455 const WindowState* GetWindowState(const aura::Window* window) {
455 return GetWindowState(const_cast<aura::Window*>(window)); 456 return GetWindowState(const_cast<aura::Window*>(window));
456 } 457 }
457 458
458 } // namespace wm 459 } // namespace wm
459 } // namespace ash 460 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_state.h ('k') | ash/wm/window_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698