summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 15:48:12 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 15:48:12 +0000
commit0f2fefc6f75c4ed26af770c08c646b0a2a042400 (patch)
tree3a86020eb392a9e0b7527ccd88c6873505e0851a
parent136ee42aecefe42a710fee51d0d7ed0a0366f86d (diff)
downloadchromium_src-0f2fefc6f75c4ed26af770c08c646b0a2a042400.zip
chromium_src-0f2fefc6f75c4ed26af770c08c646b0a2a042400.tar.gz
chromium_src-0f2fefc6f75c4ed26af770c08c646b0a2a042400.tar.bz2
Change default core animation mode to "lazy"
With this CL, the default core animation state is "lazy". This means that windows will switch to core animation mode when overlapping views are shown (find bar, etc..). New windows will always start in non-core animation mode. I'm leaving the command line switch in place to allow for testing. BUG=245900 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/17639007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208931 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm6
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.h9
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.mm23
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm14
4 files changed, 40 insertions, 12 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index edf46c2..01e7672 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -268,10 +268,8 @@ enum {
windowShim_.reset(new BrowserWindowCocoa(browser, self));
// Eagerly enable core animation if requested.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseCoreAnimation) &&
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kUseCoreAnimation) != "lazy") {
+ if ([self coreAnimationStatus] ==
+ browser_window_controller::kCoreAnimationEnabledAlways) {
[[[self window] contentView] setWantsLayer:YES];
[[self tabStripView] setWantsLayer:YES];
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.h b/chrome/browser/ui/cocoa/browser_window_controller_private.h
index 6a70dc0..9e11f1e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.h
@@ -18,6 +18,12 @@ enum InstantUIState {
kInstantUIFullPageResults,
};
+enum CoreAnimationStatus {
+ kCoreAnimationDisabled,
+ kCoreAnimationEnabledLazy,
+ kCoreAnimationEnabledAlways,
+};
+
} // namespace browser_window_controller
// Private methods for the |BrowserWindowController|. This category should
@@ -173,6 +179,9 @@ enum InstantUIState {
// Update visibility of the infobar tip, depending on the state of the window.
- (void)updateInfoBarTipVisibility;
+// Checks if core animation should be enabled or not.
+- (browser_window_controller::CoreAnimationStatus)coreAnimationStatus;
+
@end // @interface BrowserWindowController(Private)
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 0841a00..5511c6a 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -1043,10 +1043,8 @@ willPositionSheet:(NSWindow*)sheet
[self shouldAllowOverlappingViews:inPresentationMode];
if (allowOverlappingViews &&
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseCoreAnimation) &&
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kUseCoreAnimation) == "lazy") {
+ [self coreAnimationStatus] ==
+ browser_window_controller::kCoreAnimationEnabledLazy) {
[[[self window] contentView] setWantsLayer:YES];
[[self tabStripView] setWantsLayer:YES];
}
@@ -1070,4 +1068,21 @@ willPositionSheet:(NSWindow*)sheet
setShouldSuppressTopInfoBarTip:suppressInfoBarTip];
}
+- (browser_window_controller::CoreAnimationStatus)coreAnimationStatus {
+ // TODO(sail) Remove this.
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseCoreAnimation)) {
+ return browser_window_controller::kCoreAnimationEnabledLazy;
+ }
+ if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseCoreAnimation) == "lazy") {
+ return browser_window_controller::kCoreAnimationEnabledLazy;
+ }
+ if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseCoreAnimation) == "disabled") {
+ return browser_window_controller::kCoreAnimationDisabled;
+ }
+ return browser_window_controller::kCoreAnimationEnabledAlways;
+}
+
@end // @implementation BrowserWindowController(Private)
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index c501e72..16ae6a6 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -84,12 +84,19 @@ enum CoreAnimationStatus {
};
static CoreAnimationStatus GetCoreAnimationStatus() {
+ // TODO(sail) Remove this.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseCoreAnimation))
- return CORE_ANIMATION_DISABLED;
+ switches::kUseCoreAnimation)) {
+ return CORE_ANIMATION_ENABLED_LAZY;
+ }
if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kUseCoreAnimation) == "lazy")
+ switches::kUseCoreAnimation) == "lazy") {
return CORE_ANIMATION_ENABLED_LAZY;
+ }
+ if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseCoreAnimation) == "disabled") {
+ return CORE_ANIMATION_DISABLED;
+ }
return CORE_ANIMATION_ENABLED_ALWAYS;
}
@@ -440,7 +447,6 @@ void RenderWidgetHostViewMac::SetAllowOverlappingViews(bool overlapping) {
if (GetCoreAnimationStatus() == CORE_ANIMATION_ENABLED_LAZY) {
if (overlapping) {
ScopedCAActionDisabler disabler;
- [[[cocoa_view_ window] contentView] setWantsLayer:YES];
EnableCoreAnimation();
return;
}