Skip to content
Permalink
Browse files
[GTK][EFL] Rename ScrollAnimationNone as ScrollAnimationSmooth
https://bugs.webkit.org/show_bug.cgi?id=153481

Reviewed by Simon Fraser.

ScrollAnimationNone has always been used by EFL and GTK ports to
implement smooth scrolling. I think it should be possible for
other scroll animators to implement smooth scrolling or even
implement other kind of scroll animations. For example, in the
future I would like to have kinetic scrolling implemented for the
GTK+ port to match all other GTK+ application and decide at
runtime between different animations without having to use a
different scroll animator class. So, this patch also moves the
smooth scrolling animation implementation to its own class
ScrollAnimationSmooth that impements an interface ScrollAnimation
that could be used to implement other animations. This will allow
the GTK+ port to add its own scroll animator class and still
support smooth scrolling sharing the code with the
ScrollAnimationSmooth.

* PlatformEfl.cmake: Add new files to compilation and remove ScrollAnimationNone.
* PlatformGTK.cmake: Ditto.
* platform/ScrollAnimation.h: Added.
(WebCore::ScrollAnimation::serviceAnimation):
(WebCore::ScrollAnimation::ScrollAnimation):
* platform/ScrollAnimationSmooth.cpp: Added.
(WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
(WebCore::ScrollAnimationSmooth::scroll):
(WebCore::ScrollAnimationSmooth::stop):
(WebCore::ScrollAnimationSmooth::updateVisibleLengths):
(WebCore::ScrollAnimationSmooth::setCurrentPosition):
(WebCore::ScrollAnimationSmooth::serviceAnimation):
(WebCore::ScrollAnimationSmooth::~ScrollAnimationSmooth):
(WebCore::curveAt):
(WebCore::attackCurve):
(WebCore::releaseCurve):
(WebCore::coastCurve):
(WebCore::curveIntegralAt):
(WebCore::attackArea):
(WebCore::releaseArea):
(WebCore::getAnimationParametersForGranularity):
(WebCore::ScrollAnimationSmooth::updatePerAxisData):
(WebCore::ScrollAnimationSmooth::animateScroll):
(WebCore::ScrollAnimationSmooth::animationTimerFired):
(WebCore::ScrollAnimationSmooth::startNextTimer):
(WebCore::ScrollAnimationSmooth::animationTimerActive):
* platform/ScrollAnimationSmooth.h: Added.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimator::setCurrentPosition):
(WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset):
(WebCore::ScrollAnimator::notifyPositionChanged):
(WebCore::ScrollAnimator::scrollOffsetOnAxis):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::currentPosition):
* platform/ScrollAnimatorNone.cpp: Removed.
* platform/ScrollAnimatorNone.h: Removed.
* platform/ScrollAnimatorSmooth.cpp: Added.
(WebCore::ScrollAnimator::create):
(WebCore::ScrollAnimatorSmooth::ScrollAnimatorSmooth):
(WebCore::ScrollAnimatorSmooth::~ScrollAnimatorSmooth):
(WebCore::ScrollAnimatorSmooth::scroll):
(WebCore::ScrollAnimatorSmooth::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimatorSmooth::cancelAnimations):
(WebCore::ScrollAnimatorSmooth::serviceScrollAnimations):
(WebCore::ScrollAnimatorSmooth::willEndLiveResize):
(WebCore::ScrollAnimatorSmooth::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorSmooth::didAddHorizontalScrollbar):
* platform/ScrollAnimatorSmooth.h: Added.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::immediateScrollToPosition):
(WebCore::ScrollAnimatorMac::immediateScrollBy):

Canonical link: https://commits.webkit.org/171608@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jan 27, 2016
1 parent fb0bdf1 commit cebf3073028510dc33473fb2ac553dcb034e9bb0
Showing 13 changed files with 896 additions and 760 deletions.
@@ -1,3 +1,79 @@
2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK][EFL] Rename ScrollAnimationNone as ScrollAnimationSmooth
https://bugs.webkit.org/show_bug.cgi?id=153481

Reviewed by Simon Fraser.

ScrollAnimationNone has always been used by EFL and GTK ports to
implement smooth scrolling. I think it should be possible for
other scroll animators to implement smooth scrolling or even
implement other kind of scroll animations. For example, in the
future I would like to have kinetic scrolling implemented for the
GTK+ port to match all other GTK+ application and decide at
runtime between different animations without having to use a
different scroll animator class. So, this patch also moves the
smooth scrolling animation implementation to its own class
ScrollAnimationSmooth that impements an interface ScrollAnimation
that could be used to implement other animations. This will allow
the GTK+ port to add its own scroll animator class and still
support smooth scrolling sharing the code with the
ScrollAnimationSmooth.

* PlatformEfl.cmake: Add new files to compilation and remove ScrollAnimationNone.
* PlatformGTK.cmake: Ditto.
* platform/ScrollAnimation.h: Added.
(WebCore::ScrollAnimation::serviceAnimation):
(WebCore::ScrollAnimation::ScrollAnimation):
* platform/ScrollAnimationSmooth.cpp: Added.
(WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
(WebCore::ScrollAnimationSmooth::scroll):
(WebCore::ScrollAnimationSmooth::stop):
(WebCore::ScrollAnimationSmooth::updateVisibleLengths):
(WebCore::ScrollAnimationSmooth::setCurrentPosition):
(WebCore::ScrollAnimationSmooth::serviceAnimation):
(WebCore::ScrollAnimationSmooth::~ScrollAnimationSmooth):
(WebCore::curveAt):
(WebCore::attackCurve):
(WebCore::releaseCurve):
(WebCore::coastCurve):
(WebCore::curveIntegralAt):
(WebCore::attackArea):
(WebCore::releaseArea):
(WebCore::getAnimationParametersForGranularity):
(WebCore::ScrollAnimationSmooth::updatePerAxisData):
(WebCore::ScrollAnimationSmooth::animateScroll):
(WebCore::ScrollAnimationSmooth::animationTimerFired):
(WebCore::ScrollAnimationSmooth::startNextTimer):
(WebCore::ScrollAnimationSmooth::animationTimerActive):
* platform/ScrollAnimationSmooth.h: Added.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimator::setCurrentPosition):
(WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset):
(WebCore::ScrollAnimator::notifyPositionChanged):
(WebCore::ScrollAnimator::scrollOffsetOnAxis):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::currentPosition):
* platform/ScrollAnimatorNone.cpp: Removed.
* platform/ScrollAnimatorNone.h: Removed.
* platform/ScrollAnimatorSmooth.cpp: Added.
(WebCore::ScrollAnimator::create):
(WebCore::ScrollAnimatorSmooth::ScrollAnimatorSmooth):
(WebCore::ScrollAnimatorSmooth::~ScrollAnimatorSmooth):
(WebCore::ScrollAnimatorSmooth::scroll):
(WebCore::ScrollAnimatorSmooth::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimatorSmooth::cancelAnimations):
(WebCore::ScrollAnimatorSmooth::serviceScrollAnimations):
(WebCore::ScrollAnimatorSmooth::willEndLiveResize):
(WebCore::ScrollAnimatorSmooth::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorSmooth::didAddHorizontalScrollbar):
* platform/ScrollAnimatorSmooth.h: Added.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::immediateScrollToPosition):
(WebCore::ScrollAnimatorMac::immediateScrollBy):

2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com>

Overlay scrollbars should always use the whole contents
@@ -517,7 +517,8 @@ endif ()

if (ENABLE_SMOOTH_SCROLLING)
list(APPEND WebCore_SOURCES
platform/ScrollAnimatorNone.cpp
platform/ScrollAnimationSmooth.cpp
platform/ScrollAnimatorSmooth.cpp
)
endif ()

@@ -935,7 +935,8 @@ set(GObjectDOMBindings_GIR_HEADERS ${GObjectDOMBindings_GIR_HEADERS} PARENT_SCOP

if (ENABLE_SMOOTH_SCROLLING)
list(APPEND WebCore_SOURCES
platform/ScrollAnimatorNone.cpp
platform/ScrollAnimationSmooth.cpp
platform/ScrollAnimatorSmooth.cpp
)
endif ()

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2016 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef ScrollAnimation_h
#define ScrollAnimation_h

#include "ScrollTypes.h"

namespace WebCore {

class FloatPoint;
class ScrollableArea;

class ScrollAnimation {
public:
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) = 0;
virtual void stop() = 0;
virtual void updateVisibleLengths() = 0;
virtual void setCurrentPosition(const FloatPoint&) = 0;
virtual void serviceAnimation() { };

protected:
ScrollAnimation(ScrollableArea& scrollableArea)
: m_scrollableArea(scrollableArea)
{
}

ScrollableArea& m_scrollableArea;
};

} // namespace WebCore

#endif // ScrollAnimation_h

0 comments on commit cebf307

Please sign in to comment.