Changeset 195661 in webkit
- Timestamp:
- Jan 27, 2016 2:32:59 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195660 r195661 1 2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][EFL] Rename ScrollAnimationNone as ScrollAnimationSmooth 4 https://bugs.webkit.org/show_bug.cgi?id=153481 5 6 Reviewed by Simon Fraser. 7 8 ScrollAnimationNone has always been used by EFL and GTK ports to 9 implement smooth scrolling. I think it should be possible for 10 other scroll animators to implement smooth scrolling or even 11 implement other kind of scroll animations. For example, in the 12 future I would like to have kinetic scrolling implemented for the 13 GTK+ port to match all other GTK+ application and decide at 14 runtime between different animations without having to use a 15 different scroll animator class. So, this patch also moves the 16 smooth scrolling animation implementation to its own class 17 ScrollAnimationSmooth that impements an interface ScrollAnimation 18 that could be used to implement other animations. This will allow 19 the GTK+ port to add its own scroll animator class and still 20 support smooth scrolling sharing the code with the 21 ScrollAnimationSmooth. 22 23 * PlatformEfl.cmake: Add new files to compilation and remove ScrollAnimationNone. 24 * PlatformGTK.cmake: Ditto. 25 * platform/ScrollAnimation.h: Added. 26 (WebCore::ScrollAnimation::serviceAnimation): 27 (WebCore::ScrollAnimation::ScrollAnimation): 28 * platform/ScrollAnimationSmooth.cpp: Added. 29 (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth): 30 (WebCore::ScrollAnimationSmooth::scroll): 31 (WebCore::ScrollAnimationSmooth::stop): 32 (WebCore::ScrollAnimationSmooth::updateVisibleLengths): 33 (WebCore::ScrollAnimationSmooth::setCurrentPosition): 34 (WebCore::ScrollAnimationSmooth::serviceAnimation): 35 (WebCore::ScrollAnimationSmooth::~ScrollAnimationSmooth): 36 (WebCore::curveAt): 37 (WebCore::attackCurve): 38 (WebCore::releaseCurve): 39 (WebCore::coastCurve): 40 (WebCore::curveIntegralAt): 41 (WebCore::attackArea): 42 (WebCore::releaseArea): 43 (WebCore::getAnimationParametersForGranularity): 44 (WebCore::ScrollAnimationSmooth::updatePerAxisData): 45 (WebCore::ScrollAnimationSmooth::animateScroll): 46 (WebCore::ScrollAnimationSmooth::animationTimerFired): 47 (WebCore::ScrollAnimationSmooth::startNextTimer): 48 (WebCore::ScrollAnimationSmooth::animationTimerActive): 49 * platform/ScrollAnimationSmooth.h: Added. 50 * platform/ScrollAnimator.cpp: 51 (WebCore::ScrollAnimator::scroll): 52 (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): 53 (WebCore::ScrollAnimator::setCurrentPosition): 54 (WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): 55 (WebCore::ScrollAnimator::notifyPositionChanged): 56 (WebCore::ScrollAnimator::scrollOffsetOnAxis): 57 * platform/ScrollAnimator.h: 58 (WebCore::ScrollAnimator::ScrollAnimator::currentPosition): 59 * platform/ScrollAnimatorNone.cpp: Removed. 60 * platform/ScrollAnimatorNone.h: Removed. 61 * platform/ScrollAnimatorSmooth.cpp: Added. 62 (WebCore::ScrollAnimator::create): 63 (WebCore::ScrollAnimatorSmooth::ScrollAnimatorSmooth): 64 (WebCore::ScrollAnimatorSmooth::~ScrollAnimatorSmooth): 65 (WebCore::ScrollAnimatorSmooth::scroll): 66 (WebCore::ScrollAnimatorSmooth::scrollToOffsetWithoutAnimation): 67 (WebCore::ScrollAnimatorSmooth::cancelAnimations): 68 (WebCore::ScrollAnimatorSmooth::serviceScrollAnimations): 69 (WebCore::ScrollAnimatorSmooth::willEndLiveResize): 70 (WebCore::ScrollAnimatorSmooth::didAddVerticalScrollbar): 71 (WebCore::ScrollAnimatorSmooth::didAddHorizontalScrollbar): 72 * platform/ScrollAnimatorSmooth.h: Added. 73 * platform/mac/ScrollAnimatorMac.mm: 74 (WebCore::ScrollAnimatorMac::immediateScrollToPosition): 75 (WebCore::ScrollAnimatorMac::immediateScrollBy): 76 1 77 2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 78 -
trunk/Source/WebCore/PlatformEfl.cmake
r194586 r195661 518 518 if (ENABLE_SMOOTH_SCROLLING) 519 519 list(APPEND WebCore_SOURCES 520 platform/ScrollAnimatorNone.cpp 520 platform/ScrollAnimationSmooth.cpp 521 platform/ScrollAnimatorSmooth.cpp 521 522 ) 522 523 endif () -
trunk/Source/WebCore/PlatformGTK.cmake
r194586 r195661 936 936 if (ENABLE_SMOOTH_SCROLLING) 937 937 list(APPEND WebCore_SOURCES 938 platform/ScrollAnimatorNone.cpp 938 platform/ScrollAnimationSmooth.cpp 939 platform/ScrollAnimatorSmooth.cpp 939 940 ) 940 941 endif () -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r194516 r195661 73 73 return false; 74 74 75 setCurrentPositionInternal(newPosition);75 m_currentPosition = newPosition; 76 76 notifyPositionChanged(newPosition - currentPosition); 77 77 return true; … … 82 82 FloatPoint newPositon = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); 83 83 FloatSize delta = newPositon - currentPosition(); 84 setCurrentPositionInternal(newPositon);84 m_currentPosition = newPositon; 85 85 notifyPositionChanged(delta); 86 86 updateActiveScrollSnapIndexForOffset(); … … 173 173 void ScrollAnimator::setCurrentPosition(const FloatPoint& position) 174 174 { 175 setCurrentPositionInternal(position);175 m_currentPosition = position; 176 176 updateActiveScrollSnapIndexForOffset(); 177 177 } … … 181 181 #if ENABLE(CSS_SCROLL_SNAP) 182 182 // FIXME: Needs offset/position disambiguation. 183 m_scrollController.setActiveScrollSnapIndicesForOffset(m_currentPos X, m_currentPosY);183 m_scrollController.setActiveScrollSnapIndicesForOffset(m_currentPosition.x(), m_currentPosition.y()); 184 184 if (m_scrollController.activeScrollSnapIndexDidChange()) { 185 185 m_scrollableArea.setCurrentHorizontalSnapPointIndex(m_scrollController.activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal)); … … 204 204 LayoutUnit ScrollAnimator::scrollOffsetOnAxis(ScrollEventAxis axis) const 205 205 { 206 return axis == ScrollEventAxis::Horizontal ? m_currentPos X : m_currentPosY;206 return axis == ScrollEventAxis::Horizontal ? m_currentPosition.x() : m_currentPosition.y(); 207 207 } 208 208 -
trunk/Source/WebCore/platform/ScrollAnimator.h
r194516 r195661 86 86 87 87 void setCurrentPosition(const FloatPoint&); 88 FloatPoint currentPosition() const { return FloatPoint(m_currentPosX, m_currentPosY); }88 const FloatPoint& currentPosition() const { return m_currentPosition; } 89 89 90 90 virtual void cancelAnimations() { } … … 146 146 void updateActiveScrollSnapIndexForOffset(); 147 147 148 void setCurrentPositionInternal(const FloatPoint& p)149 {150 m_currentPosX = p.x();151 m_currentPosY = p.y();152 }153 154 148 ScrollableArea& m_scrollableArea; 155 149 RefPtr<WheelEventTestTrigger> m_wheelEventTestTrigger; … … 157 151 ScrollController m_scrollController; 158 152 #endif 159 float m_currentPosX { 0 }; // ScrollAnimatorNone takes addresses of these, so can't use a FloatPoint. 160 float m_currentPosY { 0 }; 153 FloatPoint m_currentPosition; 161 154 }; 162 155 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r194516 r195661 764 764 765 765 FloatSize delta = adjustedPosition - currentPosition; 766 setCurrentPositionInternal(adjustedPosition);766 m_currentPosition = adjustedPosition; 767 767 notifyPositionChanged(delta); 768 768 updateActiveScrollSnapIndexForOffset(); … … 1305 1305 1306 1306 FloatSize adjustedDelta = newPosition - currentPosition; 1307 setCurrentPositionInternal(newPosition);1307 m_currentPosition = newPosition; 1308 1308 notifyPositionChanged(adjustedDelta); 1309 1309 updateActiveScrollSnapIndexForOffset();
Note: See TracChangeset
for help on using the changeset viewer.