Changeset 89305 in webkit


Ignore:
Timestamp:
Jun 20, 2011 4:16:24 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-20 Scott Byer <scottbyer@chromium.org>

Reviewed by Adam Barth.

Smooth scrolling for Chromium, initial patch.
https://bugs.webkit.org/show_bug.cgi?id=61878

Add in a default scrolling animator in the platform directory, with a run time enable switch, to provide
animated / smooth scrolling on platforms and for input devices where it's not provided by the platform, and to
be easily configurable to what situatuations the animations are provided for. The smooth scrolling code is
compiled out by default.

Unit tests in chromium/ScrollAnimatorNoneTest.cpp

  • WebCore.gypi:
  • page/FrameView.cpp: (WebCore::FrameView::scrollAnimatorEnabled):
  • page/FrameView.h:
  • page/Settings.cpp: (WebCore::Settings::Settings):
  • page/Settings.h: (WebCore::Settings::setEnableScrollAnimator): (WebCore::Settings::scrollAnimatorEnabled):
  • platform/ScrollAnimatorNone.cpp: Added. (WebCore::ScrollAnimator::create): (WebCore::ScrollAnimatorNone::Parameters::Parameters): (WebCore::ScrollAnimatorNone::PerAxisData::curveAt): (WebCore::ScrollAnimatorNone::PerAxisData::attackCurve): (WebCore::ScrollAnimatorNone::PerAxisData::releaseCurve): (WebCore::ScrollAnimatorNone::PerAxisData::curveDerivativeAt): (WebCore::ScrollAnimatorNone::PerAxisData::PerAxisData): (WebCore::ScrollAnimatorNone::PerAxisData::reset): (WebCore::ScrollAnimatorNone::PerAxisData::updateDataFromParameters): (WebCore::ScrollAnimatorNone::PerAxisData::animateScroll): (WebCore::ScrollAnimatorNone::ScrollAnimatorNone): (WebCore::ScrollAnimatorNone::~ScrollAnimatorNone): (WebCore::ScrollAnimatorNone::scroll): (WebCore::ScrollAnimatorNone::scrollToOffsetWithoutAnimation): (WebCore::ScrollAnimatorNone::animationTimerFired): (WebCore::ScrollAnimatorNone::stopAnimationTimerIfNeeded):
  • platform/ScrollAnimatorNone.h: Added.
  • platform/ScrollableArea.h: (WebCore::ScrollableArea::scrollAnimatorEnabled):

2011-06-20 Scott Byer <scottbyer@chromium.org>

Reviewed by Adam Barth.

Smooth scrolling for Chromium, initial patch.
https://bugs.webkit.org/show_bug.cgi?id=61878

Add in a default scrolling animator in the platform directory, with a run time enable switch, to provide
animated / smooth scrolling on platforms and for input devices where it's not provided by the platform, and to
be easily configurable to what situatuations the animations are provided for. The smooth scrolling code is
compiled out by default.

Unit tests ScrollAnimatorNoneTest.cpp

  • WebKit.gypi:
  • features.gypi:
  • public/WebSettings.h:
  • src/WebSettingsImpl.cpp: (WebKit::WebSettingsImpl::setEnableScrollAnimator):
  • src/WebSettingsImpl.h:
  • tests/ScrollAnimatorNoneTest.cpp: Added. (MockScrollableArea::MockScrollableArea): (MockScrollableArea::scrollAnimatorEnabled): (MockScrollAnimatorNone::MockScrollAnimatorNone): (MockScrollAnimatorNone::currentX): (MockScrollAnimatorNone::currentY): (MockScrollAnimatorNone::reset): (TEST): (ScrollAnimatorNoneTest::ScrollAnimatorNoneTest): (ScrollAnimatorNoneTest::SetUp): (ScrollAnimatorNoneTest::TearDown): (ScrollAnimatorNoneTest::reset): (ScrollAnimatorNoneTest::updateDataFromParameters): (ScrollAnimatorNoneTest::animateScroll): (ScrollAnimatorNoneTest::curveIntegralAt): (ScrollAnimatorNoneTest::attackArea): (ScrollAnimatorNoneTest::releaseArea): (ScrollAnimatorNoneTest::attackCurve): (ScrollAnimatorNoneTest::releaseCurve): (ScrollAnimatorNoneTest::curveDerivativeAt): (ScrollAnimatorNoneTest::curveTestInner): (ScrollAnimatorNoneTest::curveTest): (TEST_F):
Location:
trunk/Source
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89304 r89305  
     12011-06-20  Scott Byer  <scottbyer@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Smooth scrolling for Chromium, initial patch.
     6        https://bugs.webkit.org/show_bug.cgi?id=61878
     7
     8        Add in a default scrolling animator in the platform directory, with a run time enable switch, to provide
     9        animated / smooth scrolling on platforms and for input devices where it's not provided by the platform, and to
     10        be easily configurable to what situatuations the animations are provided for. The smooth scrolling code is
     11        compiled out by default.
     12
     13        Unit tests in chromium/ScrollAnimatorNoneTest.cpp
     14
     15        * WebCore.gypi:
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::scrollAnimatorEnabled):
     18        * page/FrameView.h:
     19        * page/Settings.cpp:
     20        (WebCore::Settings::Settings):
     21        * page/Settings.h:
     22        (WebCore::Settings::setEnableScrollAnimator):
     23        (WebCore::Settings::scrollAnimatorEnabled):
     24        * platform/ScrollAnimatorNone.cpp: Added.
     25        (WebCore::ScrollAnimator::create):
     26        (WebCore::ScrollAnimatorNone::Parameters::Parameters):
     27        (WebCore::ScrollAnimatorNone::PerAxisData::curveAt):
     28        (WebCore::ScrollAnimatorNone::PerAxisData::attackCurve):
     29        (WebCore::ScrollAnimatorNone::PerAxisData::releaseCurve):
     30        (WebCore::ScrollAnimatorNone::PerAxisData::curveDerivativeAt):
     31        (WebCore::ScrollAnimatorNone::PerAxisData::PerAxisData):
     32        (WebCore::ScrollAnimatorNone::PerAxisData::reset):
     33        (WebCore::ScrollAnimatorNone::PerAxisData::updateDataFromParameters):
     34        (WebCore::ScrollAnimatorNone::PerAxisData::animateScroll):
     35        (WebCore::ScrollAnimatorNone::ScrollAnimatorNone):
     36        (WebCore::ScrollAnimatorNone::~ScrollAnimatorNone):
     37        (WebCore::ScrollAnimatorNone::scroll):
     38        (WebCore::ScrollAnimatorNone::scrollToOffsetWithoutAnimation):
     39        (WebCore::ScrollAnimatorNone::animationTimerFired):
     40        (WebCore::ScrollAnimatorNone::stopAnimationTimerIfNeeded):
     41        * platform/ScrollAnimatorNone.h: Added.
     42        * platform/ScrollableArea.h:
     43        (WebCore::ScrollableArea::scrollAnimatorEnabled):
     44
    1452011-06-20  Julien Chaffraix  <jchaffraix@webkit.org>
    246
  • trunk/Source/WebCore/WebCore.gypi

    r89266 r89305  
    36593659            'platform/ScrollAnimator.cpp',
    36603660            'platform/ScrollAnimator.h',
     3661            'platform/ScrollAnimatorNone.cpp',
     3662            'platform/ScrollAnimatorNone.h',
    36613663            'platform/ScrollAnimatorWin.cpp',
    36623664            'platform/ScrollAnimatorWin.h',
  • trunk/Source/WebCore/page/FrameView.cpp

    r88982 r89305  
    22722272}
    22732273
     2274bool FrameView::scrollAnimatorEnabled() const
     2275{
     2276#if ENABLE(SMOOTH_SCROLLING)
     2277    if (m_page && m_page->settings())
     2278        return m_page->settings()->scrollAnimatorEnabled();
     2279#endif
     2280    return false;
     2281}
     2282
    22742283#if ENABLE(DASHBOARD_SUPPORT)
    22752284void FrameView::updateDashboardRegions()
  • trunk/Source/WebCore/page/FrameView.h

    r88982 r89305  
    339339    virtual void disconnectFromPage() { m_page = 0; }
    340340
     341    virtual bool scrollAnimatorEnabled() const;
     342
    341343    void deferredRepaintTimerFired(Timer<FrameView>*);
    342344    void doDeferredRepaints();
  • trunk/Source/WebCore/page/Settings.cpp

    r87329 r89305  
    182182    , m_allowDisplayOfInsecureContent(true)
    183183    , m_allowRunningOfInsecureContent(true)
     184#if ENABLE(SMOOTH_SCROLLING)
     185    , m_scrollAnimatorEnabled(false)
     186#endif
    184187    , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
    185188{
  • trunk/Source/WebCore/page/Settings.h

    r87329 r89305  
    405405        void setAllowRunningOfInsecureContent(bool flag) { m_allowRunningOfInsecureContent = flag; }
    406406        bool allowRunningOfInsecureContent() const { return m_allowRunningOfInsecureContent; }
     407
     408#if ENABLE(SMOOTH_SCROLLING)
     409        void setEnableScrollAnimator(bool flag) { m_scrollAnimatorEnabled = flag; }
     410        bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
     411#endif
    407412
    408413    private:
     
    511516        bool m_allowDisplayOfInsecureContent : 1;
    512517        bool m_allowRunningOfInsecureContent : 1;
     518#if ENABLE(SMOOTH_SCROLLING)
     519        bool m_scrollAnimatorEnabled : 1;
     520#endif
    513521
    514522        Timer<Settings> m_loadsImagesAutomaticallyTimer;
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r88982 r89305  
    147147    virtual void disconnectFromPage() { }
    148148
     149    virtual bool scrollAnimatorEnabled() const { return false; }
     150
    149151private:
    150152    // NOTE: Only called from the ScrollAnimator.
  • trunk/Source/WebKit/chromium/ChangeLog

    r89260 r89305  
     12011-06-20  Scott Byer  <scottbyer@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Smooth scrolling for Chromium, initial patch.
     6        https://bugs.webkit.org/show_bug.cgi?id=61878
     7
     8        Add in a default scrolling animator in the platform directory, with a run time enable switch, to provide
     9        animated / smooth scrolling on platforms and for input devices where it's not provided by the platform, and to
     10        be easily configurable to what situatuations the animations are provided for. The smooth scrolling code is
     11        compiled out by default.
     12
     13        Unit tests ScrollAnimatorNoneTest.cpp
     14
     15        * WebKit.gypi:
     16        * features.gypi:
     17        * public/WebSettings.h:
     18        * src/WebSettingsImpl.cpp:
     19        (WebKit::WebSettingsImpl::setEnableScrollAnimator):
     20        * src/WebSettingsImpl.h:
     21        * tests/ScrollAnimatorNoneTest.cpp: Added.
     22        (MockScrollableArea::MockScrollableArea):
     23        (MockScrollableArea::scrollAnimatorEnabled):
     24        (MockScrollAnimatorNone::MockScrollAnimatorNone):
     25        (MockScrollAnimatorNone::currentX):
     26        (MockScrollAnimatorNone::currentY):
     27        (MockScrollAnimatorNone::reset):
     28        (TEST):
     29        (ScrollAnimatorNoneTest::ScrollAnimatorNoneTest):
     30        (ScrollAnimatorNoneTest::SetUp):
     31        (ScrollAnimatorNoneTest::TearDown):
     32        (ScrollAnimatorNoneTest::reset):
     33        (ScrollAnimatorNoneTest::updateDataFromParameters):
     34        (ScrollAnimatorNoneTest::animateScroll):
     35        (ScrollAnimatorNoneTest::curveIntegralAt):
     36        (ScrollAnimatorNoneTest::attackArea):
     37        (ScrollAnimatorNoneTest::releaseArea):
     38        (ScrollAnimatorNoneTest::attackCurve):
     39        (ScrollAnimatorNoneTest::releaseCurve):
     40        (ScrollAnimatorNoneTest::curveDerivativeAt):
     41        (ScrollAnimatorNoneTest::curveTestInner):
     42        (ScrollAnimatorNoneTest::curveTest):
     43        (TEST_F):
     44
    1452011-06-20  Adam Barth  <abarth@webkit.org>
    246
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r89089 r89305  
    6666            'tests/PODIntervalTreeTest.cpp',
    6767            'tests/PODRedBlackTreeTest.cpp',
     68            'tests/ScrollAnimatorNoneTest.cpp',
    6869            'tests/TilingDataTest.cpp',
    6970            'tests/TreeSynchronizerTest.cpp',
  • trunk/Source/WebKit/chromium/features.gypi

    r89188 r89305  
    108108      'use_skia_gpu%': 0,
    109109      'enable_touch_icon_loading%' : 0,
     110      'enable_smooth_scrolling%': 0,
    110111    },
    111112    'use_accelerated_compositing%': '<(use_accelerated_compositing)',
     
    113114    'enable_svg%': '<(enable_svg)',
    114115    'enable_touch_events%': '<(enable_touch_events)',
     116    'enable_smooth_scrolling%': '<(enable_smooth_scrolling)',
    115117    'conditions': [
    116118      ['use_accelerated_compositing==1', {
     
    152154        ],
    153155      }],
     156      ['enable_smooth_scrolling==1', {
     157        'feature_defines': [
     158          'ENABLE_SMOOTH_SCROLLING=1',
     159        ],
     160      }],
    154161    ],
    155162  },
  • trunk/Source/WebKit/chromium/public/WebSettings.h

    r88728 r89305  
    125125    virtual void setAllowRunningOfInsecureContent(bool) = 0;
    126126    virtual void setShouldPrintBackgrounds(bool) = 0;
     127    virtual void setEnableScrollAnimator(bool) = 0;
    127128
    128129protected:
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp

    r88728 r89305  
    423423}
    424424
     425void WebSettingsImpl::setEnableScrollAnimator(bool enabled)
     426{
     427#if ENABLE(SMOOTH_SCROLLING)
     428    m_settings->setEnableScrollAnimator(enabled);
     429#else
     430    UNUSED_PARAM(enabled);
     431#endif
     432}
     433
    425434} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.h

    r88728 r89305  
    118118    virtual void setAllowRunningOfInsecureContent(bool);
    119119    virtual void setShouldPrintBackgrounds(bool);
     120    virtual void setEnableScrollAnimator(bool);
    120121
    121122private:
Note: See TracChangeset for help on using the changeset viewer.