Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 if (!rwhv) | 142 if (!rwhv) |
| 143 return NULL; | 143 return NULL; |
| 144 return rwhv->GetNativeView(); | 144 return rwhv->GetNativeView(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const { | 147 gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const { |
| 148 return [cocoa_view_.get() window]; | 148 return [cocoa_view_.get() window]; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const { | 151 void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const { |
| 152 *out = [cocoa_view_.get() flipNSRectToRect:[cocoa_view_.get() bounds]]; | 152 NSRect bounds = [cocoa_view_.get() bounds]; |
| 153 NSRect bounds_wrt_window = [cocoa_view_.get() convertRect:bounds toView:nil]; | |
|
Avi (use Gerrit)
2011/11/14 19:18:57
bounds_wrt_window is a horrible name. Just use bou
| |
| 154 | |
| 155 NSWindow* window = [cocoa_view_.get() window]; | |
| 156 NSPoint origin_wrt_screen = [ | |
| 157 window convertBaseToScreen:bounds_wrt_window.origin]; | |
|
Avi (use Gerrit)
2011/11/14 19:18:57
You can't break there. You break like:
blah blah
| |
| 158 NSRect bounds_wrt_screen = NSMakeRect(origin_wrt_screen.x, | |
|
Avi (use Gerrit)
2011/11/14 19:18:57
horrible name; change
| |
| 159 origin_wrt_screen.y, | |
| 160 bounds_wrt_window.size.width, | |
| 161 bounds_wrt_window.size.height); | |
| 162 | |
| 163 // Flip y to account for screen flip. | |
| 164 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | |
| 165 bounds_wrt_screen.origin.y = [screen frame].size.height | |
| 166 - bounds_wrt_screen.origin.y - bounds_wrt_screen.size.height; | |
| 167 *out = gfx::Rect(NSRectToCGRect(bounds_wrt_screen)); | |
|
Avi (use Gerrit)
2011/11/14 19:18:57
This is a change of functionality. Before, the bou
| |
| 153 } | 168 } |
| 154 | 169 |
| 155 void TabContentsViewMac::StartDragging( | 170 void TabContentsViewMac::StartDragging( |
| 156 const WebDropData& drop_data, | 171 const WebDropData& drop_data, |
| 157 WebDragOperationsMask allowed_operations, | 172 WebDragOperationsMask allowed_operations, |
| 158 const SkBitmap& image, | 173 const SkBitmap& image, |
| 159 const gfx::Point& image_offset) { | 174 const gfx::Point& image_offset) { |
| 160 // By allowing nested tasks, the code below also allows Close(), | 175 // By allowing nested tasks, the code below also allows Close(), |
| 161 // which would deallocate |this|. The same problem can occur while | 176 // which would deallocate |this|. The same problem can occur while |
| 162 // processing -sendEvent:, so Close() is deferred in that case. | 177 // processing -sendEvent:, so Close() is deferred in that case. |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 [[[notification userInfo] objectForKey:kSelectionDirection] | 612 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 598 unsignedIntegerValue]; | 613 unsignedIntegerValue]; |
| 599 if (direction == NSDirectSelection) | 614 if (direction == NSDirectSelection) |
| 600 return; | 615 return; |
| 601 | 616 |
| 602 [self tabContents]-> | 617 [self tabContents]-> |
| 603 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 618 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 604 } | 619 } |
| 605 | 620 |
| 606 @end | 621 @end |
| OLD | NEW |