From c0b9fd415df91dc5763ab2ad26d4306141001fe7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 26 Aug 2015 15:56:39 +0800 Subject: [PATCH] Revert "Make bottom corner more round" This reverts commit f9a64dde5da537f615cd7080a335c6304c6a814e. --- .../mac/bry_inspectable_web_contents_view.h | 5 -- .../mac/bry_inspectable_web_contents_view.mm | 76 +------------------ 2 files changed, 1 insertion(+), 80 deletions(-) diff --git a/brightray/browser/mac/bry_inspectable_web_contents_view.h b/brightray/browser/mac/bry_inspectable_web_contents_view.h index b5dbb415e5..3b72aba08c 100644 --- a/brightray/browser/mac/bry_inspectable_web_contents_view.h +++ b/brightray/browser/mac/bry_inspectable_web_contents_view.h @@ -5,8 +5,6 @@ #include "base/mac/scoped_nsobject.h" #include "ui/base/cocoa/base_view.h" -@class CAShapeLayer; - namespace brightray { class InspectableWebContentsViewMac; } @@ -21,9 +19,6 @@ using brightray::InspectableWebContentsViewMac; BOOL devtools_visible_; BOOL devtools_docked_; - // Weak reference to the mask of the hosted layer. - CAShapeLayer* layerMask_; - DevToolsContentsResizingStrategy strategy_; } diff --git a/brightray/browser/mac/bry_inspectable_web_contents_view.mm b/brightray/browser/mac/bry_inspectable_web_contents_view.mm index 20267769e2..1bb84e5abb 100644 --- a/brightray/browser/mac/bry_inspectable_web_contents_view.mm +++ b/brightray/browser/mac/bry_inspectable_web_contents_view.mm @@ -1,24 +1,14 @@ #include "browser/mac/bry_inspectable_web_contents_view.h" -#import - #include "browser/inspectable_web_contents_impl.h" #include "browser/inspectable_web_contents_view_mac.h" #include "content/public/browser/render_widget_host_view.h" -#include "ui/base/cocoa/animation_utils.h" -#include "ui/base/cocoa/underlay_opengl_hosting_window.h" +#import "ui/base/cocoa/underlay_opengl_hosting_window.h" #include "ui/gfx/mac/scoped_ns_disable_screen_updates.h" using namespace brightray; -namespace { - -// The radius of the rounded corners. -const CGFloat kRoundedCornerRadius = 4; - -} // namespace - @implementation BRYInspectableWebContentsView - (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view { @@ -36,14 +26,8 @@ const CGFloat kRoundedCornerRadius = 4; [self addSubview:contentsView]; // See https://code.google.com/p/chromium/issues/detail?id=348490. - ScopedCAActionDisabler disabler; - base::scoped_nsobject layer([[CALayer alloc] init]); - [self setLayer:layer]; [self setWantsLayer:YES]; - // See https://code.google.com/p/chromium/issues/detail?id=396264. - [self updateLayerMask]; - return self; } @@ -51,12 +35,6 @@ const CGFloat kRoundedCornerRadius = 4; [self adjustSubviews]; } -// Every time the frame's size changes, the layer mask needs to be updated. -- (void)setFrameSize:(NSSize)newSize { - [super setFrameSize:newSize]; - [self updateLayerMask]; -} - - (IBAction)showDevTools:(id)sender { inspectableWebContentsView_->inspectable_web_contents()->ShowDevTools(); } @@ -178,58 +156,6 @@ const CGFloat kRoundedCornerRadius = 4; [devtools_window_ setTitle:title]; } -// Creates a path whose bottom two corners are rounded. -// Caller takes ownership of the path. -- (CGPathRef)createRoundedBottomCornersPath:(NSSize)size { - CGMutablePathRef path = CGPathCreateMutable(); - CGFloat width = size.width; - CGFloat height = size.height; - CGFloat cornerRadius = kRoundedCornerRadius; - - // Top left corner. - CGPathMoveToPoint(path, NULL, 0, height); - - // Top right corner. - CGPathAddLineToPoint(path, NULL, width, height); - - // Bottom right corner. - CGPathAddArc(path, - NULL, - width - cornerRadius, - cornerRadius, - cornerRadius, - 0, - -M_PI_2, - true); - - // Bottom left corner. - CGPathAddArc(path, - NULL, - cornerRadius, - cornerRadius, - cornerRadius, - -M_PI_2, - -M_PI, - true); - - // Draw line back to top-left corner. - CGPathAddLineToPoint(path, NULL, 0, height); - CGPathCloseSubpath(path); - return path; -} - -// Updates the path of the layer mask to have make window have round corner. -- (void)updateLayerMask { - if (![self layer].mask) { - layerMask_ = [CAShapeLayer layer]; - [self layer].mask = layerMask_; - } - - CGPathRef path = [self createRoundedBottomCornersPath:self.bounds.size]; - layerMask_.path = path; - CGPathRelease(path); -} - #pragma mark - NSWindowDelegate - (void)windowWillClose:(NSNotification*)notification {