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

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

Issue 2671073002: [Mac] Fullscreen layout issues (Closed)
Patch Set: Created 3 years, 10 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // events). |tearProgress| is a normalized measure of how far through this 341 // events). |tearProgress| is a normalized measure of how far through this
342 // tear "animation" (of length kTearDuration) we are and has values [0..1]. 342 // tear "animation" (of length kTearDuration) we are and has values [0..1].
343 // We use sqrt() so the animation is non-linear (slow down near the end 343 // We use sqrt() so the animation is non-linear (slow down near the end
344 // point). 344 // point).
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.
352 // See http://crbug.com/687647.
351 NSPoint origin = sourceWindowFrame_.origin; 353 NSPoint origin = sourceWindowFrame_.origin;
352 origin.x += (thisPoint.x - dragOrigin_.x); 354 origin.x += (thisPoint.x - dragOrigin_.x);
353 origin.y += (thisPoint.y - dragOrigin_.y); 355 origin.y +=
356 (thisPoint.y - dragOrigin_.y) +
357 ([sourceController_ menubarOffset] + [sourceController_ menubarHeight]);
354 358
355 if (tearProgress < 1) { 359 if (tearProgress < 1) {
356 // If the tear animation is not complete, call back to ourself with the 360 // If the tear animation is not complete, call back to ourself with the
357 // same event to animate even if the mouse isn't moving. We need to make 361 // same event to animate even if the mouse isn't moving. We need to make
358 // sure these get cancelled in -endDrag:. 362 // sure these get cancelled in -endDrag:.
359 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 363 [NSObject cancelPreviousPerformRequestsWithTarget:self];
360 [self performSelector:@selector(continueDrag:) 364 [self performSelector:@selector(continueDrag:)
361 withObject:theEvent 365 withObject:theEvent
362 afterDelay:1.0f/30.0f]; 366 afterDelay:1.0f/30.0f];
363 367
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 [[targetController_ window] makeMainWindow]; 572 [[targetController_ window] makeMainWindow];
569 } else { 573 } else {
570 [dragWindow_ setAlphaValue:0.5]; 574 [dragWindow_ setAlphaValue:0.5];
571 [[draggedController_ overlayWindow] setHasShadow:NO]; 575 [[draggedController_ overlayWindow] setHasShadow:NO];
572 [[draggedController_ window] makeMainWindow]; 576 [[draggedController_ window] makeMainWindow];
573 } 577 }
574 chromeIsVisible_ = shouldBeVisible; 578 chromeIsVisible_ = shouldBeVisible;
575 } 579 }
576 580
577 @end 581 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698