diff options
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 2 | ||||
-rw-r--r-- | WebCore/platform/android/ScrollViewAndroid.cpp | 4 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 13 |
3 files changed, 18 insertions, 1 deletions
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index 43313a5..ad181e6 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -135,6 +135,8 @@ public: // ANDROID // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 static bool isWebViewPaused(const FrameView*); + + static bool canScroll(const FrameView*); }; } diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp index f9e4285..7efc8c1 100644 --- a/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/WebCore/platform/android/ScrollViewAndroid.cpp @@ -30,8 +30,8 @@ #include "FloatRect.h" #include "FrameView.h" #include "IntRect.h" +#include "PlatformBridge.h" #include "SkRegion.h" -#include "WebCoreFrameBridge.h" #include "WebCoreViewBridge.h" #include "WebViewCore.h" @@ -70,6 +70,8 @@ void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt) { if (parent()) // don't attempt to scroll subframes; they're fully visible return; + if (isFrameView() && !PlatformBridge::canScroll(static_cast<FrameView*>(this))) + return; android::WebViewCore::getWebViewCore(this)->scrollTo(pt.x(), pt.y()); } diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index 05aa42b..13bbf38 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -27,9 +27,11 @@ #include <PlatformBridge.h> #include "CookieClient.h" +#include "FrameView.h" #include "JavaSharedClient.h" #include "KeyGeneratorClient.h" #include "PluginView.h" +#include "WebCoreFrameBridge.h" #include "WebViewCore.h" #include "npruntime.h" #include <wtf/android/AndroidThreading.h> @@ -135,6 +137,17 @@ bool PlatformBridge::isWebViewPaused(const WebCore::FrameView* frameView) return webViewCore->isPaused(); } +bool PlatformBridge::canScroll(const WebCore::FrameView* frameView) +{ + // We want to ignore requests to scroll that were not initiated by the + // user. An example of this is when text is inserted into a + // textfield/area, which results in a scroll. We ignore this because + // we know how to do this ourselves in the UI thread. + // An example of it being initiated by the user is if the user clicks + // an anchor element which simply scrolls the page. + return android::WebFrame::getWebFrame(frameView->frame())->userInitiatedClick(); +} + bool PlatformBridge::popupsAllowed(NPP) { return false; |