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

Unified Diff: ui/views/widget/native_widget_mac.mm

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: Removed tests in CreateNSBezierPathFromSkPathTest.FillType in path_mac_unittest.mm 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/widget/native_widget_mac.mm
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index e34f61d29a401810224eab5a67c3bf6cf9689f99..3b848f43713cb0346d3845599044667c87ca8c25 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -502,9 +502,18 @@ void NativeWidgetMac::RunShellDrag(View* view,
}
void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) {
- // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate
- // system of |rect| has been converted.
- [GetNativeView() setNeedsDisplay:YES];
+ // |rect| is relative to coordinate system of the window.
tapted 2016/02/05 04:51:08 is it the window or the client area? (i.e. excludi
karandeepb 2016/02/08 07:47:10 You are correct. It's the client area. Have correc
+ NSRect window_frame = [GetNativeWindow() frame];
+ // Convert rect to AppKit coordinate system.
+ NSRect target_rect_window =
tapted 2016/02/05 04:51:08 maybe NSRect ns_rect = rect.ToCGRect(); ns_rect.o
karandeepb 2016/02/08 07:47:10 Done.
+ NSMakeRect(rect.x(), window_frame.size.height - rect.y() - rect.height(),
+ rect.width(), rect.height());
+ // Now target_rect is in the Appkit window's coordinate system. Convert it to
+ // native view's coordinate system.
+ NSView* native_view = GetNativeView();
+ NSRect target_rect_view =
+ [native_view convertRect:target_rect_window fromView:nil];
+ [native_view setNeedsDisplayInRect:target_rect_view];
if (bridge_ && bridge_->layer())
bridge_->layer()->SchedulePaint(rect);
}
« 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