Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/mac/mac_util.h" | 6 #include "base/mac/mac_util.h" |
| 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "ui/base/cocoa/animation_utils.h" | |
| 9 #include "ui/base/ui_base_switches.h" | 10 #include "ui/base/ui_base_switches.h" |
| 10 | 11 |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 | 13 |
| 13 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 14 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 14 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 15 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 15 | 16 |
| 16 @interface NSView (LionAPI) | 17 @interface NSView (LionAPI) |
| 17 - (NSSize)convertSizeFromBacking:(NSSize)size; | 18 - (NSSize)convertSizeFromBacking:(NSSize)size; |
| 18 @end | 19 @end |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 if (CommandLine::ForCurrentProcess()->HasSwitch( | 111 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 111 switches::kDisableCoreAnimationLayerSquashing)) | 112 switches::kDisableCoreAnimationLayerSquashing)) |
| 112 return; | 113 return; |
| 113 if (![self respondsToSelector:@selector(setCanDrawSubviewsIntoLayer:)]) | 114 if (![self respondsToSelector:@selector(setCanDrawSubviewsIntoLayer:)]) |
| 114 return; | 115 return; |
| 115 | 116 |
| 116 [self setWantsLayer:YES]; | 117 [self setWantsLayer:YES]; |
| 117 [self setCanDrawSubviewsIntoLayer:YES]; | 118 [self setCanDrawSubviewsIntoLayer:YES]; |
| 118 } | 119 } |
| 119 | 120 |
| 121 - (void)cr_setHostsSolidWhiteLayer { | |
| 122 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 123 switches::kDisableCoreAnimation)) | |
| 124 return; | |
| 125 | |
| 126 ScopedCAActionDisabler disabler; | |
| 127 CALayer* layer = [[CALayer alloc] init]; | |
|
Avi (use Gerrit)
2014/03/05 03:19:28
This looks like it leaks. scoped_nsobject?
ccameron
2014/03/05 07:59:31
Yes, it does leak. The setLayer will take out a re
| |
| 128 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; | |
| 129 [self setLayer:layer]; | |
| 130 [self setWantsLayer:YES]; | |
| 131 } | |
| 132 | |
| 120 @end | 133 @end |
| OLD | NEW |