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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 8491062: Fixes GetContainerBounds in tab_contents_view_mac.mm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // Convert bounds to window coordinate space.
153 NSRect bounds =
154 [cocoa_view_.get() convertRect:[cocoa_view_.get() bounds] toView:nil];
155
156 // Convert bounds to screen coordinate space.
157 NSWindow* window = [cocoa_view_.get() window];
158 NSPoint origin = [window convertBaseToScreen:bounds.origin];
159 bounds = NSMakeRect(origin.x, origin.y, bounds.size.width,
160 bounds.size.height);
Avi (use Gerrit) 2011/11/14 21:27:14 alternatively: bounds.origin = [window convertBas
161
162 // Flip y to account for screen flip.
163 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
164 bounds.origin.y = [screen frame].size.height - bounds.origin.y
165 - bounds.size.height;
166 *out = gfx::Rect(NSRectToCGRect(bounds));
153 } 167 }
154 168
155 void TabContentsViewMac::StartDragging( 169 void TabContentsViewMac::StartDragging(
156 const WebDropData& drop_data, 170 const WebDropData& drop_data,
157 WebDragOperationsMask allowed_operations, 171 WebDragOperationsMask allowed_operations,
158 const SkBitmap& image, 172 const SkBitmap& image,
159 const gfx::Point& image_offset) { 173 const gfx::Point& image_offset) {
160 // By allowing nested tasks, the code below also allows Close(), 174 // By allowing nested tasks, the code below also allows Close(),
161 // which would deallocate |this|. The same problem can occur while 175 // which would deallocate |this|. The same problem can occur while
162 // processing -sendEvent:, so Close() is deferred in that case. 176 // processing -sendEvent:, so Close() is deferred in that case.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 [[[notification userInfo] objectForKey:kSelectionDirection] 611 [[[notification userInfo] objectForKey:kSelectionDirection]
598 unsignedIntegerValue]; 612 unsignedIntegerValue];
599 if (direction == NSDirectSelection) 613 if (direction == NSDirectSelection)
600 return; 614 return;
601 615
602 [self tabContents]-> 616 [self tabContents]->
603 FocusThroughTabTraversal(direction == NSSelectingPrevious); 617 FocusThroughTabTraversal(direction == NSSelectingPrevious);
604 } 618 }
605 619
606 @end 620 @end
OLDNEW
« no previous file with comments | « no previous file | content/browser/tab_contents/tab_contents_view.h » ('j') | content/browser/tab_contents/tab_contents_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698