summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-14 18:57:37 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-14 18:57:37 +0000
commitda79bef92a770ba6f8ad3151d78c9ef6486906a4 (patch)
tree235f1f4433dbf7b129a1ee0ab9e7116fe835728c /chrome
parente31aab1840df828c907d32b41cc61b024e12e132 (diff)
downloadchromium_src-da79bef92a770ba6f8ad3151d78c9ef6486906a4.zip
chromium_src-da79bef92a770ba6f8ad3151d78c9ef6486906a4.tar.gz
chromium_src-da79bef92a770ba6f8ad3151d78c9ef6486906a4.tar.bz2
Fixes a bug where scrolling up would draw over the horizontal
scrollbar on mac. Patch by rohitrao. http://codereview.chromium.org/73042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 918fdd6..f6844e4 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -209,7 +209,16 @@ void RenderWidgetHostViewMac::DidScrollRect(
if (is_hidden_)
return;
- [cocoa_view_ scrollRect:[cocoa_view_ RectToNSRect:rect]
+ // Before asking the cocoa view to scroll, shorten the rect's height
+ // by |dx| pixels if we are scrolling left and shorten its height by
+ // |dy| pixels if we are scrolling up. This will prevent us from
+ // moving data beyond the bounds of the original rect, which in turn
+ // prevents us from accidentally drawing over the scrollbars.
+ gfx::Rect scroll_rect = rect;
+ scroll_rect.Inset(0, 0,
+ dx > 0 ? dx : 0,
+ dy > 0 ? dy : 0);
+ [cocoa_view_ scrollRect:[cocoa_view_ RectToNSRect:scroll_rect]
by:NSMakeSize(dx, -dy)];
gfx::Rect new_rect = rect;