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

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm

Issue 10641010: Merge 143021 - Fix wobbling of find bar. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" 10 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 toFrame:(NSRect)endFrame 417 toFrame:(NSRect)endFrame
418 duration:(float)duration { 418 duration:(float)duration {
419 NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: 419 NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
420 view, NSViewAnimationTargetKey, 420 view, NSViewAnimationTargetKey,
421 [NSValue valueWithRect:endFrame], NSViewAnimationEndFrameKey, nil]; 421 [NSValue valueWithRect:endFrame], NSViewAnimationEndFrameKey, nil];
422 422
423 NSViewAnimation* animation = 423 NSViewAnimation* animation =
424 [[NSViewAnimation alloc] 424 [[NSViewAnimation alloc]
425 initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]; 425 initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
426 [animation gtm_setDuration:duration 426 [animation gtm_setDuration:duration
427 eventMask:NSLeftMouseUpMask]; 427 eventMask:NSLeftMouseUpMask];
428 [animation setDelegate:self]; 428 [animation setDelegate:self];
429 [animation startAnimation]; 429 [animation startAnimation];
430 return animation; 430 return animation;
431 } 431 }
432 432
433 - (void)setFindBarFrame:(NSRect)endFrame 433 - (void)setFindBarFrame:(NSRect)endFrame
434 animate:(BOOL)animate 434 animate:(BOOL)animate
435 duration:(float)duration { 435 duration:(float)duration {
436 // Save the current frame. 436 // Save the current frame.
437 NSRect startFrame = [findBarView_ frame]; 437 NSRect startFrame = [findBarView_ frame];
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 500 }
501 501
502 - (void)moveFindBarIfNecessary:(BOOL)animate { 502 - (void)moveFindBarIfNecessary:(BOOL)animate {
503 // Don't animate during tests. 503 // Don't animate during tests.
504 if (FindBarBridge::disable_animations_during_testing_) 504 if (FindBarBridge::disable_animations_during_testing_)
505 animate = NO; 505 animate = NO;
506 506
507 NSView* view = [self view]; 507 NSView* view = [self view];
508 NSRect frame = [view frame]; 508 NSRect frame = [view frame];
509 float x = [self findBarHorizontalPosition]; 509 float x = [self findBarHorizontalPosition];
510 if (frame.origin.x == x)
511 return;
510 512
511 if (animate) { 513 if (animate) {
512 [moveAnimation_ stopAnimation]; 514 [moveAnimation_ stopAnimation];
513 // Restore to the position before the animation was stopped. 515 // Restore to the position before the animation was stopped.
514 [view setFrame:frame]; 516 [view setFrame:frame];
515 frame.origin.x = x; 517 frame.origin.x = x;
516 moveAnimation_.reset([self createAnimationForView:view 518 moveAnimation_.reset([self createAnimationForView:view
517 toFrame:frame 519 toFrame:frame
518 duration:kFindBarMoveDuration]); 520 duration:kFindBarMoveDuration]);
519 } else { 521 } else {
(...skipping 17 matching lines...) Expand all
537 } 539 }
538 } 540 }
539 541
540 // Has to happen after |ClearResults()| above. 542 // Has to happen after |ClearResults()| above.
541 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; 543 BOOL buttonsEnabled = [text length] > 0 ? YES : NO;
542 [previousButton_ setEnabled:buttonsEnabled]; 544 [previousButton_ setEnabled:buttonsEnabled];
543 [nextButton_ setEnabled:buttonsEnabled]; 545 [nextButton_ setEnabled:buttonsEnabled];
544 } 546 }
545 547
546 @end 548 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698