summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 18:54:19 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 18:54:19 +0000
commitc04b6367950900e19ced8d89393d3b870fd837b8 (patch)
treebeb0a0a6a0d2cd60c0d456c0fd4b94cfb4c4b518 /webkit
parent0eb9f434fb019da43b97c81d7e314885d43af0f9 (diff)
downloadchromium_src-c04b6367950900e19ced8d89393d3b870fd837b8.zip
chromium_src-c04b6367950900e19ced8d89393d3b870fd837b8.tar.gz
chromium_src-c04b6367950900e19ced8d89393d3b870fd837b8.tar.bz2
Plumb WebCore's windowResizerRect() through glue and renderer. Enables Mac scrollbars to not overlap the in-window resizer widget.
Review URL: http://codereview.chromium.org/11353 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/chrome_client_impl.cc9
-rw-r--r--webkit/glue/webwidget_delegate.h7
-rw-r--r--webkit/tools/test_shell/mac/test_webview_delegate.mm27
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h1
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_gtk.cc6
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_win.cc6
6 files changed, 54 insertions, 2 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index daf9432..edb9ed7 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -353,8 +353,15 @@ bool ChromeClientImpl::tabsToLinks() const {
}
WebCore::IntRect ChromeClientImpl::windowResizerRect() const {
- // TODO(mbelshe): implement me
WebCore::IntRect rv;
+ if (webview_->delegate()) {
+ gfx::Rect resizer_rect;
+ webview_->delegate()->GetRootWindowResizerRect(webview_, &resizer_rect);
+ rv = WebCore::IntRect(resizer_rect.x(),
+ resizer_rect.y(),
+ resizer_rect.width(),
+ resizer_rect.height());
+ }
return rv;
}
diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h
index 45d0dcc..3302c5d 100644
--- a/webkit/glue/webwidget_delegate.h
+++ b/webkit/glue/webwidget_delegate.h
@@ -63,9 +63,14 @@ class WebWidgetDelegate {
// synchronously?
virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect) = 0;
- // Returns the rectangle of the window in which this WebWidget is embeded in.
+ // Returns the rectangle of the window in which this WebWidget is embeded.
virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) = 0;
+ // Returns the resizer rectangle of the window this WebWidget is in. This
+ // is used on Mac to determine if a scrollbar is over the in-window resize
+ // area at the bottom right corner.
+ virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect) = 0;
+
// Keeps track of the necessary window move for a plugin window that resulted
// from a scroll operation. That way, all plugin windows can be moved at the
// same time as each other and the page.
diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm
index 7373cb6..3672f05 100644
--- a/webkit/tools/test_shell/mac/test_webview_delegate.mm
+++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm
@@ -96,6 +96,33 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
}
+@interface NSWindow(OSInternals)
+- (NSRect)_growBoxRect;
+@end
+
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+ gfx::Rect* out_rect) {
+ NSRect resize_rect = NSMakeRect(0, 0, 0, 0);
+ if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
+ NSView *view = host->view_handle();
+ NSWindow* window = [view window];
+ resize_rect = [window _growBoxRect];
+ // 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. There will be an offset If the window is created
+ // with |NSTexturedBackgroundWindowMask|, and currently TestShell makes its
+ // windows with that flag.
+ resize_rect.origin.y = 0;
+ // Convert to view coordinates from window coordinates.
+ resize_rect = [view convertRect:resize_rect fromView:nil];
+ // Flip the rect in view coordinates
+ resize_rect.origin.y =
+ [view frame].size.height - resize_rect.origin.y -
+ resize_rect.size.height;
+ }
+ *out_rect = gfx::Rect(NSRectToCGRect(resize_rect));
+}
+
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
NOTIMPLEMENTED();
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 48c0930..df214bd 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -210,6 +210,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect);
virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect);
virtual void GetRootWindowRect(WebWidget *,gfx::Rect *);
+ virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect);
virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move);
virtual void RunModal(WebWidget* webwidget);
virtual bool IsHidden();
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index bbd586b..0874429 100644
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -140,6 +140,12 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
}
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+ gfx::Rect* out_rect) {
+ // Not necessary on Linux.
+ *out_rect = gfx::Rect();
+}
+
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
NOTIMPLEMENTED();
}
diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc
index 9826488..c17e2fa 100644
--- a/webkit/tools/test_shell/test_webview_delegate_win.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_win.cc
@@ -131,6 +131,12 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
}
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+ gfx::Rect* out_rect) {
+ // Not necessary on Windows.
+ *out_rect = gfx::Rect();
+}
+
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
Show(webwidget, NEW_WINDOW);