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

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

Issue 1496693005: Update RootFrameViewport::userScroll to distribute scrolls between viewports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed remaining review comments Created 5 years 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) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 : ScrollAnimatorBase(scrollableArea) 52 : ScrollAnimatorBase(scrollableArea)
53 , m_timeFunction(timeFunction) 53 , m_timeFunction(timeFunction)
54 { 54 {
55 } 55 }
56 56
57 ScrollAnimator::~ScrollAnimator() 57 ScrollAnimator::~ScrollAnimator()
58 { 58 {
59 cancelAnimations(); 59 cancelAnimations();
60 } 60 }
61 61
62 float ScrollAnimator::usedScrollDelta(ScrollbarOrientation orientation, float pi xelDelta) const
bokan 2015/12/07 18:43:17 I'd make this "computeTargetPosition" and use it i
bokan 2015/12/07 19:52:54 ok, delta is fine, but can we call it 'computeDelt
ymalik 2015/12/07 20:52:33 Renamed.
63 {
64 FloatPoint pos = m_animationCurve
65 ? FloatPoint(m_animationCurve->targetValue()) : currentPosition();
66 float currentPos = (orientation == HorizontalScrollbar) ? pos.x() : pos.y();
67 float newPos = clampScrollPosition(orientation, currentPos + pixelDelta);
68 return (currentPos == newPos) ? 0.0f : (newPos - currentPos);
69 }
70
62 ScrollResultOneDimensional ScrollAnimator::userScroll(ScrollbarOrientation orien tation, ScrollGranularity granularity, float step, float delta) 71 ScrollResultOneDimensional ScrollAnimator::userScroll(ScrollbarOrientation orien tation, ScrollGranularity granularity, float step, float delta)
63 { 72 {
64 if (!m_scrollableArea->scrollAnimatorEnabled()) 73 if (!m_scrollableArea->scrollAnimatorEnabled())
65 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta); 74 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta);
66 75
67 TRACE_EVENT0("blink", "ScrollAnimator::scroll"); 76 TRACE_EVENT0("blink", "ScrollAnimator::scroll");
68 77
69 if (granularity == ScrollByPrecisePixel) 78 if (granularity == ScrollByPrecisePixel)
70 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta); 79 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta);
71 80
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 TRACE_EVENT0("blink", "ScrollAnimator::notifyPositionChanged"); 158 TRACE_EVENT0("blink", "ScrollAnimator::notifyPositionChanged");
150 notifyPositionChanged(); 159 notifyPositionChanged();
151 } 160 }
152 161
153 DEFINE_TRACE(ScrollAnimator) 162 DEFINE_TRACE(ScrollAnimator)
154 { 163 {
155 ScrollAnimatorBase::trace(visitor); 164 ScrollAnimatorBase::trace(visitor);
156 } 165 }
157 166
158 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698