diff options
author | Grace Kloba <klobag@google.com> | 2010-06-04 09:27:05 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-06-04 09:27:05 -0700 |
commit | e276c2d0434cc38c4b71ea12e09ccbb93bdee39c (patch) | |
tree | 093b4582e267cad9b43b46f17971791a9c627a3f /WebCore | |
parent | ee57801b8b78697eab271f1376ca1e59329266cc (diff) | |
parent | 914d19a9c9c51a1d5cfe0cec29aeb9adaf9357d5 (diff) | |
download | external_webkit-e276c2d0434cc38c4b71ea12e09ccbb93bdee39c.zip external_webkit-e276c2d0434cc38c4b71ea12e09ccbb93bdee39c.tar.gz external_webkit-e276c2d0434cc38c4b71ea12e09ccbb93bdee39c.tar.bz2 |
Merge "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."
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/android/ScrollViewAndroid.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
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 |