Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 379293003: mac: Fix tab dragging visual bug in Yosemite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set the frame of the chromeContentView when adding it as a subview. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // While we move views (and focus) around, disable any bar visibility changes. 559 // While we move views (and focus) around, disable any bar visibility changes.
560 [self disableBarVisibilityUpdates]; 560 [self disableBarVisibilityUpdates];
561 561
562 // Retain the tab strip view while we remove it from its superview. 562 // Retain the tab strip view while we remove it from its superview.
563 base::scoped_nsobject<NSView> tabStripView; 563 base::scoped_nsobject<NSView> tabStripView;
564 if ([self hasTabStrip]) { 564 if ([self hasTabStrip]) {
565 tabStripView.reset([[self tabStripView] retain]); 565 tabStripView.reset([[self tabStripView] retain]);
566 [tabStripView removeFromSuperview]; 566 [tabStripView removeFromSuperview];
567 } 567 }
568 568
569 // Ditto for the content view.
570 base::scoped_nsobject<NSView> contentView(
571 [[sourceWindow contentView] retain]);
572 // Disable autoresizing of subviews while we move views around. This prevents 569 // Disable autoresizing of subviews while we move views around. This prevents
573 // spurious renderer resizes. 570 // spurious renderer resizes.
574 [contentView setAutoresizesSubviews:NO]; 571 [self.chromeContentView setAutoresizesSubviews:NO];
575 [contentView removeFromSuperview]; 572 [self.chromeContentView removeFromSuperview];
576 573
577 // Have to do this here, otherwise later calls can crash because the window 574 // Have to do this here, otherwise later calls can crash because the window
578 // has no delegate. 575 // has no delegate.
579 [sourceWindow setDelegate:nil]; 576 [sourceWindow setDelegate:nil];
580 [destWindow setDelegate:self]; 577 [destWindow setDelegate:self];
581 578
582 // With this call, valgrind complains that a "Conditional jump or move depends 579 // With this call, valgrind complains that a "Conditional jump or move depends
583 // on uninitialised value(s)". The error happens in -[NSThemeFrame 580 // on uninitialised value(s)". The error happens in -[NSThemeFrame
584 // drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is 581 // drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is
585 // no visual impact. I have been unable to tickle it away with other window 582 // no visual impact. I have been unable to tickle it away with other window
586 // or view manipulation Cocoa calls. Stack added to suppressions_mac.txt. 583 // or view manipulation Cocoa calls. Stack added to suppressions_mac.txt.
587 [contentView setAutoresizesSubviews:YES]; 584 [self.chromeContentView setAutoresizesSubviews:YES];
588 [destWindow setContentView:contentView]; 585 [[destWindow contentView] addSubview:self.chromeContentView
586 positioned:NSWindowBelow
587 relativeTo:nil];
588 self.chromeContentView.frame = [[destWindow contentView] bounds];
589 589
590 // Move the incognito badge if present. 590 // Move the incognito badge if present.
591 if ([self shouldShowAvatar]) { 591 if ([self shouldShowAvatar]) {
592 NSView* avatarButtonView = [avatarButtonController_ view]; 592 NSView* avatarButtonView = [avatarButtonController_ view];
593 593
594 [avatarButtonView removeFromSuperview]; 594 [avatarButtonView removeFromSuperview];
595 [avatarButtonView setHidden:YES]; // Will be shown in layout. 595 [avatarButtonView setHidden:YES]; // Will be shown in layout.
596 [[destWindow cr_windowView] addSubview:avatarButtonView]; 596 [[destWindow cr_windowView] addSubview:avatarButtonView];
597 } 597 }
598 598
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 845
846 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 846 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
847 // In Yosemite, some combination of the titlebar and toolbar always show in 847 // In Yosemite, some combination of the titlebar and toolbar always show in
848 // full-screen mode. We do not want either to show. Search for the window that 848 // full-screen mode. We do not want either to show. Search for the window that
849 // contains the views, and hide it. There is no need to ever unhide the view. 849 // contains the views, and hide it. There is no need to ever unhide the view.
850 // http://crbug.com/380235 850 // http://crbug.com/380235
851 if (base::mac::IsOSYosemiteOrLater()) { 851 if (base::mac::IsOSYosemiteOrLater()) {
852 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { 852 for (NSWindow* window in [[NSApplication sharedApplication] windows]) {
853 if ([window 853 if ([window
854 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { 854 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) {
855 [window.contentView setHidden:YES]; 855 [[window contentView] setHidden:YES];
856 } 856 }
857 } 857 }
858 } 858 }
859 859
860 if (notification) // For System Fullscreen when non-nil. 860 if (notification) // For System Fullscreen when non-nil.
861 [self deregisterForContentViewResizeNotifications]; 861 [self deregisterForContentViewResizeNotifications];
862 enteringFullscreen_ = NO; 862 enteringFullscreen_ = NO;
863 enteringPresentationMode_ = NO; 863 enteringPresentationMode_ = NO;
864 864
865 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 865 const CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 923
924 barVisibilityUpdatesEnabled_ = NO; 924 barVisibilityUpdatesEnabled_ = NO;
925 [presentationModeController_ cancelAnimationAndTimers]; 925 [presentationModeController_ cancelAnimationAndTimers];
926 } 926 }
927 927
928 - (CGFloat)toolbarDividerOpacity { 928 - (CGFloat)toolbarDividerOpacity {
929 return [bookmarkBarController_ toolbarDividerOpacity]; 929 return [bookmarkBarController_ toolbarDividerOpacity];
930 } 930 }
931 931
932 - (void)updateSubviewZOrder:(BOOL)inPresentationMode { 932 - (void)updateSubviewZOrder:(BOOL)inPresentationMode {
933 NSView* contentView = [[self window] contentView]; 933 NSView* contentView = self.chromeContentView;
934 NSView* toolbarView = [toolbarController_ view]; 934 NSView* toolbarView = [toolbarController_ view];
935 935
936 if (inPresentationMode) { 936 if (inPresentationMode) {
937 // Toolbar is above tab contents so that it can slide down from top of 937 // Toolbar is above tab contents so that it can slide down from top of
938 // screen. 938 // screen.
939 [contentView cr_ensureSubview:toolbarView 939 [contentView cr_ensureSubview:toolbarView
940 isPositioned:NSWindowAbove 940 isPositioned:NSWindowAbove
941 relativeTo:[self tabContentArea]]; 941 relativeTo:[self tabContentArea]];
942 } else { 942 } else {
943 // Toolbar is below tab contents so that the info bar arrow can appear above 943 // Toolbar is below tab contents so that the info bar arrow can appear above
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 devTools->SetAllowOverlappingViews(allowOverlappingViews); 1026 devTools->SetAllowOverlappingViews(allowOverlappingViews);
1027 } 1027 }
1028 1028
1029 - (void)updateInfoBarTipVisibility { 1029 - (void)updateInfoBarTipVisibility {
1030 // If there's no toolbar then hide the infobar tip. 1030 // If there's no toolbar then hide the infobar tip.
1031 [infoBarContainerController_ 1031 [infoBarContainerController_
1032 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; 1032 setShouldSuppressTopInfoBarTip:![self hasToolbar]];
1033 } 1033 }
1034 1034
1035 @end // @implementation BrowserWindowController(Private) 1035 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698