Title: [126291] trunk
Revision
126291
Author
[email protected]
Date
2012-08-22 05:46:06 -0700 (Wed, 22 Aug 2012)

Log Message

[Qt] Optionally support smooth-scrolling on all platforms
https://bugs.webkit.org/show_bug.cgi?id=74926

Reviewed by Simon Hausmann.

Source/WebCore:

Make GestureAnimations depend on the GESTURE_ANIMATION feature flag,
since GestureAnimations are unused on some platforms.

* Target.pri:
* platform/ScrollAnimatorNone.cpp:
(WebCore::ScrollAnimatorNone::fireUpAnAnimation):
(WebCore::ScrollAnimatorNone::cancelAnimations):
(WebCore::ScrollAnimatorNone::animationTimerFired):
* platform/ScrollAnimatorNone.h:
(ScrollAnimatorNone):

Source/WebKit/qt:

Expose the enable scroll animator setting.

* Api/qwebsettings.cpp:
(QWebSettingsPrivate::apply):
(QWebSettings::QWebSettings):
* Api/qwebsettings.h:

Source/WebKit2:

Expose scroll-animator preference, but ensure animated smooth scrolling
on the web process side is disabled when scrolling has been delegated
to the UI process.

* Shared/WebPreferencesStore.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setResizesToContentsUsingLayoutSize):
(WebKit::WebPage::updatePreferences):

Source/WTF:

Initialize GESTURE_ANIMATION feature flag.

* wtf/Platform.h:

Tools:

Enabled SMOOTH_SCROLLING on Qt, and expose the enable scroll animator
setting in QtTestBrowser so it can be tested.

* QtTestBrowser/launcherwindow.cpp:
(LauncherWindow::createChrome):
(LauncherWindow::toggleScrollAnimator):
* QtTestBrowser/launcherwindow.h:
(WindowOptions::WindowOptions):
(WindowOptions):
(LauncherWindow):
* qmake/mkspecs/features/features.pri:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (126290 => 126291)


--- trunk/Source/WTF/ChangeLog	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WTF/ChangeLog	2012-08-22 12:46:06 UTC (rev 126291)
@@ -1,3 +1,14 @@
+2012-08-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Initialize GESTURE_ANIMATION feature flag.
+
+        * wtf/Platform.h:
+
 2012-08-21  Mark Hahnenberg  <[email protected]>
 
         WTF Threading leaks kernel objects on platforms that use pthreads

Modified: trunk/Source/WTF/wtf/Platform.h (126290 => 126291)


--- trunk/Source/WTF/wtf/Platform.h	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WTF/wtf/Platform.h	2012-08-22 12:46:06 UTC (rev 126291)
@@ -826,6 +826,14 @@
 #endif
 #endif
 
+#if !defined(ENABLE_GESTURE_ANIMATION)
+#if PLATFORM(QT) || !ENABLE(SMOOTH_SCROLLING)
+#define ENABLE_GESTURE_ANIMATION 0
+#else
+#define ENABLE_GESTURE_ANIMATION 1
+#endif
+#endif
+
 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
 #define ENABLE_SAMPLING_COUNTERS 0
 #define ENABLE_SAMPLING_FLAGS 0

Modified: trunk/Source/WebCore/ChangeLog (126290 => 126291)


--- trunk/Source/WebCore/ChangeLog	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebCore/ChangeLog	2012-08-22 12:46:06 UTC (rev 126291)
@@ -1,3 +1,21 @@
+2012-08-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Make GestureAnimations depend on the GESTURE_ANIMATION feature flag,
+        since GestureAnimations are unused on some platforms.
+
+        * Target.pri:
+        * platform/ScrollAnimatorNone.cpp:
+        (WebCore::ScrollAnimatorNone::fireUpAnAnimation):
+        (WebCore::ScrollAnimatorNone::cancelAnimations):
+        (WebCore::ScrollAnimatorNone::animationTimerFired):
+        * platform/ScrollAnimatorNone.h:
+        (ScrollAnimatorNone):
+
 2012-08-22  Simon Hausmann  <[email protected]>
 
         [Qt] Port convertQVariantToValue to use the JSC C API

Modified: trunk/Source/WebCore/Target.pri (126290 => 126291)


--- trunk/Source/WebCore/Target.pri	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebCore/Target.pri	2012-08-22 12:46:06 UTC (rev 126291)
@@ -2794,10 +2794,8 @@
 }
 
 contains(DEFINES, ENABLE_SMOOTH_SCROLLING=1) {
-    win32-*|wince* {
-        HEADERS += platform/ScrollAnimatorNone.h
-        SOURCES += platform/ScrollAnimatorNone.cpp
-    }
+    HEADERS += platform/ScrollAnimatorNone.h
+    SOURCES += platform/ScrollAnimatorNone.cpp
 }
 
 win32-*|wince* {

Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp (126290 => 126291)


--- trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2012-08-22 12:46:06 UTC (rev 126291)
@@ -34,18 +34,22 @@
 
 #include "ScrollAnimatorNone.h"
 
-#include "ActivePlatformGestureAnimation.h"
 #include "FloatPoint.h"
 #include "NotImplemented.h"
 #include <wtf/OwnArrayPtr.h>
 #include "PlatformGestureEvent.h"
 #include "ScrollableArea.h"
 #include "ScrollbarTheme.h"
-#include "TouchpadFlingPlatformGestureCurve.h"
 #include <algorithm>
 #include <wtf/CurrentTime.h>
 #include <wtf/PassOwnPtr.h>
 
+#if ENABLE(GESTURE_ANIMATION)
+#include "ActivePlatformGestureAnimation.h"
+#include "TouchpadFlingPlatformGestureCurve.h"
+#endif
+
+
 #if PLATFORM(CHROMIUM)
 #include "TraceEvent.h"
 #endif
@@ -401,9 +405,11 @@
 
 void ScrollAnimatorNone::fireUpAnAnimation(FloatPoint fp)
 {
+#if ENABLE(GESTURE_ANIMATION)
     if (m_gestureAnimation)
         m_gestureAnimation.clear();
     m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(fp), this);
+#endif
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
     startNextTimer(0);
 #else
@@ -491,7 +497,9 @@
 void ScrollAnimatorNone::cancelAnimations()
 {
     m_animationActive = false;
+#if ENABLE(GESTURE_ANIMATION)
     m_gestureAnimation.clear();
+#endif
 }
 
 void ScrollAnimatorNone::serviceScrollAnimations()
@@ -545,12 +553,14 @@
     if (m_verticalData.m_startTime && m_verticalData.animateScroll(currentTime))
         continueAnimation = true;
 
+#if ENABLE(GESTURE_ANIMATION)
     if (m_gestureAnimation) {
         if (m_gestureAnimation->animate(currentTime))
             continueAnimation = true;
         else
             m_gestureAnimation.clear();
     }
+#endif
 
     if (continueAnimation)
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)

Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.h (126290 => 126291)


--- trunk/Source/WebCore/platform/ScrollAnimatorNone.h	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.h	2012-08-22 12:46:06 UTC (rev 126291)
@@ -173,7 +173,9 @@
     bool m_firstVelocitySet;
     bool m_firstVelocityIsVertical;
 
+#if ENABLE(GESTURE_ANIMATION)
     OwnPtr<ActivePlatformGestureAnimation> m_gestureAnimation;
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/qt/Api/qwebsettings.cpp (126290 => 126291)


--- trunk/Source/WebKit/qt/Api/qwebsettings.cpp	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit/qt/Api/qwebsettings.cpp	2012-08-22 12:46:06 UTC (rev 126291)
@@ -261,6 +261,12 @@
         settings->setTiledBackingStoreEnabled(value);
 #endif
 
+#if ENABLE(SMOOTH_SCROLLING)
+        value = attributes.value(QWebSettings::ScrollAnimatorEnabled,
+                                      global->attributes.value(QWebSettings::ScrollAnimatorEnabled));
+        settings->setEnableScrollAnimator(value);
+#endif
+
         value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled,
                                       global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled));
         settings->setNeedsSiteSpecificQuirks(value);
@@ -473,6 +479,7 @@
         This is disabled by default.
     \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is
         enabled by default.
+    \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default.
 */
 
 /*!
@@ -524,6 +531,7 @@
     d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false);
     d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false);
     d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true);
+    d->attributes.insert(QWebSettings::ScrollAnimatorEnabled, false);
     d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
     d->defaultTextEncoding = QLatin1String("iso-8859-1");
     d->thirdPartyCookiePolicy = AlwaysAllowThirdPartyCookies;

Modified: trunk/Source/WebKit/qt/Api/qwebsettings.h (126290 => 126291)


--- trunk/Source/WebKit/qt/Api/qwebsettings.h	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit/qt/Api/qwebsettings.h	2012-08-22 12:46:06 UTC (rev 126291)
@@ -79,7 +79,8 @@
         WebGLEnabled,
         CSSRegionsEnabled,
         HyperlinkAuditingEnabled,
-        CSSGridLayoutEnabled
+        CSSGridLayoutEnabled,
+        ScrollAnimatorEnabled
     };
     enum WebGraphic {
         MissingImageGraphic,

Modified: trunk/Source/WebKit/qt/ChangeLog (126290 => 126291)


--- trunk/Source/WebKit/qt/ChangeLog	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-08-22 12:46:06 UTC (rev 126291)
@@ -1,3 +1,17 @@
+2012-08-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Expose the enable scroll animator setting.
+
+        * Api/qwebsettings.cpp:
+        (QWebSettingsPrivate::apply):
+        (QWebSettings::QWebSettings):
+        * Api/qwebsettings.h:
+
 2012-08-22  Simon Hausmann  <[email protected]>
 
         [Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails

Modified: trunk/Source/WebKit2/ChangeLog (126290 => 126291)


--- trunk/Source/WebKit2/ChangeLog	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-22 12:46:06 UTC (rev 126291)
@@ -1,3 +1,19 @@
+2012-08-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Expose scroll-animator preference, but ensure animated smooth scrolling
+        on the web process side is disabled when scrolling has been delegated
+        to the UI process.
+
+        * Shared/WebPreferencesStore.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setResizesToContentsUsingLayoutSize):
+        (WebKit::WebPage::updatePreferences):
+
 2012-08-22  Luiz Agostini  <[email protected]>
 
         [Qt] Avoid using WebKit macros in qrawwebview_p.h

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (126290 => 126291)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2012-08-22 12:46:06 UTC (rev 126291)
@@ -119,6 +119,7 @@
     macro(ArtificialPluginInitializationDelayEnabled, artificialPluginInitializationDelayEnabled, Bool, bool, false) \
     macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false) \
     macro(ThirdPartyStorageBlockingEnabled, thirdPartyStorageBlockingEnabled, Bool, bool, false) \
+    macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, false \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (126290 => 126291)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-08-22 12:46:06 UTC (rev 126291)
@@ -902,6 +902,10 @@
     m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true);
     m_page->settings()->setFixedElementsLayoutRelativeToFrame(true);
     m_page->settings()->setFixedPositionCreatesStackingContext(true);
+#if ENABLE(SMOOTH_SCROLLING)
+    // Ensure we don't do animated scrolling in the WebProcess when scrolling is delegated.
+    m_page->settings()->setEnableScrollAnimator(false);
+#endif
 
     // Always reset even when empty. This also takes care of the relayout.
     setFixedLayoutSize(targetLayoutSize);
@@ -2059,6 +2063,9 @@
     settings->setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
     settings->setHyperlinkAuditingEnabled(store.getBoolValueForKey(WebPreferencesKey::hyperlinkAuditingEnabledKey()));
     settings->setRequestAnimationFrameEnabled(store.getBoolValueForKey(WebPreferencesKey::requestAnimationFrameEnabledKey()));
+#if ENABLE(SMOOTH_SCROLLING)
+    settings->setEnableScrollAnimator(store.getBoolValueForKey(WebPreferencesKey::scrollAnimatorEnabledKey()));
+#endif
 
     // <rdar://problem/10697417>: It is necessary to force compositing when accelerate drawing
     // is enabled on Mac so that scrollbars are always in their own layers.

Modified: trunk/Tools/ChangeLog (126290 => 126291)


--- trunk/Tools/ChangeLog	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Tools/ChangeLog	2012-08-22 12:46:06 UTC (rev 126291)
@@ -1,3 +1,22 @@
+2012-08-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Enabled SMOOTH_SCROLLING on Qt, and expose the enable scroll animator
+        setting in QtTestBrowser so it can be tested.
+
+        * QtTestBrowser/launcherwindow.cpp:
+        (LauncherWindow::createChrome):
+        (LauncherWindow::toggleScrollAnimator):
+        * QtTestBrowser/launcherwindow.h:
+        (WindowOptions::WindowOptions):
+        (WindowOptions):
+        (LauncherWindow):
+        * qmake/mkspecs/features/features.pri:
+
 2012-08-22  Dominik Röttsches  <[email protected]>
 
         Unreviewed, adding myself to committers.py.

Modified: trunk/Tools/QtTestBrowser/launcherwindow.cpp (126290 => 126291)


--- trunk/Tools/QtTestBrowser/launcherwindow.cpp	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Tools/QtTestBrowser/launcherwindow.cpp	2012-08-22 12:46:06 UTC (rev 126291)
@@ -469,6 +469,14 @@
     togglePlugins->setCheckable(true);
     togglePlugins->setChecked(false);
 
+    QAction* toggleScrollAnimator = settingsMenu->addAction("Enable Scroll Animator", this, SLOT(toggleScrollAnimator(bool)));
+#if ENABLE(SMOOTH_SCROLLING)
+    toggleScrollAnimator->setCheckable(true);
+#else
+    toggleScrollAnimator->setCheckable(false);
+#endif
+    toggleScrollAnimator->setChecked(false);
+
     QAction* toggleInterruptingJavaScripteEnabled = settingsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
     toggleInterruptingJavaScripteEnabled->setCheckable(true);
     toggleInterruptingJavaScripteEnabled->setChecked(false);
@@ -1085,6 +1093,12 @@
     }
 }
 
+void LauncherWindow::toggleScrollAnimator(bool toggle)
+{
+    m_windowOptions.enableScrollAnimator = toggle;
+    page()->settings()->setAttribute(QWebSettings::ScrollAnimatorEnabled, toggle);
+}
+
 LauncherWindow* LauncherWindow::newWindow()
 {
     LauncherWindow* mw = new LauncherWindow(&m_windowOptions);

Modified: trunk/Tools/QtTestBrowser/launcherwindow.h (126290 => 126291)


--- trunk/Tools/QtTestBrowser/launcherwindow.h	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Tools/QtTestBrowser/launcherwindow.h	2012-08-22 12:46:06 UTC (rev 126291)
@@ -77,6 +77,7 @@
         , useOfflineStorageDatabase(false)
         , useOfflineWebApplicationCache(false)
         , useDiskCookies(true)
+        , enableScrollAnimator(false)
         , offlineStorageDefaultQuotaSize(0)
 #ifndef QT_NO_OPENGL
         , useQGLWidgetViewport(false)
@@ -100,6 +101,7 @@
     bool useOfflineStorageDatabase;
     bool useOfflineWebApplicationCache;
     bool useDiskCookies;
+    bool enableScrollAnimator;
     quint64 offlineStorageDefaultQuotaSize;
 #ifndef QT_NO_OPENGL
     bool useQGLWidgetViewport;
@@ -162,6 +164,7 @@
     void toggleLocalStorage(bool toggle);
     void toggleOfflineStorageDatabase(bool toggle);
     void toggleOfflineWebApplicationCache(bool toggle);
+    void toggleScrollAnimator(bool toggle);
     void setOfflineStorageDefaultQuota();
 #ifndef QT_NO_LINEEDIT
     void showFindBar();

Modified: trunk/Tools/qmake/mkspecs/features/features.pri (126290 => 126291)


--- trunk/Tools/qmake/mkspecs/features/features.pri	2012-08-22 12:26:18 UTC (rev 126290)
+++ trunk/Tools/qmake/mkspecs/features/features.pri	2012-08-22 12:46:06 UTC (rev 126291)
@@ -88,6 +88,7 @@
     ENABLE_SCRIPTED_SPEECH=0 \
     ENABLE_SHADOW_DOM=0 \
     ENABLE_SHARED_WORKERS=1 \
+    ENABLE_SMOOTH_SCROLLING=1 \
     ENABLE_SQL_DATABASE=1 \
     ENABLE_STYLE_SCOPED=0 \
     ENABLE_SVG=1 \
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to