 Chromium Code Reviews
 Chromium Code Reviews Issue 1547003002:
  Fix error in determining the target position for smooth scroll animation curve   (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1547003002:
  Fix error in determining the target position for smooth scroll animation curve   (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 , m_timeFunction(timeFunction) | 54 , m_timeFunction(timeFunction) | 
| 55 { | 55 { | 
| 56 } | 56 } | 
| 57 | 57 | 
| 58 ScrollAnimator::~ScrollAnimator() | 58 ScrollAnimator::~ScrollAnimator() | 
| 59 { | 59 { | 
| 60 } | 60 } | 
| 61 | 61 | 
| 62 FloatPoint ScrollAnimator::desiredTargetPosition() const | 62 FloatPoint ScrollAnimator::desiredTargetPosition() const | 
| 63 { | 63 { | 
| 64 return m_animationCurve ? m_targetOffset : currentPosition(); | 64 return m_animationCurve || m_runState == RunState::WaitingToSendToCompositor | 
| 
Rick Byers
2015/12/23 19:13:34
nit: please add brackets around the condition expr
 
ymalik
2015/12/23 19:20:37
Done.
 | |
| 65 ? m_targetOffset : currentPosition(); | |
| 65 } | 66 } | 
| 66 | 67 | 
| 67 float ScrollAnimator::computeDeltaToConsume( | 68 float ScrollAnimator::computeDeltaToConsume( | 
| 68 ScrollbarOrientation orientation, float pixelDelta) const | 69 ScrollbarOrientation orientation, float pixelDelta) const | 
| 69 { | 70 { | 
| 70 FloatPoint pos = desiredTargetPosition(); | 71 FloatPoint pos = desiredTargetPosition(); | 
| 71 float currentPos = (orientation == HorizontalScrollbar) ? pos.x() : pos.y(); | 72 float currentPos = (orientation == HorizontalScrollbar) ? pos.x() : pos.y(); | 
| 72 float newPos = clampScrollPosition(orientation, currentPos + pixelDelta); | 73 float newPos = clampScrollPosition(orientation, currentPos + pixelDelta); | 
| 73 return (currentPos == newPos) ? 0.0f : (newPos - currentPos); | 74 return (currentPos == newPos) ? 0.0f : (newPos - currentPos); | 
| 74 } | 75 } | 
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 { | 280 { | 
| 280 reattachCompositorPlayerIfNeeded(timeline); | 281 reattachCompositorPlayerIfNeeded(timeline); | 
| 281 } | 282 } | 
| 282 | 283 | 
| 283 DEFINE_TRACE(ScrollAnimator) | 284 DEFINE_TRACE(ScrollAnimator) | 
| 284 { | 285 { | 
| 285 ScrollAnimatorBase::trace(visitor); | 286 ScrollAnimatorBase::trace(visitor); | 
| 286 } | 287 } | 
| 287 | 288 | 
| 288 } // namespace blink | 289 } // namespace blink | 
| OLD | NEW |