Chromium Code Reviews| Index: chrome/browser/ui/cocoa/background_gradient_view.mm |
| diff --git a/chrome/browser/ui/cocoa/background_gradient_view.mm b/chrome/browser/ui/cocoa/background_gradient_view.mm |
| index fe583563d12c82fd1f9bb6e30227a9a59cf11d58..cd8329c8f755a013d17d4c4d743c57810476dd93 100644 |
| --- a/chrome/browser/ui/cocoa/background_gradient_view.mm |
| +++ b/chrome/browser/ui/cocoa/background_gradient_view.mm |
| @@ -121,10 +121,39 @@ |
| } |
| } |
| +- (void)viewWillStartLiveResize { |
| + [super viewWillStartLiveResize]; |
| + |
| + ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| + if (themeProvider && themeProvider->UsingSystemTheme()) { |
| + // The default theme's background image is a subtle texture pattern that |
| + // we can scale without being easily noticed. Optimize this case by |
| + // skipping redraws during live resize. |
| + [self setLayerContentsRedrawPolicy: |
| + NSViewLayerContentsRedrawOnSetNeedsDisplay]; |
|
Robert Sesek
2015/02/04 16:13:49
nit: over-indented
Andre
2015/02/04 16:46:26
clang format wanted it that way, it's indenting fr
Robert Sesek
2015/02/04 16:54:56
The most recent patch set is correct. I don't thin
|
| + } |
| +} |
| + |
| +- (void)viewDidEndLiveResize { |
| + [super viewDidEndLiveResize]; |
| + |
| + if ([self layerContentsRedrawPolicy] != |
| + NSViewLayerContentsRedrawDuringViewResize) { |
| + // If we have been scaling the layer during live resize, now is the time to |
| + // redraw the layer. |
| + [self |
| + setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawDuringViewResize]; |
| + [self setNeedsDisplay:YES]; |
| + } |
| +} |
| + |
| - (void)setFrameOrigin:(NSPoint)origin { |
| // The background color depends on the view's vertical position. This impacts |
| // any child views that draw using this view's functions. |
| - if (NSMinY([self frame]) != origin.y) |
| + // When resizing the window, the view's vertical position (NSMinY) may change |
| + // even though our relative position to the nearest window edge is still the |
| + // same. Don't redraw unnecessarily in this case. |
| + if (![self inLiveResize] && NSMinY([self frame]) != origin.y) |
| [self cr_recursivelySetNeedsDisplay:YES]; |
| [super setFrameOrigin:origin]; |