Chromium Code Reviews| 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); |
| } |