From 8f8e5e4506f48f2d6067f4f29b32b0683e6e110a Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Mon, 13 Jul 2009 21:29:06 +0000 Subject: Changes Mac behavior to reblit the entire RWHVCocoa when scrolling. This fixes the trails left behind when scrolling with the findbar open. BUG=16124 TEST=Scroll with the find bar or popup blocker open. Make sure there are no trails left behind or other drawing issues. Review URL: http://codereview.chromium.org/149556 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20538 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_host/render_widget_host_view_mac.mm | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 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 a039497..0f0dc0e 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -220,23 +220,14 @@ void RenderWidgetHostViewMac::DidScrollRect( if (is_hidden_) return; - // Before asking the cocoa view to scroll, shorten the rect's bounds - // by the amount we are scrolling. This will prevent us from moving - // data beyond the bounds of the original rect, which in turn - // prevents us from accidentally drawing over other parts of the - // page (scrolbars, other frames, etc). - gfx::Rect scroll_rect = rect; - scroll_rect.Inset(dx < 0 ? -dx : 0, - dy < 0 ? -dy : 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; - new_rect.Offset(dx, dy); - gfx::Rect dirty_rect = rect.Subtract(new_rect); - [cocoa_view_ setNeedsDisplayInRect:[cocoa_view_ RectToNSRect:dirty_rect]]; + // We've already modified the BackingStore to reflect the scroll, so + // simply ask the RWHVCocoa to redraw itself based on the new + // pixels. We cannot use -[NSView scrollRect:by:] here because the + // findbar and blocked popups will leave trails behind. + // TODO(rohitrao): Evaluate how slow this full redraw is. If it + // turns out to be a problem, consider scrolling only a portion of + // the view, based on where the findbar and blocked popups are. + [cocoa_view_ setNeedsDisplay:YES]; } void RenderWidgetHostViewMac::RenderViewGone() { -- cgit v1.1