Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.h

Issue 1738243002: Removed main-thread one dimensional scrolling paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeStepFromUserScroll
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class Scrollbar; 47 class Scrollbar;
48 48
49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi nator { 49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi nator {
50 public: 50 public:
51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); 51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*);
52 52
53 virtual ~ScrollAnimatorBase(); 53 virtual ~ScrollAnimatorBase();
54 54
55 virtual void dispose() { } 55 virtual void dispose() { }
56 56
57 // Computes a scroll destination for the given parameters. The returned 57 // A possibly animated scroll. The base class implementation always scrolls
58 // ScrollResultOneDimensional will have didScroll set to false if already at 58 // immediately, never animates. If the scroll is animated and currently the
59 // the destination. Otherwise, starts scrolling towards the destination and 59 // animator has an in-progress animation, the ScrollResult will always retur n
60 // didScroll is true. Scrolling may be immediate or animated. The base 60 // no unusedDelta and didScroll=true, i.e. fully consuming the scroll reques t.
61 // class implementation always scrolls immediately, never animates. 61 // This makes animations latch to a single scroller. Note, the semantics are
62 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr anularity, float delta); 62 // currently somewhat different on Mac - see ScrollAnimatorMac.mm.
63 virtual ScrollResult userScroll(ScrollGranularity, const FloatSize& delta);
63 64
64 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); 65 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
65 66
66 #if OS(MACOSX) 67 #if OS(MACOSX)
67 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { } 68 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { }
68 #endif 69 #endif
69 70
70 void setCurrentPosition(const FloatPoint&); 71 void setCurrentPosition(const FloatPoint&);
71 FloatPoint currentPosition() const; 72 FloatPoint currentPosition() const;
72 virtual FloatPoint desiredTargetPosition() const { return currentPosition(); } 73 virtual FloatPoint desiredTargetPosition() const { return currentPosition(); }
73 74
74 // Returns how much of pixelDelta will be used by the underlying scrollable 75 // Returns how much of pixelDelta will be used by the underlying scrollable
75 // area. 76 // area.
76 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const; 77 virtual FloatSize computeDeltaToConsume(const FloatSize& delta) const;
77 78
78 79
79 // ScrollAnimatorCompositorCoordinator implementation. 80 // ScrollAnimatorCompositorCoordinator implementation.
80 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } 81 ScrollableArea* scrollableArea() const override { return m_scrollableArea; }
81 void tickAnimation(double monotonicTime) override { }; 82 void tickAnimation(double monotonicTime) override { };
82 void cancelAnimation() override { } 83 void cancelAnimation() override { }
83 void updateCompositorAnimations() override { }; 84 void updateCompositorAnimations() override { };
84 void notifyCompositorAnimationFinished(int groupId) override { }; 85 void notifyCompositorAnimationFinished(int groupId) override { };
85 void notifyCompositorAnimationAborted(int groupId) override { }; 86 void notifyCompositorAnimationAborted(int groupId) override { };
86 void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) over ride { }; 87 void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) over ride { };
(...skipping 24 matching lines...) Expand all
111 112
112 virtual bool setScrollbarsVisibleForTesting(bool) { return false; } 113 virtual bool setScrollbarsVisibleForTesting(bool) { return false; }
113 114
114 DECLARE_VIRTUAL_TRACE(); 115 DECLARE_VIRTUAL_TRACE();
115 116
116 protected: 117 protected:
117 explicit ScrollAnimatorBase(ScrollableArea*); 118 explicit ScrollAnimatorBase(ScrollableArea*);
118 119
119 virtual void notifyPositionChanged(); 120 virtual void notifyPositionChanged();
120 121
121 float clampScrollPosition(ScrollbarOrientation, float) const; 122 RawPtrWillBeMember<ScrollableArea> m_scrollableArea;
122 123
123 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; 124 FloatPoint m_currentPos;
124 float m_currentPosX; // We avoid using a FloatPoint in order to reduce
125 float m_currentPosY; // subclass code complexity.
126 }; 125 };
127 126
128 } // namespace blink 127 } // namespace blink
129 128
130 #endif // ScrollAnimatorBase_h 129 #endif // ScrollAnimatorBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698