summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 18:05:14 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 18:05:14 +0000
commitfb63b72ec46cf173aff67fc7c377da1c56a49fce (patch)
treeef462a15ea4c0f9d23ad31dc670ec745df59e30d /chrome/browser/cocoa
parent1bd24327fb1ff4461e75e8347e3ed6c672632776 (diff)
downloadchromium_src-fb63b72ec46cf173aff67fc7c377da1c56a49fce.zip
chromium_src-fb63b72ec46cf173aff67fc7c377da1c56a49fce.tar.gz
chromium_src-fb63b72ec46cf173aff67fc7c377da1c56a49fce.tar.bz2
Hook up the resize rect for Mac and enable its use in the renderer (mac-only).
Review URL: http://codereview.chromium.org/21512 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.h5
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm22
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.h5
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm18
4 files changed, 50 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h
index 4d205bb..20d9a38 100644
--- a/chrome/browser/cocoa/tab_contents_controller.h
+++ b/chrome/browser/cocoa/tab_contents_controller.h
@@ -68,6 +68,11 @@ class TabStripModel;
// Sets whether or not the current page in the frontmost tab is bookmarked.
- (void)setStarredState:(BOOL)isStarred;
+// Return the rect, in WebKit coordinates (flipped), of the window's grow box
+// in the coordinate system of the content area of this tab.
+// |windowGrowBox| needs to be in the window's coordinate system.
+- (NSRect)growBoxFromWindowGrowBox:(NSRect)windowGrowBox;
+
@end
#endif // CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index 4b8eb8b..5d62716 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -202,6 +202,28 @@ class LocationBarBridge : public LocationBar {
[starButton_ setImage:[NSImage imageNamed:starImageName]];
}
+// Return the rect, in WebKit coordinates (flipped), of the window's grow box
+// in the coordinate system of the content area of this tab.
+// |windowGrowBox| needs to be in the window's coordinate system.
+- (NSRect)growBoxFromWindowGrowBox:(NSRect)windowGrowBox {
+ NSRect localGrowBox = NSMakeRect(0, 0, 0, 0);
+ NSView* contentView = contents_->GetNativeView();
+ if (contentView) {
+ localGrowBox = windowGrowBox;
+ // The scrollbar assumes that the resizer goes all the way down to the
+ // bottom corner, so we ignore any y offset to the rect itself and use the
+ // entire bottom corner.
+ localGrowBox.origin.y = 0;
+ // Convert to view coordinates from window coordinates.
+ localGrowBox = [contentView convertRect:localGrowBox fromView:nil];
+ // Flip the rect in view coordinates
+ localGrowBox.origin.y =
+ [contentView frame].size.height - localGrowBox.origin.y -
+ localGrowBox.size.height;
+ }
+ return localGrowBox;
+}
+
@end
//--------------------------------------------------------------------------
diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h
index 2f1bcbf..6062d70 100644
--- a/chrome/browser/cocoa/tab_strip_controller.h
+++ b/chrome/browser/cocoa/tab_strip_controller.h
@@ -57,6 +57,11 @@ class TabContents;
// Sets whether or not the current page in the frontmost tab is bookmarked.
- (void)setStarredState:(BOOL)isStarred;
+// Return the rect, in WebKit coordinates (flipped), of the window's grow box
+// in the coordinate system of the content area of the currently selected tab.
+// |windowGrowBox| needs to be in the window's coordinate system.
+- (NSRect)selectedTabGrowBoxFromWindowGrowBox:(NSRect)windowGrowBox;
+
@end
#endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 864ab12..65ad9b0 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -334,6 +334,24 @@ class TabStripBridge : public TabStripModelObserver {
[selectedController setStarredState:isStarred];
}
+// Return the rect, in WebKit coordinates (flipped), of the window's grow box
+// in the coordinate system of the content area of the currently selected tab.
+// |windowGrowBox| needs to be in the window's coordinate system.
+- (NSRect)selectedTabGrowBoxFromWindowGrowBox:(NSRect)windowGrowBox {
+ TabContents* selectedContents = model_->GetSelectedTabContents();
+ if (!selectedContents) {
+ // When the window is initially being constructed, there may be no currently
+ // selected tab, so pick the first one. If there aren't any, just bail with
+ // an empty rect.
+ selectedContents = model_->GetTabContentsAt(0);
+ if (!selectedContents)
+ return NSMakeRect(0, 0, 0, 0);
+ }
+ TabContentsController* selectedController =
+ [self controllerWithContents:selectedContents];
+ return [selectedController growBoxFromWindowGrowBox:windowGrowBox];
+}
+
@end
//--------------------------------------------------------------------------