summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-08 19:24:11 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-08 19:24:11 +0000
commita7b4cfb74ed3a2fdec2607b4f97ab92f103eeea7 (patch)
treeb269582ada27a82c96489a189a5f837616f3a197
parente1b0606810050219d3e3becaa0cc4d327c4a69a1 (diff)
downloadchromium_src-a7b4cfb74ed3a2fdec2607b4f97ab92f103eeea7.zip
chromium_src-a7b4cfb74ed3a2fdec2607b4f97ab92f103eeea7.tar.gz
chromium_src-a7b4cfb74ed3a2fdec2607b4f97ab92f103eeea7.tar.bz2
Fixes scrolling in the mac backingstore. We were copying
pixels to the wrong location when the scrolled region did not start at y=0. BUG=13521 TEST=Open url in bug report. Scroll in the two frames with scrollbars, then switch to a different window. The webpage should not get scrambled. Review URL: http://codereview.chromium.org/118372 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17886 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/backing_store_mac.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/backing_store_mac.cc b/chrome/browser/renderer_host/backing_store_mac.cc
index 1d00d28..569e3f6 100644
--- a/chrome/browser/renderer_host/backing_store_mac.cc
+++ b/chrome/browser/renderer_host/backing_store_mac.cc
@@ -97,19 +97,20 @@ void BackingStore::ScrollRect(base::ProcessHandle process,
// For down scrolls, we copy bottom-up (in screen coordinates).
// For up scrolls, we copy top-down.
if (dy > 0) {
- // Move |x| to the first pixel of this row.
+ // Move |x| to the first pixel of the first row of the clip rect.
+ x += clip_rect.y() * stride;
x += clip_rect.x() * 4;
- for (int i = clip_rect.y(); i < clip_rect.height() - dy; ++i) {
+ for (int i = 0; i < clip_rect.height() - dy; ++i) {
memcpy(x, x + stride * dy, len);
x += stride;
}
} else {
// Move |x| to the first pixel of the last row of the clip rect.
- x += clip_rect.x() * 4;
x += (clip_rect.bottom() - 1) * stride;
+ x += clip_rect.x() * 4;
- for (int i = clip_rect.y(); i < clip_rect.height() + dy; ++i) {
+ for (int i = 0; i < clip_rect.height() + dy; ++i) {
memcpy(x, x + stride * dy, len);
x -= stride;
}