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

Unified Diff: ui/views/view.cc

Issue 1633403002: MacViews: Add native drop shadow to dialogs on OSX < 10.10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 375cff4a2ca640a14dbf42c59b3b04411e253b28..d2bc20514cfd07eec11e2ac2e2e85437bd5731ec 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -798,16 +798,28 @@ void View::Paint(const ui::PaintContext& parent_context) {
// std::optional once we can do so.
ui::ClipRecorder clip_recorder(parent_context);
if (paint_relative_to_parent) {
- // Set the clip rect to the bounds of this View. Note that the X (or left)
- // position we pass to ClipRect takes into consideration whether or not the
- // View uses a right-to-left layout so that we paint the View in its
- // mirrored position if need be.
- gfx::Rect clip_rect_in_parent = bounds();
- clip_rect_in_parent.Inset(clip_insets_);
- if (parent_)
- clip_rect_in_parent.set_x(
- parent_->GetMirroredXForRect(clip_rect_in_parent));
- clip_recorder.ClipRect(clip_rect_in_parent);
+ // If the View is a root view (has no parent) and if the window shape is
tapted 2016/01/28 05:59:22 only-do-if-root-view logic probably belongs in vie
karandeepb 2016/02/04 03:39:28 Removed the changes in view.cc.
+ // non-rectangular, retreive the window mask from the non-client view and
+ // use it as the clipping path. Else set the clip rect to the bounds of this
+ // View. Note that the X (or left) position we pass to ClipRect takes into
+ // consideration whether or not the View uses a right-to-left layout so that
+ // we paint the View in its mirrored position if need be.
+ bool clip_set = false;
karandeepb 2016/01/27 23:25:03 I have added this to prevent the distortion that o
tapted 2016/01/28 05:59:22 Does this fix the rounded bottom corners on the bo
karandeepb 2016/02/04 03:39:28 This didn't fix the bug on other platforms since a
+ if (!parent() && GetWidget()->non_client_view()) {
+ gfx::Path path;
+ GetWidget()->non_client_view()->GetWindowMask(bounds().size(), &path);
+ if (!path.isEmpty()) {
+ clip_recorder.ClipPathWithAntiAliasing(path);
+ clip_set = true;
+ }
+ } else if (!clip_set) {
tapted 2016/01/28 05:59:22 I think this is equivalent to `else` -- |clip_set|
karandeepb 2016/02/04 03:39:28 Done.
+ gfx::Rect clip_rect_in_parent = bounds();
+ clip_rect_in_parent.Inset(clip_insets_);
+ if (parent_)
+ clip_rect_in_parent.set_x(
+ parent_->GetMirroredXForRect(clip_rect_in_parent));
+ clip_recorder.ClipRect(clip_rect_in_parent);
+ }
}
ui::TransformRecorder transform_recorder(context);
« ui/views/cocoa/bridged_content_view.mm ('K') | « ui/views/cocoa/bridged_native_widget.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698