diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 15:54:18 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 15:54:18 +0000 |
commit | 312ddff9af15024059a7e8b855fc3c8276534d1b (patch) | |
tree | b21e4f83065089c6fc665ca3e7229a54498f82df /chrome/browser/cocoa | |
parent | 82a24513a73babfedc349e9aab0dfce342d8a12b (diff) | |
download | chromium_src-312ddff9af15024059a7e8b855fc3c8276534d1b.zip chromium_src-312ddff9af15024059a7e8b855fc3c8276534d1b.tar.gz chromium_src-312ddff9af15024059a7e8b855fc3c8276534d1b.tar.bz2 |
Correctly account for windows of different sizes when snapping windows together during a drag.
BUG=16386
TEST=dragging together windows of different sizes.
Review URL: http://codereview.chromium.org/159270
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 16d8e10..5474f88 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -281,8 +281,15 @@ static const double kDragStartDistance = 3.0; origin.y = (1 - tearProgress) * tearOrigin_.y + tearProgress * origin.y; } - if (targetController_) - origin.y = [[targetController_ window] frame].origin.y; + if (targetController_) { + // In order to "snap" two windows of different sizes together at their + // toolbar, we can't just use the origin of the target frame. We also have + // to take into consideration the difference in height. + NSRect targetFrame = [[targetController_ window] frame]; + NSRect sourceFrame = [dragWindow_ frame]; + origin.y = NSMinY(targetFrame) + + (NSHeight(targetFrame) - NSHeight(sourceFrame)); + } [dragWindow_ setFrameOrigin:NSMakePoint(origin.x, origin.y)]; // If we're not hovering over any window, make the window is fully |