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/ui_base_switches.h" | 9 #include "ui/base/ui_base_switches.h" |
10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 colorWithAlphaComponent:0.5 / [self cr_lineWidth]]; | 84 colorWithAlphaComponent:0.5 / [self cr_lineWidth]]; |
85 } | 85 } |
86 | 86 |
87 - (void)cr_recursivelySetNeedsDisplay:(BOOL)flag { | 87 - (void)cr_recursivelySetNeedsDisplay:(BOOL)flag { |
88 [self setNeedsDisplay:YES]; | 88 [self setNeedsDisplay:YES]; |
89 for (NSView* child in [self subviews]) | 89 for (NSView* child in [self subviews]) |
90 [child cr_recursivelySetNeedsDisplay:flag]; | 90 [child cr_recursivelySetNeedsDisplay:flag]; |
91 } | 91 } |
92 | 92 |
93 - (void)cr_setWantsLayer:(BOOL)wantsLayer { | 93 - (void)cr_setWantsLayer:(BOOL)wantsLayer { |
94 if (CommandLine::ForCurrentProcess()->HasSwitch( | 94 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
95 switches::kDisableCoreAnimation)) | 95 switches::kEnableCoreAnimation)) |
96 return; | 96 return; |
97 | 97 |
98 // Dynamically removing layers on SnowLeopard will sometimes result in | 98 // Dynamically removing layers on SnowLeopard will sometimes result in |
99 // crashes. Once a view has a layer on SnowLeopard, it is stuck with it. | 99 // crashes. Once a view has a layer on SnowLeopard, it is stuck with it. |
100 // http://crbug.com/348328 | 100 // http://crbug.com/348328 |
101 if (!wantsLayer && base::mac::IsOSSnowLeopard()) | 101 if (!wantsLayer && base::mac::IsOSSnowLeopard()) |
102 return; | 102 return; |
103 | 103 |
104 [self setWantsLayer:wantsLayer]; | 104 [self setWantsLayer:wantsLayer]; |
105 } | 105 } |
(...skipping 23 matching lines...) Expand all Loading... |
129 } | 129 } |
130 | 130 |
131 - (NSView*)cr_viewBeingDrawnTo { | 131 - (NSView*)cr_viewBeingDrawnTo { |
132 if (!g_ancestorBeingDrawnFrom) | 132 if (!g_ancestorBeingDrawnFrom) |
133 return self; | 133 return self; |
134 DCHECK(g_ancestorBeingDrawnFrom == self); | 134 DCHECK(g_ancestorBeingDrawnFrom == self); |
135 return g_childBeingDrawnTo; | 135 return g_childBeingDrawnTo; |
136 } | 136 } |
137 | 137 |
138 @end | 138 @end |
OLD | NEW |