summaryrefslogtreecommitdiffstats
path: root/webkit/glue/chrome_client_impl.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 21:13:01 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 21:13:01 +0000
commit63bf66fc9f88f5ec92f4e9a2e2c65e747bab50c4 (patch)
tree6d9886906e7beb39c0265a53842aa79f6d5357c2 /webkit/glue/chrome_client_impl.cc
parentb6857ad5bc27cf95b765b1c019a35c7830cfd980 (diff)
downloadchromium_src-63bf66fc9f88f5ec92f4e9a2e2c65e747bab50c4.zip
chromium_src-63bf66fc9f88f5ec92f4e9a2e2c65e747bab50c4.tar.gz
chromium_src-63bf66fc9f88f5ec92f4e9a2e2c65e747bab50c4.tar.bz2
Fix ChromeClientImpl::windowRect() to return the current
window's rect. Previously, it was combining the window origin with the size of the renderer; not the size of the window. BUG=1186573 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/chrome_client_impl.cc')
-rw-r--r--webkit/glue/chrome_client_impl.cc36
1 files changed, 23 insertions, 13 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 20109b9..ddb1e85 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -97,16 +97,26 @@ void ChromeClientImpl::setWindowRect(const WebCore::FloatRect& r) {
}
WebCore::FloatRect ChromeClientImpl::windowRect() {
- gfx::Point origin;
- if (webview_->delegate())
- webview_->delegate()->GetWindowLocation(webview_, &origin);
- const gfx::Size size = webview_->size();
-
- return WebCore::FloatRect(
- static_cast<float>(origin.x()),
- static_cast<float>(origin.y()),
- static_cast<float>(size.width()),
- static_cast<float>(size.height()));
+ if (webview_->delegate()) {
+ gfx::Rect rect;
+ webview_->delegate()->GetWindowRect(webview_, &rect);
+ return WebCore::FloatRect(
+ static_cast<float>(rect.x()),
+ static_cast<float>(rect.y()),
+ static_cast<float>(rect.width()),
+ static_cast<float>(rect.height()));
+ } else {
+ // These numbers will be fairly wrong. The window's x/y coordinates will
+ // be the top left corner of the screen and the size will be the content
+ // size instead of the window size.
+ gfx::Point origin;
+ const gfx::Size size = webview_->size();
+ return WebCore::FloatRect(
+ static_cast<float>(origin.x()),
+ static_cast<float>(origin.y()),
+ static_cast<float>(size.width()),
+ static_cast<float>(size.height()));
+ }
}
WebCore::FloatRect ChromeClientImpl::pageRect() {
@@ -420,9 +430,9 @@ WebCore::IntRect ChromeClientImpl::windowToScreen(const WebCore::IntRect& rect)
WebViewDelegate* d = webview_->delegate();
if (d) {
- gfx::Point window_pos;
- d->GetWindowLocation(webview_, &window_pos);
- screen_rect.move(window_pos.x(), window_pos.y());
+ gfx::Rect window_rect;
+ d->GetWindowRect(webview_, &window_rect);
+ screen_rect.move(window_rect.x(), window_rect.y());
}
return screen_rect;