| Index: ui/views/cocoa/bridged_content_view.mm
|
| diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
|
| index 6022a44723bf99d9873d04bd6dcbebdb7bc66697..d2b765b33cbfbaed4bf39c4eb17fda46730f0f18 100644
|
| --- a/ui/views/cocoa/bridged_content_view.mm
|
| +++ b/ui/views/cocoa/bridged_content_view.mm
|
| @@ -191,6 +191,9 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
|
| - (void)paste:(id)sender;
|
| - (void)selectAll:(id)sender;
|
|
|
| +// Update windowMask_ as per the current view bounds.
|
| +- (void)updateWindowMask;
|
| +
|
| @end
|
|
|
| @implementation BridgedContentView
|
| @@ -267,28 +270,12 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
|
| }
|
| }
|
|
|
| -- (void)updateWindowMask {
|
| - DCHECK(![self inLiveResize]);
|
| - DCHECK(base::mac::IsOSMavericksOrEarlier());
|
| - DCHECK(hostedView_);
|
| -
|
| - views::Widget* widget = hostedView_->GetWidget();
|
| - if (!widget->non_client_view())
|
| - return;
|
| -
|
| - const NSRect frameRect = [self bounds];
|
| - gfx::Path mask;
|
| - widget->non_client_view()->GetWindowMask(gfx::Size(frameRect.size), &mask);
|
| - if (mask.isEmpty())
|
| - return;
|
| -
|
| - windowMask_.reset([gfx::CreateNSBezierPathFromSkPath(mask) retain]);
|
| +- (void)onSizeChanged {
|
| + [self updateWindowMask];
|
| +}
|
|
|
| - // Convert to AppKit coordinate system.
|
| - NSAffineTransform* flipTransform = [NSAffineTransform transform];
|
| - [flipTransform translateXBy:0.0 yBy:frameRect.size.height];
|
| - [flipTransform scaleXBy:1.0 yBy:-1.0];
|
| - [windowMask_ transformUsingAffineTransform:flipTransform];
|
| +- (NSBezierPath*)windowMask {
|
| + return windowMask_.get();
|
| }
|
|
|
| // BridgedContentView private implementation.
|
| @@ -379,6 +366,28 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
|
| eventFlags:ui::EF_CONTROL_DOWN];
|
| }
|
|
|
| +- (void)updateWindowMask {
|
| + DCHECK(hostedView_);
|
| +
|
| + views::Widget* widget = hostedView_->GetWidget();
|
| + if (!widget->non_client_view())
|
| + return;
|
| +
|
| + const NSRect frameRect = [self bounds];
|
| + gfx::Path mask;
|
| + widget->non_client_view()->GetWindowMask(gfx::Size(frameRect.size), &mask);
|
| + if (mask.isEmpty())
|
| + return;
|
| +
|
| + windowMask_.reset([gfx::CreateNSBezierPathFromSkPath(mask) retain]);
|
| +
|
| + // Convert to AppKit coordinate system.
|
| + NSAffineTransform* flipTransform = [NSAffineTransform transform];
|
| + [flipTransform translateXBy:0.0 yBy:frameRect.size.height];
|
| + [flipTransform scaleXBy:1.0 yBy:-1.0];
|
| + [windowMask_ transformUsingAffineTransform:flipTransform];
|
| +}
|
| +
|
| // BaseView implementation.
|
|
|
| // Don't use tracking areas from BaseView. BridgedContentView's tracks
|
| @@ -435,13 +444,11 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
|
| - (void)viewDidEndLiveResize {
|
| [super viewDidEndLiveResize];
|
|
|
| - // We prevent updating the window mask and clipping the border around the
|
| - // view, during a live resize. Hence update the window mask and redraw the
|
| - // view after resize has completed.
|
| - if (base::mac::IsOSMavericksOrEarlier()) {
|
| - [self updateWindowMask];
|
| + // During a live resize, we prevent clipping the border around the view, which
|
| + // is required to generate drop shadows on OSX 10.9. Hence redraw the view
|
| + // after resize has completed.
|
| + if (base::mac::IsOSMavericksOrEarlier())
|
| [self setNeedsDisplay:YES];
|
| - }
|
| }
|
|
|
| - (void)drawRect:(NSRect)dirtyRect {
|
| @@ -464,8 +471,8 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
|
| // boundary with clearColor and tell Cococa to regenerate drop shadow. See
|
| // crbug.com/543671.
|
| if (windowMask_ && ![self inLiveResize] &&
|
| - !IsRectInsidePath(dirtyRect, windowMask_)) {
|
| - DCHECK(base::mac::IsOSMavericksOrEarlier());
|
| + !IsRectInsidePath(dirtyRect, windowMask_) &&
|
| + base::mac::IsOSMavericksOrEarlier()) {
|
| gfx::ScopedNSGraphicsContextSaveGState state;
|
|
|
| // The outer rectangular path corresponding to the window.
|
|
|