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

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: Addressed Review comments. Added unit tests for NativeWidgetMac::SchedulePaintInRect 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..8ee2a6d7de3021510f2d1474f400b85a11a01558 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -502,9 +502,15 @@ 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 client area of the window.
+ NSWindow* window = GetNativeWindow();
+ NSRect client_rect = [window contentRectForFrameRect:[window frame]];
+ NSRect target_rect = rect.ToCGRect();
+
+ // Convert to Appkit coordinate system (origin at bottom left).
+ target_rect.origin.y =
+ NSHeight(client_rect) - target_rect.origin.y - NSHeight(target_rect);
+ [GetNativeView() setNeedsDisplayInRect:target_rect];
if (bridge_ && bridge_->layer())
bridge_->layer()->SchedulePaint(rect);
}

Powered by Google App Engine
This is Rietveld 408576698