Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/native_widget_mac.h" | 5 #include "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 | 495 |
| 496 void NativeWidgetMac::RunShellDrag(View* view, | 496 void NativeWidgetMac::RunShellDrag(View* view, |
| 497 const ui::OSExchangeData& data, | 497 const ui::OSExchangeData& data, |
| 498 const gfx::Point& location, | 498 const gfx::Point& location, |
| 499 int operation, | 499 int operation, |
| 500 ui::DragDropTypes::DragEventSource source) { | 500 ui::DragDropTypes::DragEventSource source) { |
| 501 NOTIMPLEMENTED(); | 501 NOTIMPLEMENTED(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { | 504 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { |
| 505 // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate | 505 // |rect| is relative to client area of the window. |
|
tapted
2016/02/10 02:28:02
needs a rebase off the other CL (probably the orde
karandeepb
2016/02/11 00:30:09
Done.
| |
| 506 // system of |rect| has been converted. | 506 NSWindow* window = GetNativeWindow(); |
| 507 [GetNativeView() setNeedsDisplay:YES]; | 507 NSRect client_rect = [window contentRectForFrameRect:[window frame]]; |
| 508 NSRect target_rect = rect.ToCGRect(); | |
| 509 | |
| 510 // Convert to Appkit coordinate system (origin at bottom left). | |
| 511 target_rect.origin.y = | |
| 512 NSHeight(client_rect) - target_rect.origin.y - NSHeight(target_rect); | |
| 513 [GetNativeView() setNeedsDisplayInRect:target_rect]; | |
| 508 if (bridge_ && bridge_->layer()) | 514 if (bridge_ && bridge_->layer()) |
| 509 bridge_->layer()->SchedulePaint(rect); | 515 bridge_->layer()->SchedulePaint(rect); |
| 510 } | 516 } |
| 511 | 517 |
| 512 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { | 518 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { |
| 513 if (bridge_) | 519 if (bridge_) |
| 514 bridge_->SetCursor(cursor); | 520 bridge_->SetCursor(cursor); |
| 515 } | 521 } |
| 516 | 522 |
| 517 bool NativeWidgetMac::IsMouseEventsEnabled() const { | 523 bool NativeWidgetMac::IsMouseEventsEnabled() const { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 727 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 722 } | 728 } |
| 723 | 729 |
| 724 - (void)animationDidEnd:(NSAnimation*)animation { | 730 - (void)animationDidEnd:(NSAnimation*)animation { |
| 725 [window_ close]; | 731 [window_ close]; |
| 726 [animation_ setDelegate:nil]; | 732 [animation_ setDelegate:nil]; |
| 727 [self release]; | 733 [self release]; |
| 728 } | 734 } |
| 729 | 735 |
| 730 @end | 736 @end |
| OLD | NEW |