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

Unified Diff: ui/views/cocoa/bridged_content_view.mm

Issue 1718043003: MacViews: Clip contents for non-rectangular windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
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..161614d304d858878448bf771e85b09bff082060 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -228,6 +228,7 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
hostedView_ = nullptr;
[cursorTrackingArea_.get() clearOwner];
[self removeTrackingArea:cursorTrackingArea_.get()];
+ windowMask_.reset();
tapted 2016/02/25 08:07:21 is this needed here? (i.e. was it to fix an error?
karandeepb 2016/03/04 03:01:55 Not really. This is called here - https://code.goo
tapted 2016/03/04 04:15:01 That shouldn't be necessary - if windowMask_ refer
}
- (void)processCapturedMouseEvent:(NSEvent*)theEvent {
@@ -268,8 +269,6 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
}
- (void)updateWindowMask {
- DCHECK(![self inLiveResize]);
- DCHECK(base::mac::IsOSMavericksOrEarlier());
DCHECK(hostedView_);
views::Widget* widget = hostedView_->GetWidget();
@@ -291,6 +290,10 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
[windowMask_ transformUsingAffineTransform:flipTransform];
}
+- (NSBezierPath*)windowMask {
tapted 2016/02/25 08:07:21 nit: move up beneath clearView, since it roughly m
karandeepb 2016/03/04 03:01:56 Done.
+ return windowMask_.get();
+}
+
// BridgedContentView private implementation.
- (void)handleKeyEvent:(NSEvent*)theEvent {
@@ -435,13 +438,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 +465,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.

Powered by Google App Engine
This is Rietveld 408576698