Skip to content

Commit 4e8a292

Browse files
erikchenCommit bot
authored andcommitted
Revert of Mac: Fix rounded corners on browser windows on retina display. (patchset #4 id:80001 of https://codereview.chromium.org/463263002/)
Reason for revert: When the download bar is present, the rounded corners are on the wrong view. https://code.google.com/p/chromium/issues/detail?id=412580 Original issue's description: > Mac: Fix rounded corners on browser windows on retina display. > > When a window's bottom corner is covered by a layer on a retina display, the > corner is incorrectly rounded. I added a layer mask to do the corner rounding > ourselves. > > BUG=396264 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289811 [email protected],[email protected],[email protected] NOTREECHECKS=true NOTRY=true BUG=396264 Review URL: https://codereview.chromium.org/560913004 Cr-Commit-Position: refs/heads/master@{#294265}
1 parent 9160b5d commit 4e8a292

File tree

4 files changed

+1
-114
lines changed

4 files changed

+1
-114
lines changed

chrome/browser/ui/cocoa/browser_window_controller_private.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@
9292
// sends a message to the renderer to resize.
9393
- (void)layoutTabContentArea:(NSRect)frame;
9494

95-
// Updates whether the bottom two corners are rounded.
96-
- (void)updateRoundedBottomCorners;
97-
9895
// Sets the toolbar's height to a value appropriate for the given compression.
9996
// Also adjusts the bookmark bar's height by the opposite amount in order to
10097
// keep the total height of the two views constant.

chrome/browser/ui/cocoa/browser_window_controller_private.mm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,6 @@ - (void)layoutTabContentArea:(NSRect)newFrame {
520520
}
521521
}
522522

523-
- (void)updateRoundedBottomCorners {
524-
[[self tabContentArea] setRoundedBottomCorners:![self isInAnyFullscreenMode]];
525-
}
526-
527523
- (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression {
528524
CGFloat newHeight =
529525
[toolbarController_ desiredHeightForCompression:compression];
@@ -920,7 +916,6 @@ - (void)windowDidEnterFullScreen:(NSNotification*)notification {
920916
[self showFullscreenExitBubbleIfNecessary];
921917
browser_->WindowFullscreenStateChanged();
922918
[[[self window] cr_windowView] setWantsLayer:windowViewWantsLayer_];
923-
[self updateRoundedBottomCorners];
924919
}
925920

926921
- (void)windowWillExitFullScreen:(NSNotification*)notification {
@@ -934,7 +929,6 @@ - (void)windowDidExitFullScreen:(NSNotification*)notification {
934929
if (notification) // For System Fullscreen when non-nil.
935930
[self deregisterForContentViewResizeNotifications];
936931
browser_->WindowFullscreenStateChanged();
937-
[self updateRoundedBottomCorners];
938932
}
939933

940934
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window {

chrome/browser/ui/cocoa/fast_resize_view.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,10 @@
77

88
#import <Cocoa/Cocoa.h>
99

10-
@class CAShapeLayer;
11-
1210
// A Cocoa view originally created to support fast re-painting to white on
1311
// resize. This is done by CoreAnimation now, so this view remains only as the
1412
// first opaque ancestor of accelerated web contents views.
15-
@interface FastResizeView : NSView {
16-
@private
17-
// Whether the bottom corners should be rounded.
18-
BOOL roundedBottomCorners_;
19-
20-
// Weak reference to the mask of the hosted layer.
21-
CAShapeLayer* layerMask_;
22-
}
23-
24-
// Changes whether the bottom two corners are rounded.
25-
- (void)setRoundedBottomCorners:(BOOL)roundedBottomCorners;
13+
@interface FastResizeView : NSView
2614

2715
@end
2816

chrome/browser/ui/cocoa/fast_resize_view.mm

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@
1010
#include "base/mac/scoped_nsobject.h"
1111
#include "ui/base/cocoa/animation_utils.h"
1212

13-
namespace {
14-
15-
// The radius of the rounded corners.
16-
const CGFloat kRoundedCornerRadius = 4;
17-
18-
} // namespace
19-
20-
@interface FastResizeView (PrivateMethods)
21-
// Creates a path whose bottom two corners are rounded.
22-
// Caller takes ownership of the path.
23-
- (CGPathRef)createRoundedBottomCornersPath:(NSSize)size;
24-
25-
// Updates the path of the layer mask to reflect the current value of
26-
// roundedBottomCorners_.
27-
- (void)updateLayerMask;
28-
@end
29-
3013
@implementation FastResizeView
3114

3215
- (id)initWithFrame:(NSRect)frameRect {
@@ -36,9 +19,6 @@ - (id)initWithFrame:(NSRect)frameRect {
3619
[layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
3720
[self setLayer:layer];
3821
[self setWantsLayer:YES];
39-
40-
roundedBottomCorners_ = YES;
41-
[self updateLayerMask];
4222
}
4323
return self;
4424
}
@@ -47,77 +27,5 @@ - (BOOL)isOpaque {
4727
return YES;
4828
}
4929

50-
- (void)setRoundedBottomCorners:(BOOL)roundedBottomCorners {
51-
if (roundedBottomCorners == roundedBottomCorners_)
52-
return;
53-
54-
roundedBottomCorners_ = roundedBottomCorners;
55-
[self updateLayerMask];
56-
}
57-
58-
// Every time the frame's size changes, the layer mask needs to be updated.
59-
- (void)setFrameSize:(NSSize)newSize {
60-
[super setFrameSize:newSize];
61-
[self updateLayerMask];
62-
}
63-
6430
@end
6531

66-
@implementation FastResizeView (PrivateMethods)
67-
68-
- (CGPathRef)createRoundedBottomCornersPath:(NSSize)size {
69-
CGMutablePathRef path = CGPathCreateMutable();
70-
CGFloat width = size.width;
71-
CGFloat height = size.height;
72-
CGFloat cornerRadius = kRoundedCornerRadius;
73-
74-
// Top left corner.
75-
CGPathMoveToPoint(path, NULL, 0, height);
76-
77-
// Top right corner.
78-
CGPathAddLineToPoint(path, NULL, width, height);
79-
80-
// Bottom right corner.
81-
CGPathAddArc(path,
82-
NULL,
83-
width - cornerRadius,
84-
cornerRadius,
85-
cornerRadius,
86-
0,
87-
-M_PI_2,
88-
true);
89-
90-
// Bottom left corner.
91-
CGPathAddArc(path,
92-
NULL,
93-
cornerRadius,
94-
cornerRadius,
95-
cornerRadius,
96-
-M_PI_2,
97-
-M_PI,
98-
true);
99-
100-
// Draw line back to top-left corner.
101-
CGPathAddLineToPoint(path, NULL, 0, height);
102-
CGPathCloseSubpath(path);
103-
return path;
104-
}
105-
106-
- (void)updateLayerMask {
107-
if (!roundedBottomCorners_) {
108-
[self layer].mask = nil;
109-
layerMask_ = nil;
110-
return;
111-
}
112-
113-
if (![self layer].mask) {
114-
layerMask_ = [CAShapeLayer layer];
115-
[self layer].mask = layerMask_;
116-
}
117-
118-
CGPathRef path = [self createRoundedBottomCornersPath:self.bounds.size];
119-
layerMask_.path = path;
120-
CGPathRelease(path);
121-
}
122-
123-
@end

0 commit comments

Comments
 (0)