From 914d19a9c9c51a1d5cfe0cec29aeb9adaf9357d5 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Thu, 3 Jun 2010 09:47:19 -0700 Subject: Fix platformVisibleContentRect() for the sub frame. The visibleBounds is only set to the top frame. For sub frame, we need to intersect it with the sub frame's own bounds. Fix http://b/issue?id=2685194 --- WebCore/platform/android/ScrollViewAndroid.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'WebCore/platform') diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp index ccfe10e..74f9d6b 100644 --- a/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/WebCore/platform/android/ScrollViewAndroid.cpp @@ -54,11 +54,21 @@ namespace WebCore { IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const { - IntRect rect = platformWidget()->getVisibleBounds(); - // This makes subframes draw correctly, since subframes cannot scroll. - if (parent()) - return IntRect(0, 0, rect.width(), rect.height()); - return rect; + if (parent()) { + const ScrollView* sv = this; + int offsetX = 0; + int offsetY = 0; + while (sv->parent()) { + offsetX += sv->x(); + offsetY += sv->y(); + sv = sv->parent(); + } + IntRect rect = sv->platformWidget()->getVisibleBounds(); + rect.move(-offsetX, -offsetY); + rect.intersect(IntRect(0, 0, width(), height())); + return rect; + } + return platformWidget()->getVisibleBounds(); } IntSize ScrollView::platformContentsSize() const -- cgit v1.1