diff options
-rw-r--r-- | chrome/browser/browser_window_cocoa.mm | 12 | ||||
-rw-r--r-- | chrome/browser/browser_window_controller.h | 5 | ||||
-rw-r--r-- | chrome/browser/browser_window_controller.mm | 8 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.h | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.mm | 22 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.h | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 18 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 5 |
8 files changed, 77 insertions, 3 deletions
diff --git a/chrome/browser/browser_window_cocoa.mm b/chrome/browser/browser_window_cocoa.mm index baee161..e61bea443 100644 --- a/chrome/browser/browser_window_cocoa.mm +++ b/chrome/browser/browser_window_cocoa.mm @@ -99,10 +99,16 @@ bool BrowserWindowCocoa::IsFullscreen() const { return false; } +@interface NSWindow(OSInternals) +- (NSRect)_growBoxRect; +@end + gfx::Rect BrowserWindowCocoa::GetRootWindowResizerRect() const { - // TODO(pinkerton): fill this in so scrollbars go in the correct places - NOTIMPLEMENTED(); - return gfx::Rect(); + NSRect windowRect = [window_ _growBoxRect]; + // convert from window coordinates to the coordinates of the currently + // selected tab. |tabRect| will already be flipped into WebKit coordinates. + NSRect tabRect = [controller_ selectedTabGrowBoxFromWindowGrowBox:windowRect]; + return gfx::Rect(NSRectToCGRect(tabRect)); } LocationBar* BrowserWindowCocoa::GetLocationBar() const { diff --git a/chrome/browser/browser_window_controller.h b/chrome/browser/browser_window_controller.h index 5601b3f..9428cd3 100644 --- a/chrome/browser/browser_window_controller.h +++ b/chrome/browser/browser_window_controller.h @@ -55,6 +55,11 @@ class BrowserWindow; // 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_BROWSER_WINDOW_CONTROLLER_H_ diff --git a/chrome/browser/browser_window_controller.mm b/chrome/browser/browser_window_controller.mm index 282193b..eade6e2 100644 --- a/chrome/browser/browser_window_controller.mm +++ b/chrome/browser/browser_window_controller.mm @@ -145,4 +145,12 @@ [tabStripController_ 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 { + return [tabStripController_ + selectedTabGrowBoxFromWindowGrowBox:windowGrowBox]; +} + @end 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 //-------------------------------------------------------------------------- diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 7d23d36..04f16f1 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -703,7 +703,12 @@ void RenderWidget::GetRootWindowResizerRect(WebWidget* webwidget, // This is disabled to verify if WebKit is responsible for the slow down // that was witnessed in the page cycler tests when the resize corner // code was commited... +#if defined(OS_MACOSX) + // ...we need it enabled on Mac so scrollbars are usable. + *rect = resizer_rect_; +#elif defined(OS_WIN) || defined(OS_LINUX) *rect = gfx::Rect(); // resizer_rect_; +#endif } void RenderWidget::OnImeSetInputMode(bool is_active) { |