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

Issue 1718043003: MacViews: Clip contents for non-rectangular windows. (Closed)

Created:
4 years, 10 months ago by karandeepb
Modified:
3 years, 6 months ago
Reviewers:
tapted
CC:
chromium-reviews, tfarina, msw+watch_chromium.org, groby+bubble_chromium.org, hcarmona+bubble_chromium.org, rouslan+bubble_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Clip contents for non-rectangular windows. Currently, default rectangular clipping is done on non-rectangular windows. Hence for these windows, there is no way to prevent subviews from painting outside the window boundary. To resolve this, this CL adds a mask layer to the compositor_superview's layer in BridgedContentView. The path of the mask layer corresponds to the window mask of the non-client frame view attached to the widget. BUG=581600

Patch Set 1 : #

Total comments: 20

Patch Set 2 : Addressed review comments. #

Total comments: 7

Patch Set 3 : Addressed review comments. #

Patch Set 4 : Rebased. #

Patch Set 5 : Modified components_tests.gyp #

Patch Set 6 : Rebased #

Patch Set 7 : #

Patch Set 8 : Added a comment. #

Total comments: 3

Patch Set 9 : Add dependency to views_unittests. #

Patch Set 10 : Add tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -24 lines) Patch
M ui/views/BUILD.gn View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -1 line 0 comments Download
M ui/views/cocoa/DEPS View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.h View 1 2 chunks +5 lines, -2 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 6 7 8 4 chunks +10 lines, -10 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.h View 1 2 3 4 5 6 7 8 3 chunks +7 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 3 4 5 6 7 8 5 chunks +34 lines, -7 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget_unittest.mm View 1 2 3 4 5 6 7 8 8 chunks +60 lines, -4 lines 0 comments Download
M ui/views/views.gyp View 1 2 3 4 5 6 7 8 9 3 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (15 generated)
karandeepb
PTAL Trent. I have attached screenshots on the corresponding bug. https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm File ui/gfx/path_mac.mm (right): https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm#newcode123 ...
4 years, 10 months ago (2016-02-24 04:27:18 UTC) #10
tapted
https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm File ui/gfx/path_mac.mm (right): https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm#newcode123 ui/gfx/path_mac.mm:123: base::ScopedCFTypeRef<CGPathRef> CreateCGPathFromNSBezierPath( On 2016/02/24 04:27:18, karandeepb wrote: > This ...
4 years, 10 months ago (2016-02-24 05:05:03 UTC) #11
karandeepb
PTAL Trent. Thanks. https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm File ui/gfx/path_mac.mm (right): https://codereview.chromium.org/1718043003/diff/140001/ui/gfx/path_mac.mm#newcode123 ui/gfx/path_mac.mm:123: base::ScopedCFTypeRef<CGPathRef> CreateCGPathFromNSBezierPath( On 2016/02/24 05:05:03, tapted ...
4 years, 10 months ago (2016-02-25 03:31:06 UTC) #13
tapted
https://codereview.chromium.org/1718043003/diff/140001/ui/views/cocoa/bridged_content_view.h File ui/views/cocoa/bridged_content_view.h (right): https://codereview.chromium.org/1718043003/diff/140001/ui/views/cocoa/bridged_content_view.h#newcode83 ui/views/cocoa/bridged_content_view.h:83: - (void)onSizeChanged; On 2016/02/25 03:31:06, karandeepb wrote: > On ...
4 years, 10 months ago (2016-02-25 08:07:21 UTC) #14
karandeepb
PTAL Trent. Sorry for the delay. The trybots pass as can be seen from Patch ...
4 years, 9 months ago (2016-03-04 03:01:56 UTC) #18
tapted
4 years, 9 months ago (2016-03-04 04:15:01 UTC) #19
https://codereview.chromium.org/1718043003/diff/180001/ui/views/cocoa/bridged...
File ui/views/cocoa/bridged_content_view.mm (right):

https://codereview.chromium.org/1718043003/diff/180001/ui/views/cocoa/bridged...
ui/views/cocoa/bridged_content_view.mm:231: windowMask_.reset();
On 2016/03/04 03:01:55, karandeepb wrote:
> On 2016/02/25 08:07:21, tapted wrote:
> > is this needed here? (i.e. was it to fix an error?)
> 
> Not really. This is called here -
>
https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/cocoa/bri...
> and it has a comment to the effect that Cocoa may still have references to the
> bridged_view_ object. Hence I thought we should free up windowMask_.

That shouldn't be necessary - if windowMask_ referred to some C++ object that
was about to be `delete`d by the caller we would, but since it's on ObjC object
we can just rely on the regular ObjC lifetime. So let's delete this line,
otherwise we're implying there's a more complicated lifetime issue than there
is.

https://codereview.chromium.org/1718043003/diff/360001/ui/views/cocoa/bridged...
File ui/views/cocoa/bridged_native_widget.mm (right):

https://codereview.chromium.org/1718043003/diff/360001/ui/views/cocoa/bridged...
ui/views/cocoa/bridged_native_widget.mm:1243: // TODO(karandeepb): Add tests to
verify mask layer is correctly set up.
we don't usually have TODO: add tests in code comments :). You can make a bug
and assign it to yourself, but if it's not urgent we can usually just write the
tests and land them with the CL.

https://codereview.chromium.org/1718043003/diff/360001/ui/views/views.gyp
File ui/views/views.gyp (right):

https://codereview.chromium.org/1718043003/diff/360001/ui/views/views.gyp#new...
ui/views/views.gyp:801: # Needed to link to Obj-C static libraries.
On 2016/03/04 03:01:56, karandeepb wrote:
> I am not sure if this needs to be added to a gn file as well. The trybots pass
> without it. Also, I can't seem to find a direct analogous of link_settings in
> gn. 

ldflags += [ "-Wl,-ObjC" ]

would probably do it.

I think the Mac-GN trybot [assuming there is one] currently just builds, and
doesn't try to run anything, which is why this probably hasn't come up in the
past.

Can you try running components_unittests in GN build locally on Mac, to see if
it's needed? 

(there might be an explosion of other problems, or components_unittests might
not even be built at all, but we should try not to leave problems for us later
on, since these errors are really hard to diagnose)

Powered by Google App Engine
This is Rietveld 408576698