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

Side by Side Diff: ios/chrome/browser/ui/animation_util.mm

Issue 2569713002: [ObjC ARC] Converts ios/chrome/browser/ui:ui to ARC. (Closed)
Patch Set: Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ios/chrome/browser/ui/animation_util.h" 5 #include "ios/chrome/browser/ui/animation_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ios/chrome/browser/ui/reversed_animation.h" 10 #include "ios/chrome/browser/ui/reversed_animation.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
12 CAAnimation* FrameAnimationMake(CALayer* layer, 16 CAAnimation* FrameAnimationMake(CALayer* layer,
13 CGRect beginFrame, 17 CGRect beginFrame,
14 CGRect endFrame) { 18 CGRect endFrame) {
15 CGRect beginBounds = {CGPointZero, beginFrame.size}; 19 CGRect beginBounds = {CGPointZero, beginFrame.size};
16 CGRect endBounds = {CGPointZero, endFrame.size}; 20 CGRect endBounds = {CGPointZero, endFrame.size};
17 CABasicAnimation* boundsAnimation = 21 CABasicAnimation* boundsAnimation =
18 [CABasicAnimation animationWithKeyPath:@"bounds"]; 22 [CABasicAnimation animationWithKeyPath:@"bounds"];
19 boundsAnimation.fromValue = [NSValue valueWithCGRect:beginBounds]; 23 boundsAnimation.fromValue = [NSValue valueWithCGRect:beginBounds];
20 boundsAnimation.toValue = [NSValue valueWithCGRect:endBounds]; 24 boundsAnimation.toValue = [NSValue valueWithCGRect:endBounds];
21 boundsAnimation.removedOnCompletion = NO; 25 boundsAnimation.removedOnCompletion = NO;
(...skipping 30 matching lines...) Expand all
52 for (CAAnimation* animation in animations) 56 for (CAAnimation* animation in animations)
53 duration = std::max(duration, animation.beginTime + animation.duration); 57 duration = std::max(duration, animation.beginTime + animation.duration);
54 animationGroup.duration = duration; 58 animationGroup.duration = duration;
55 animationGroup.fillMode = kCAFillModeBoth; 59 animationGroup.fillMode = kCAFillModeBoth;
56 animationGroup.removedOnCompletion = NO; 60 animationGroup.removedOnCompletion = NO;
57 return animationGroup; 61 return animationGroup;
58 } 62 }
59 63
60 CAAnimation* DelayedAnimationMake(CAAnimation* animation, 64 CAAnimation* DelayedAnimationMake(CAAnimation* animation,
61 CFTimeInterval delay) { 65 CFTimeInterval delay) {
62 CAAnimation* delayedAnimation = [[animation copy] autorelease]; 66 CAAnimation* delayedAnimation = [animation copy];
63 if (delayedAnimation) { 67 if (delayedAnimation) {
64 delayedAnimation.beginTime = delay; 68 delayedAnimation.beginTime = delay;
65 delayedAnimation = AnimationGroupMake(@[ delayedAnimation ]); 69 delayedAnimation = AnimationGroupMake(@[ delayedAnimation ]);
66 } 70 }
67 return delayedAnimation; 71 return delayedAnimation;
68 } 72 }
69 73
70 CABasicAnimation* FindAnimationForKeyPath(NSString* keyPath, 74 CABasicAnimation* FindAnimationForKeyPath(NSString* keyPath,
71 CAAnimation* animation) { 75 CAAnimation* animation) {
72 __block CABasicAnimation* animationForKeyPath = nil; 76 __block CABasicAnimation* animationForKeyPath = nil;
(...skipping 12 matching lines...) Expand all
85 *stop = animationForKeyPath != nil; 89 *stop = animationForKeyPath != nil;
86 }]; 90 }];
87 } 91 }
88 return animationForKeyPath; 92 return animationForKeyPath;
89 } 93 }
90 94
91 void RemoveAnimationForKeyFromLayers(NSString* key, NSArray* layers) { 95 void RemoveAnimationForKeyFromLayers(NSString* key, NSArray* layers) {
92 for (CALayer* layer in layers) 96 for (CALayer* layer in layers)
93 [layer removeAnimationForKey:key]; 97 [layer removeAnimationForKey:key];
94 } 98 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/UIView+SizeClassSupport.mm ('k') | ios/chrome/browser/ui/background_generator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698