diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2011-02-10 14:18:41 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-10 14:18:41 -0800 |
commit | f60e7a005a7df326d97263dde7184ad1fe1e0897 (patch) | |
tree | 2b642b1427c322746709ef1ef39f59500b9b41c3 | |
parent | b4c101d6c944ea6a1a0aad52c354c281f6cdcb4a (diff) | |
parent | 3c0909cb7a28a49e5b95c1355657460c07c4a714 (diff) | |
download | external_webkit-f60e7a005a7df326d97263dde7184ad1fe1e0897.zip external_webkit-f60e7a005a7df326d97263dde7184ad1fe1e0897.tar.gz external_webkit-f60e7a005a7df326d97263dde7184ad1fe1e0897.tar.bz2 |
Merge "Only update history position if scrolling is done by user."
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 188bcd9..8c0fade 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1153,23 +1153,25 @@ void WebViewCore::setScrollOffset(int moveGeneration, bool sendScrollEvent, int // testing work correctly. m_mainFrame->view()->platformWidget()->setLocation(m_scrollOffsetX, m_scrollOffsetY); - if (sendScrollEvent) + if (sendScrollEvent) { m_mainFrame->eventHandler()->sendScrollEvent(); - // Update history item to reflect the new scroll position. - // This also helps save the history information when the browser goes to - // background, so scroll position will be restored if browser gets - // killed while in background. - WebCore::HistoryController* history = m_mainFrame->loader()->history(); - // Because the history item saving could be heavy for large sites and - // scrolling can generate lots of small scroll offset, the following code - // reduces the saving frequency. - static const int MIN_SCROLL_DIFF = 32; - if (history->currentItem()) { - WebCore::IntPoint currentPoint = history->currentItem()->scrollPoint(); - if (std::abs(currentPoint.x() - dx) >= MIN_SCROLL_DIFF || - std::abs(currentPoint.y() - dy) >= MIN_SCROLL_DIFF) { - history->saveScrollPositionAndViewStateToItem(history->currentItem()); + // Only update history position if it's user scrolled. + // Update history item to reflect the new scroll position. + // This also helps save the history information when the browser goes to + // background, so scroll position will be restored if browser gets + // killed while in background. + WebCore::HistoryController* history = m_mainFrame->loader()->history(); + // Because the history item saving could be heavy for large sites and + // scrolling can generate lots of small scroll offset, the following code + // reduces the saving frequency. + static const int MIN_SCROLL_DIFF = 32; + if (history->currentItem()) { + WebCore::IntPoint currentPoint = history->currentItem()->scrollPoint(); + if (std::abs(currentPoint.x() - dx) >= MIN_SCROLL_DIFF || + std::abs(currentPoint.y() - dy) >= MIN_SCROLL_DIFF) { + history->saveScrollPositionAndViewStateToItem(history->currentItem()); + } } } |