| Index: ash/wm/workspace/snap_sizer.cc
|
| diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
|
| index 158fa3a599a02ec7b860686a3d3d03c326850368..0816ff00acdbc40b6e6537745a97af9d6d5e9a86 100644
|
| --- a/ash/wm/workspace/snap_sizer.cc
|
| +++ b/ash/wm/workspace/snap_sizer.cc
|
| @@ -66,6 +66,18 @@ void SnapSizer::Update(const gfx::Point& location) {
|
| time_last_update_ = base::TimeTicks::Now();
|
| }
|
|
|
| +gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) {
|
| + size_t current;
|
| + for (current = 0; current < arraysize(kPercents); ++current) {
|
| + gfx::Rect target = GetTargetBoundsForPercent(current);
|
| + if (target == bounds) {
|
| + ++current;
|
| + break;
|
| + }
|
| + }
|
| + return GetTargetBoundsForPercent(current % arraysize(kPercents));
|
| +}
|
| +
|
| int SnapSizer::CalculateIncrement(int x, int reference_x) const {
|
| if (AlongEdge(x))
|
| return 1;
|
| @@ -94,12 +106,16 @@ void SnapSizer::ChangeBounds(int x, int delta) {
|
| }
|
|
|
| gfx::Rect SnapSizer::GetTargetBounds() const {
|
| + return GetTargetBoundsForPercent(percent_index_);
|
| +}
|
| +
|
| +gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const {
|
| gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaBounds(window_));
|
| int y = WindowResizer::AlignToGridRoundUp(work_area.y(), grid_size_);
|
| // We don't align to the bottom of the grid as the launcher may not
|
| // necessarily align to the grid (happens when auto-hidden).
|
| int max_y = work_area.bottom();
|
| - int width = static_cast<float>(work_area.width()) * kPercents[percent_index_];
|
| + int width = static_cast<float>(work_area.width()) * kPercents[percent_index];
|
| if (edge_ == LEFT_EDGE) {
|
| int x = WindowResizer::AlignToGridRoundUp(work_area.x(), grid_size_);
|
| int mid_x = WindowResizer::AlignToGridRoundUp(
|
|
|