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

Side by Side Diff: chrome/browser/ui/cocoa/fast_resize_view.mm

Issue 203573005: Disable CoreAnimation by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/nsview_additions.mm » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/fast_resize_view.h" 5 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "ui/base/cocoa/animation_utils.h" 12 #include "ui/base/cocoa/animation_utils.h"
13 #include "ui/base/ui_base_switches.h" 13 #include "ui/base/ui_base_switches.h"
14 14
15 @interface FastResizeView (PrivateMethods) 15 @interface FastResizeView (PrivateMethods)
16 // Lays out this views subviews. If fast resize mode is on, does not resize any 16 // Lays out this views subviews. If fast resize mode is on, does not resize any
17 // subviews and instead pegs them to the top left. If fast resize mode is off, 17 // subviews and instead pegs them to the top left. If fast resize mode is off,
18 // sets the subviews' frame to be equal to this view's bounds. 18 // sets the subviews' frame to be equal to this view's bounds.
19 - (void)layoutSubviews; 19 - (void)layoutSubviews;
20 @end 20 @end
21 21
22 @implementation FastResizeView 22 @implementation FastResizeView
23 23
24 - (id)initWithFrame:(NSRect)frameRect { 24 - (id)initWithFrame:(NSRect)frameRect {
25 if ((self = [super initWithFrame:frameRect])) { 25 if ((self = [super initWithFrame:frameRect])) {
26 if (!CommandLine::ForCurrentProcess()->HasSwitch( 26 if (CommandLine::ForCurrentProcess()->HasSwitch(
27 switches::kDisableCoreAnimation)) { 27 switches::kEnableCoreAnimation)) {
28 ScopedCAActionDisabler disabler; 28 ScopedCAActionDisabler disabler;
29 base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]); 29 base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]);
30 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; 30 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
31 [self setLayer:layer]; 31 [self setLayer:layer];
32 [self setWantsLayer:YES]; 32 [self setWantsLayer:YES];
33 } 33 }
34 } 34 }
35 return self; 35 return self;
36 } 36 }
37 37
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 NSRect frame = [subview frame]; 87 NSRect frame = [subview frame];
88 frame.origin.x = 0; 88 frame.origin.x = 0;
89 frame.origin.y = NSHeight(bounds) - NSHeight(frame); 89 frame.origin.y = NSHeight(bounds) - NSHeight(frame);
90 [subview setFrame:frame]; 90 [subview setFrame:frame];
91 } else { 91 } else {
92 [subview setFrame:bounds]; 92 [subview setFrame:bounds];
93 } 93 }
94 } 94 }
95 95
96 @end 96 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/nsview_additions.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698