Chromium Code Reviews| Index: ash/wm/workspace/snap_sizer.cc |
| diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc |
| index 9b064e7bf1fdf08844999765fa30fb163e9d54d2..963742b49d7e24d7cca64284063b68ff282aa071 100644 |
| --- a/ash/wm/workspace/snap_sizer.cc |
| +++ b/ash/wm/workspace/snap_sizer.cc |
| @@ -66,6 +66,15 @@ void SnapSizer::Update(const gfx::Point& location) { |
| time_last_update_ = base::TimeTicks::Now(); |
| } |
| +gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) { |
| + for (size_t i = 0; i < arraysize(kPercents); ++i) { |
| + gfx::Rect target = GetTargetBoundsForPercent(i); |
| + if (target != bounds && target.width() > bounds.width()) |
|
sky
2012/04/25 19:23:20
Can you use rect == to find the current snap bound
sadrul
2012/04/25 19:37:54
Done.
|
| + return target; |
| + } |
| + return target_bounds_; |
| +} |
| + |
| int SnapSizer::CalculateIncrement(int x, int reference_x) const { |
| if (AlongEdge(x)) |
| return 1; |
| @@ -94,12 +103,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( |