From 44d3a81ac387ca3c1ebbad279e3b31d7ac961398 Mon Sep 17 00:00:00 2001 From: Grace Kloba <> Date: Mon, 6 Apr 2009 10:20:23 -0700 Subject: AI 144646: Fix #1726127. During history navigation, ScrollView::platformSetScrollPosition() can be called for an iframe in the creation, which is before it is added to the view hierarchy. So we need to check "this" against mainFrame's view to know whether it is the top view instead of checking parent(). BUG=1726127 Automated import of CL 144646 --- WebCore/platform/android/ScrollViewAndroid.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp index 5622d8b..bce09cf 100644 --- a/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/WebCore/platform/android/ScrollViewAndroid.cpp @@ -28,6 +28,7 @@ #include "ScrollView.h" #include "FloatRect.h" +#include "Frame.h" #include "FrameView.h" #include "IntRect.h" #include "WebCoreFrameBridge.h" @@ -67,9 +68,13 @@ IntSize ScrollView::platformContentsSize() const void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt) { - if (parent()) // don't attempt to scroll subframes; they're fully visible + android::WebViewCore* webviewCore = android::WebViewCore::getWebViewCore(this); + // don't attempt to scroll subframes; they're fully visible. + // as this can be called before the view is added to the parent in iframe + // creation, we can't depend on parent() checking. + if (webviewCore->mainFrame()->view() != this) return; - android::WebViewCore::getWebViewCore(this)->scrollTo(pt.x(), pt.y()); + webviewCore->scrollTo(pt.x(), pt.y()); } void ScrollView::platformScrollbarModes(ScrollbarMode& h, ScrollbarMode& v) const -- cgit v1.1