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

Issue 1633403002: MacViews: Add native drop shadow to dialogs on OSX < 10.10. (Closed)

Created:
4 years, 10 months ago by karandeepb
Modified:
4 years, 10 months ago
Reviewers:
tapted, sky, msw
CC:
chromium-reviews, tdanderson+views_chromium.org, msw+watch_chromium.org, tfarina, 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: Add native drop shadow to dialogs on OSX 10.9. On OSX 10.10 and later, the Window manager is able to gather shadow information from the alpha channel of the composited layer, but this isn't supported on OSX 10.9. This CL adds native shadows to OSX 10.9 by using a strategy similar to ChromeMac's -[ConstrainedWindowCustomWindow drawRect:]. This involves giving the window an opaque background and drawing over the edges with `clear` color to make the corners round. To do this, implement path_mac.mm which converts Skia Paths to NSBezierPath. This is similar to the methods in path_win.cc and path_x11.cc. On Mac, hit testing masks are inferred from the alpha channel. Using the window manager to draw the shadow ensures we get the shadow corresponding to the alpha channel, and removes the need to use views::BubbleWindowTargeter. Since, native shadows are now supported, this CL also removes raster shadows on all Mac Versions by setting all BubbleBorders on Mac to NO_ASSETS. BUG=543671, 507965 Committed: https://crrev.com/675dee76d8e2d0d1d844665147c45f7c4468c7be Cr-Commit-Position: refs/heads/master@{#375729}

Patch Set 1 #

Total comments: 36

Patch Set 2 : Addressed review comments. Reverted changes in view.cc. Implemented SchedulePaintInRect in native_widget_mac. #

Patch Set 3 : Optimise drawRect by storing window mask in BridgedContentView. #

Total comments: 2

Patch Set 4 : Removed tests in CreateNSBezierPathFromSkPathTest.FillType in path_mac_unittest.mm #

Total comments: 74

Patch Set 5 : Addressed Review comments. Added unit tests for NativeWidgetMac::SchedulePaintInRect #

Total comments: 20

Patch Set 6 : Addressed review comments. Implemented quad to cubic bezier conversion. #

Total comments: 10

Patch Set 7 : Rebased. #

Patch Set 8 : Addressed review comments. Removed native_widget_mac files. #

Total comments: 11

Patch Set 9 : Addressed review comments. #

Total comments: 49

Patch Set 10 : Addressed review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+578 lines, -33 lines) Patch
M ui/gfx/BUILD.gn View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M ui/gfx/gfx.gyp View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gfx/gfx_tests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A ui/gfx/path_mac.h View 1 2 3 4 5 6 7 8 9 1 chunk +21 lines, -0 lines 0 comments Download
A ui/gfx/path_mac.mm View 1 2 3 4 5 6 7 8 9 1 chunk +125 lines, -0 lines 0 comments Download
A ui/gfx/path_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 1 chunk +258 lines, -0 lines 0 comments Download
M ui/views/bubble/bubble_border.h View 1 2 3 4 5 6 7 8 3 chunks +12 lines, -0 lines 0 comments Download
M ui/views/bubble/bubble_border.cc View 1 2 3 4 5 chunks +32 lines, -13 lines 0 comments Download
M ui/views/bubble/bubble_frame_view.cc View 1 2 3 4 5 6 1 chunk +26 lines, -14 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.h View 1 2 3 4 2 chunks +6 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 6 6 chunks +78 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -1 line 0 comments Download
M ui/views/window/dialog_delegate.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -5 lines 0 comments Download

Messages

Total messages: 37 (18 generated)
karandeepb
PTAL Trent. I haven't yet fully tested these changes on other platforms. Also, I think ...
4 years, 10 months ago (2016-01-27 23:25:03 UTC) #5
tapted
The stuff you did for http://crbug.com/581600 is probably the best place to start. And.. for ...
4 years, 10 months ago (2016-01-28 05:59:22 UTC) #6
karandeepb
PTAL Trent. I have tried to optimise drawRect a bit by taking dirtyRect into consideration ...
4 years, 10 months ago (2016-02-04 03:39:28 UTC) #11
tapted
https://codereview.chromium.org/1633403002/diff/100001/ui/gfx/path_mac.h File ui/gfx/path_mac.h (right): https://codereview.chromium.org/1633403002/diff/100001/ui/gfx/path_mac.h#newcode12 ui/gfx/path_mac.h:12: #else // __OBJC__ nit: I think we can assume ...
4 years, 10 months ago (2016-02-05 04:51:08 UTC) #12
karandeepb
PTAL Trent. Thanks. https://codereview.chromium.org/1633403002/diff/120001/ui/gfx/path_mac.mm File ui/gfx/path_mac.mm (right): https://codereview.chromium.org/1633403002/diff/120001/ui/gfx/path_mac.mm#newcode23 ui/gfx/path_mac.mm:23: NSBezierPath* CreateNSBezierPathFromSkRegion(const SkRegion& region) { On ...
4 years, 10 months ago (2016-02-08 07:47:10 UTC) #13
tapted
nice tests! We should probably split that dirtyRect bit off and land it first. We ...
4 years, 10 months ago (2016-02-09 06:47:13 UTC) #14
karandeepb
PTAL Trent. I have split the NativeWidgetMac into a separate CL - https://codereview.chromium.org/1689483002/. Also, it ...
4 years, 10 months ago (2016-02-10 00:39:45 UTC) #15
tapted
Looking good! Is a follow-up still needed for http://crbug.com/581600 ? (the square-bottom-corner thing). I think ...
4 years, 10 months ago (2016-02-10 02:28:02 UTC) #16
karandeepb
PTAL Trent. For http://crbug.com/581600, on OSX 10.9, the distortion around the corners on bubbles like ...
4 years, 10 months ago (2016-02-11 00:30:09 UTC) #20
tapted
lgtm % nits we should add msw next since he is the bubble expert https://codereview.chromium.org/1633403002/diff/240001/ui/gfx/BUILD.gn ...
4 years, 10 months ago (2016-02-11 01:47:23 UTC) #21
karandeepb
+msw for ui/gfx/* and ui/views/bubble/* review. https://codereview.chromium.org/1633403002/diff/240001/ui/gfx/path_mac.h File ui/gfx/path_mac.h (right): https://codereview.chromium.org/1633403002/diff/240001/ui/gfx/path_mac.h#newcode11 ui/gfx/path_mac.h:11: @class NSBezierPath; On ...
4 years, 10 months ago (2016-02-11 04:16:04 UTC) #24
msw
https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h File ui/gfx/path_mac.h (right): https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h#newcode15 ui/gfx/path_mac.h:15: // Returns the NSBezierPath corresponding to |path|. nit: document ...
4 years, 10 months ago (2016-02-11 23:57:38 UTC) #25
karandeepb
PTAL @msw. Thanks. https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h File ui/gfx/path_mac.h (right): https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h#newcode15 ui/gfx/path_mac.h:15: // Returns the NSBezierPath corresponding to ...
4 years, 10 months ago (2016-02-12 03:45:52 UTC) #26
msw
lgtm https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h File ui/gfx/path_mac.h (right): https://codereview.chromium.org/1633403002/diff/260001/ui/gfx/path_mac.h#newcode15 ui/gfx/path_mac.h:15: // Returns the NSBezierPath corresponding to |path|. On ...
4 years, 10 months ago (2016-02-12 19:26:55 UTC) #27
karandeepb
+sky for ui/views/window/dialog_delegate.cc review.
4 years, 10 months ago (2016-02-14 23:56:24 UTC) #29
sky
LGTM
4 years, 10 months ago (2016-02-16 16:04:47 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1633403002/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1633403002/280001
4 years, 10 months ago (2016-02-16 23:18:57 UTC) #33
commit-bot: I haz the power
Committed patchset #10 (id:280001)
4 years, 10 months ago (2016-02-17 00:44:47 UTC) #35
commit-bot: I haz the power
4 years, 10 months ago (2016-02-17 00:45:41 UTC) #37
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/675dee76d8e2d0d1d844665147c45f7c4468c7be
Cr-Commit-Position: refs/heads/master@{#375729}

Powered by Google App Engine
This is Rietveld 408576698