OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/cocoa/tab_contents_controller.h" | 5 #import "chrome/browser/cocoa/tab_contents_controller.h" |
6 | 6 |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 - (void)tabDidChange:(TabContents*)updatedContents { | 51 - (void)tabDidChange:(TabContents*)updatedContents { |
52 // Calling setContentView: here removes any first responder status | 52 // Calling setContentView: here removes any first responder status |
53 // the view may have, so avoid changing the view hierarchy unless | 53 // the view may have, so avoid changing the view hierarchy unless |
54 // the view is different. | 54 // the view is different. |
55 if (contents_ != updatedContents) { | 55 if (contents_ != updatedContents) { |
56 contents_ = updatedContents; | 56 contents_ = updatedContents; |
57 [contentsBox_ setContentView:contents_->GetNativeView()]; | 57 [contentsBox_ setContentView:contents_->GetNativeView()]; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | |
62 // in the coordinate system of the content area of this tab. | |
63 - (NSRect)growBoxRect { | |
64 NSRect localGrowBox = NSMakeRect(0, 0, 0, 0); | |
65 NSView* contentView = contents_->GetNativeView(); | |
66 if (contentView) { | |
67 // For the rect, we start with the grow box view which is a sibling of | |
68 // the content view's containing box. It's in the coordinate system of | |
69 // the controller view. | |
70 localGrowBox = [growBox_ frame]; | |
71 // The scrollbar assumes that the resizer goes all the way down to the | |
72 // bottom corner, so we ignore any y offset to the rect itself and use the | |
73 // entire bottom corner. | |
74 localGrowBox.origin.y = 0; | |
75 // Convert to the content view's coordinates. | |
76 localGrowBox = [contentView convertRect:localGrowBox | |
77 fromView:[self view]]; | |
78 // Flip the rect in view coordinates | |
79 localGrowBox.origin.y = | |
80 [contentView frame].size.height - localGrowBox.origin.y - | |
81 localGrowBox.size.height; | |
82 } | |
83 return localGrowBox; | |
84 } | |
85 | |
86 @end | 61 @end |
OLD | NEW |