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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp

Issue 1648293003: Fix smooth scroll jump when switching scroll handling between MT and CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo + nit Created 4 years, 10 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" 5 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsLayer.h" 8 #include "platform/graphics/GraphicsLayer.h"
9 #include "platform/scroll/ScrollableArea.h" 9 #include "platform/scroll/ScrollableArea.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 case RunState::RunningOnCompositor: 143 case RunState::RunningOnCompositor:
144 case RunState::RunningOnCompositorButNeedsUpdate: 144 case RunState::RunningOnCompositorButNeedsUpdate:
145 case RunState::WaitingToCancelOnCompositor: 145 case RunState::WaitingToCancelOnCompositor:
146 m_runState = RunState::PostAnimationCleanup; 146 m_runState = RunState::PostAnimationCleanup;
147 147
148 // Get serviced the next time compositor updates are allowed. 148 // Get serviced the next time compositor updates are allowed.
149 scrollableArea()->registerForAnimation(); 149 scrollableArea()->registerForAnimation();
150 } 150 }
151 } 151 }
152 152
153 void ScrollAnimatorCompositorCoordinator::reattachCompositorPlayerIfNeeded( 153 bool ScrollAnimatorCompositorCoordinator::reattachCompositorPlayerIfNeeded(
154 WebCompositorAnimationTimeline* timeline) 154 WebCompositorAnimationTimeline* timeline)
155 { 155 {
156 bool reattached = false;
156 int compositorAnimationAttachedToLayerId = 0; 157 int compositorAnimationAttachedToLayerId = 0;
157 if (scrollableArea()->layerForScrolling()) 158 if (scrollableArea()->layerForScrolling())
158 compositorAnimationAttachedToLayerId = scrollableArea()->layerForScrolli ng()->platformLayer()->id(); 159 compositorAnimationAttachedToLayerId = scrollableArea()->layerForScrolli ng()->platformLayer()->id();
159 160
160 if (compositorAnimationAttachedToLayerId != m_compositorAnimationAttachedToL ayerId) { 161 if (compositorAnimationAttachedToLayerId != m_compositorAnimationAttachedToL ayerId) {
161 if (m_compositorPlayer && timeline) { 162 if (m_compositorPlayer && timeline) {
162 // Detach from old layer (if any). 163 // Detach from old layer (if any).
163 if (m_compositorAnimationAttachedToLayerId) { 164 if (m_compositorAnimationAttachedToLayerId) {
164 if (m_compositorPlayer->isLayerAttached()) 165 if (m_compositorPlayer->isLayerAttached())
165 m_compositorPlayer->detachLayer(); 166 m_compositorPlayer->detachLayer();
166 timeline->playerDestroyed(*this); 167 timeline->playerDestroyed(*this);
167 } 168 }
168 // Attach to new layer (if any). 169 // Attach to new layer (if any).
169 if (compositorAnimationAttachedToLayerId) { 170 if (compositorAnimationAttachedToLayerId) {
170 ASSERT(!m_compositorPlayer->isLayerAttached()); 171 ASSERT(!m_compositorPlayer->isLayerAttached());
171 timeline->playerAttached(*this); 172 timeline->playerAttached(*this);
172 m_compositorPlayer->attachLayer( 173 m_compositorPlayer->attachLayer(
173 scrollableArea()->layerForScrolling()->platformLayer()); 174 scrollableArea()->layerForScrolling()->platformLayer());
175 reattached = true;
174 } 176 }
175 m_compositorAnimationAttachedToLayerId = compositorAnimationAttached ToLayerId; 177 m_compositorAnimationAttachedToLayerId = compositorAnimationAttached ToLayerId;
176 } 178 }
177 } 179 }
180
181 return reattached;
178 } 182 }
179 183
180 void ScrollAnimatorCompositorCoordinator::notifyAnimationStarted( 184 void ScrollAnimatorCompositorCoordinator::notifyAnimationStarted(
181 double monotonicTime, int group) 185 double monotonicTime, int group)
182 { 186 {
183 } 187 }
184 188
185 void ScrollAnimatorCompositorCoordinator::notifyAnimationFinished( 189 void ScrollAnimatorCompositorCoordinator::notifyAnimationFinished(
186 double monotonicTime, int group) 190 double monotonicTime, int group)
187 { 191 {
188 notifyCompositorAnimationFinished(group); 192 notifyCompositorAnimationFinished(group);
189 } 193 }
190 194
191 void ScrollAnimatorCompositorCoordinator::notifyAnimationAborted( 195 void ScrollAnimatorCompositorCoordinator::notifyAnimationAborted(
192 double monotonicTime, int group) 196 double monotonicTime, int group)
193 { 197 {
194 // An animation aborted by the compositor is treated as a finished 198 // An animation aborted by the compositor is treated as a finished
195 // animation. 199 // animation.
196 notifyCompositorAnimationFinished(group); 200 notifyCompositorAnimationFinished(group);
197 } 201 }
198 202
199 WebCompositorAnimationPlayer* ScrollAnimatorCompositorCoordinator::compositorPla yer() const 203 WebCompositorAnimationPlayer* ScrollAnimatorCompositorCoordinator::compositorPla yer() const
200 { 204 {
201 return m_compositorPlayer.get(); 205 return m_compositorPlayer.get();
202 } 206 }
203 207
204 } // namespace blink 208 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698