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

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

Issue 2430493002: [Mac] Fix rough-looking profile picker text, especially with a dark theme. (Closed)
Patch Set: Scopify! Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_fullscreen_transition.h" 5 #import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void set_lock(bool lock) { [window_ setStyleMaskLock:lock]; } 47 void set_lock(bool lock) { [window_ setStyleMaskLock:lock]; }
48 48
49 private: 49 private:
50 FramedBrowserWindow* window_; // weak 50 FramedBrowserWindow* window_; // weak
51 51
52 DISALLOW_COPY_AND_ASSIGN(FrameAndStyleLock); 52 DISALLOW_COPY_AND_ASSIGN(FrameAndStyleLock);
53 }; 53 };
54 54
55 } // namespace 55 } // namespace
56 56
57 // This view draws a dummy toolbar over the resized content view during
58 // the exit fullscreen animation. It is removed at the end of the animation.
59 @interface FullscreenTabStripBackgroundView : NSView {
60 base::scoped_nsobject<NSColor> windowBackgroundColor_;
61 }
62
63 - (instancetype)initWithFrame:(NSRect)frame background:(NSColor*)color;
64
65 @end
66
67 @implementation FullscreenTabStripBackgroundView
68
69 - (instancetype)initWithFrame:(NSRect)frame background:(NSColor*)color {
70 if ((self = [super initWithFrame:frame])) {
71 windowBackgroundColor_.reset([color copy]);
72 }
73 return self;
74 }
75
76 // Override this method so that we can paint the toolbar in this view.
77 // This method first fill itself with the toolbar's background. After that,
78 // it will paint the window's theme if applicable.
79 - (void)drawRect:(NSRect)frame {
80 [windowBackgroundColor_ set];
81 NSRectFillUsingOperation(frame, NSCompositeDestinationOver);
82
83 [FramedBrowserWindow drawWindowThemeInDirtyRect:frame
84 forView:self
85 bounds:[self bounds]
86 forceBlackBackground:NO];
87 }
88
89 @end
90
91 @interface BrowserWindowFullscreenTransition () 57 @interface BrowserWindowFullscreenTransition ()
92 <CAAnimationDelegate, CALayerDelegate> { 58 <CAAnimationDelegate, CALayerDelegate> {
93 // Flag to keep track of whether we are entering or exiting fullscreen. 59 // Flag to keep track of whether we are entering or exiting fullscreen.
94 BOOL isEnteringFullscreen_; 60 BOOL isEnteringFullscreen_;
95 61
96 // The window which is undergoing the fullscreen transition. 62 // The window which is undergoing the fullscreen transition.
97 base::scoped_nsobject<FramedBrowserWindow> primaryWindow_; 63 base::scoped_nsobject<FramedBrowserWindow> primaryWindow_;
98 64
99 // The window which is undergoing the fullscreen transition. 65 // The window which is undergoing the fullscreen transition.
100 BrowserWindowController* controller_; // weak 66 BrowserWindowController* controller_; // weak
(...skipping 26 matching lines...) Expand all
127 BOOL changingPrimaryWindowSize_; 93 BOOL changingPrimaryWindowSize_;
128 94
129 // The frame of the |primaryWindow_| before it starts the transition. 95 // The frame of the |primaryWindow_| before it starts the transition.
130 NSRect initialFrame_; 96 NSRect initialFrame_;
131 97
132 // The frame that |primaryWindow_| is expected to have after the transition 98 // The frame that |primaryWindow_| is expected to have after the transition
133 // is finished. 99 // is finished.
134 NSRect finalFrame_; 100 NSRect finalFrame_;
135 101
136 // This view draws the tabstrip background during the exit animation. 102 // This view draws the tabstrip background during the exit animation.
137 base::scoped_nsobject<FullscreenTabStripBackgroundView> 103 base::scoped_nsobject<TabStripBackgroundView>
138 fullscreenTabStripBackgroundView_; 104 fullscreenTabStripBackgroundView_;
139 105
140 // Locks and unlocks the FullSizeContentWindow. 106 // Locks and unlocks the FullSizeContentWindow.
141 std::unique_ptr<FrameAndStyleLock> lock_; 107 std::unique_ptr<FrameAndStyleLock> lock_;
142 108
143 // Flag that indicates if the animation was completed. Sets to true at the 109 // Flag that indicates if the animation was completed. Sets to true at the
144 // end of the animation. 110 // end of the animation.
145 BOOL completedTransition_; 111 BOOL completedTransition_;
146 } 112 }
147 113
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 initialRootAnchorPoint_ = root.anchorPoint; 321 initialRootAnchorPoint_ = root.anchorPoint;
356 322
357 NSPoint contentViewOrigin = 323 NSPoint contentViewOrigin =
358 [self pointRelativeToCurrentScreen:finalFrame_.origin]; 324 [self pointRelativeToCurrentScreen:finalFrame_.origin];
359 NSRect relativeContentFinalFrame = 325 NSRect relativeContentFinalFrame =
360 NSMakeRect(contentViewOrigin.x, contentViewOrigin.y, 326 NSMakeRect(contentViewOrigin.x, contentViewOrigin.y,
361 finalFrame_.size.width, finalFrame_.size.height); 327 finalFrame_.size.width, finalFrame_.size.height);
362 [primaryWindow_ forceContentViewFrame:relativeContentFinalFrame]; 328 [primaryWindow_ forceContentViewFrame:relativeContentFinalFrame];
363 329
364 fullscreenTabStripBackgroundView_.reset( 330 fullscreenTabStripBackgroundView_.reset(
365 [[FullscreenTabStripBackgroundView alloc] 331 [[TabStripBackgroundView alloc] initWithFrame:finalFrame_]);
366 initWithFrame:finalFrame_
367 background:primaryWindowInitialBackgroundColor_]);
368 [fullscreenTabStripBackgroundView_ setFrameOrigin:NSZeroPoint]; 332 [fullscreenTabStripBackgroundView_ setFrameOrigin:NSZeroPoint];
369 [contentView addSubview:fullscreenTabStripBackgroundView_.get() 333 [contentView addSubview:fullscreenTabStripBackgroundView_.get()
370 positioned:NSWindowBelow 334 positioned:NSWindowBelow
371 relativeTo:nil]; 335 relativeTo:nil];
372 336
373 [tabStripBackgroundView_ setHidden:YES]; 337 [tabStripBackgroundView_ setHidden:YES];
374 338
375 // Set anchor point to be the center of the content view 339 // Set anchor point to be the center of the content view
376 CGFloat anchorPointX = 340 CGFloat anchorPointX =
377 NSMidX(relativeContentFinalFrame) / NSWidth(initialFrame_); 341 NSMidX(relativeContentFinalFrame) / NSWidth(initialFrame_);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return [[[window contentView] superview] layer]; 514 return [[[window contentView] superview] layer];
551 } 515 }
552 516
553 - (NSPoint)pointRelativeToCurrentScreen:(NSPoint)point { 517 - (NSPoint)pointRelativeToCurrentScreen:(NSPoint)point {
554 NSRect screenFrame = [[primaryWindow_ screen] frame]; 518 NSRect screenFrame = [[primaryWindow_ screen] frame];
555 return NSMakePoint(point.x - screenFrame.origin.x, 519 return NSMakePoint(point.x - screenFrame.origin.x,
556 point.y - screenFrame.origin.y); 520 point.y - screenFrame.origin.y);
557 } 521 }
558 522
559 @end 523 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_unittest.mm ('k') | chrome/browser/ui/cocoa/floating_bar_backing_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698