diff options
author | shrike <shrike@chromium.org> | 2016-02-02 09:25:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-02 17:26:04 +0000 |
commit | 01226f515fabfadae17388ee747e6b43e5ea12ac (patch) | |
tree | 26344b6719e95e9a1a6fdef27ccaac80c0fcac06 | |
parent | 256fa711cb76bdf8807087199088fd65114747db (diff) | |
download | chromium_src-01226f515fabfadae17388ee747e6b43e5ea12ac.zip chromium_src-01226f515fabfadae17388ee747e6b43e5ea12ac.tar.gz chromium_src-01226f515fabfadae17388ee747e6b43e5ea12ac.tar.bz2 |
Redraw transparent tabs after they slide into place in the tab strip.
BUG=582654
Review URL: https://codereview.chromium.org/1651613003
Cr-Commit-Position: refs/heads/master@{#372970}
-rw-r--r-- | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index b02125c..67f1277 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_nsautorelease_pool.h" +#include "base/mac/sdk_forward_declarations.h" #include "base/macros.h" #include "base/metrics/histogram.h" #include "base/strings/sys_string_conversions.h" @@ -1198,6 +1199,22 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) { NSValue* oldTargetValue = [targetFrames_ objectForKey:identifier]; if (!oldTargetValue || !NSEqualRects([oldTargetValue rectValue], tabFrame)) { + // Redraw the tab once it moves to its final location. Because we're + // using Core Animation, each tab caches its contents until told to + // redraw. Without forcing a redraw at the end of the move, tabs will + // display the wrong content when using a theme that creates transparent + // tabs. + ScopedNSAnimationContextGroup subAnimationGroup(animate); + subAnimationGroup.SetCurrentContextDuration(kAnimationDuration); + // -[NSAnimationContext setCompletionHandler:] is only available on + // 10.7 and higher. + if (base::mac::IsOSLionOrLater()) { + NSView* tabView = [tab view]; + [[NSAnimationContext currentContext] setCompletionHandler:^{ + [tabView setNeedsDisplay:YES]; + }]; + } + [frameTarget setFrame:tabFrame]; [targetFrames_ setObject:[NSValue valueWithRect:tabFrame] forKey:identifier]; |