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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm

Issue 2802143002: [Mac] Fix for the tab detach position (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 NSTimeInterval tearProgress = 345 NSTimeInterval tearProgress =
346 [NSDate timeIntervalSinceReferenceDate] - tearTime_; 346 [NSDate timeIntervalSinceReferenceDate] - tearTime_;
347 tearProgress /= kTearDuration; // Normalize. 347 tearProgress /= kTearDuration; // Normalize.
348 tearProgress = sqrtf(MAX(MIN(tearProgress, 1.0), 0.0)); 348 tearProgress = sqrtf(MAX(MIN(tearProgress, 1.0), 0.0));
349 349
350 // Move the dragged window to the right place on the screen. 350 // Move the dragged window to the right place on the screen.
351 // TODO(spqchan): Write a test to check if the window is at the right place. 351 // TODO(spqchan): Write a test to check if the window is at the right place.
352 // See http://crbug.com/687647. 352 // See http://crbug.com/687647.
353 NSPoint origin = sourceWindowFrame_.origin; 353 NSPoint origin = sourceWindowFrame_.origin;
354 origin.x += (thisPoint.x - dragOrigin_.x); 354 origin.x += (thisPoint.x - dragOrigin_.x);
355 origin.y += 355 origin.y += (thisPoint.y - dragOrigin_.y);
356 (thisPoint.y - dragOrigin_.y) + 356 if ([sourceController_ isInAnyFullscreenMode]) {
357 ([sourceController_ menubarOffset] + [sourceController_ menubarHeight]); 357 origin.y +=
358 [sourceController_ menubarOffset] + [sourceController_ menubarHeight];
359 }
358 360
359 if (tearProgress < 1) { 361 if (tearProgress < 1) {
360 // If the tear animation is not complete, call back to ourself with the 362 // If the tear animation is not complete, call back to ourself with the
361 // same event to animate even if the mouse isn't moving. We need to make 363 // same event to animate even if the mouse isn't moving. We need to make
362 // sure these get cancelled in -endDrag:. 364 // sure these get cancelled in -endDrag:.
363 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 365 [NSObject cancelPreviousPerformRequestsWithTarget:self];
364 [self performSelector:@selector(continueDrag:) 366 [self performSelector:@selector(continueDrag:)
365 withObject:theEvent 367 withObject:theEvent
366 afterDelay:1.0f/30.0f]; 368 afterDelay:1.0f/30.0f];
367 369
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 [[targetController_ window] makeMainWindow]; 574 [[targetController_ window] makeMainWindow];
573 } else { 575 } else {
574 [dragWindow_ setAlphaValue:0.5]; 576 [dragWindow_ setAlphaValue:0.5];
575 [[draggedController_ overlayWindow] setHasShadow:NO]; 577 [[draggedController_ overlayWindow] setHasShadow:NO];
576 [[draggedController_ window] makeMainWindow]; 578 [[draggedController_ window] makeMainWindow];
577 } 579 }
578 chromeIsVisible_ = shouldBeVisible; 580 chromeIsVisible_ = shouldBeVisible;
579 } 581 }
580 582
581 @end 583 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698