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

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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 NSPoint origin = [[cocoa_view_.get() window] frame].origin;
Avi (use Gerrit) 2011/11/12 01:42:00 This line gets the window origin in global coordin
153
154 // Flip coordinates based on the primary screen.
155 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
156 NSSize size = [cocoa_view_.get() frame].size;
Avi (use Gerrit) 2011/11/12 01:42:00 ...and this line gets the size of the view in its
157 origin.y = [screen frame].size.height - origin.y - size.height;
Avi (use Gerrit) 2011/11/12 01:42:00 ...and this line mixes up values from two totally
158 NSRect bounds = NSMakeRect(origin.x, origin.y, size.width, size.height);
Avi (use Gerrit) 2011/11/12 01:42:00 ...as does this line. What is GetContainerBounds s
159 *out = gfx::Rect(NSRectToCGRect(bounds));
153 } 160 }
154 161
155 void TabContentsViewMac::StartDragging( 162 void TabContentsViewMac::StartDragging(
156 const WebDropData& drop_data, 163 const WebDropData& drop_data,
157 WebDragOperationsMask allowed_operations, 164 WebDragOperationsMask allowed_operations,
158 const SkBitmap& image, 165 const SkBitmap& image,
159 const gfx::Point& image_offset) { 166 const gfx::Point& image_offset) {
160 // By allowing nested tasks, the code below also allows Close(), 167 // By allowing nested tasks, the code below also allows Close(),
161 // which would deallocate |this|. The same problem can occur while 168 // which would deallocate |this|. The same problem can occur while
162 // processing -sendEvent:, so Close() is deferred in that case. 169 // 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] 604 [[[notification userInfo] objectForKey:kSelectionDirection]
598 unsignedIntegerValue]; 605 unsignedIntegerValue];
599 if (direction == NSDirectSelection) 606 if (direction == NSDirectSelection)
600 return; 607 return;
601 608
602 [self tabContents]-> 609 [self tabContents]->
603 FocusThroughTabTraversal(direction == NSSelectingPrevious); 610 FocusThroughTabTraversal(direction == NSSelectingPrevious);
604 } 611 }
605 612
606 @end 613 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698