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

Side by Side Diff: sky/engine/platform/scroll/ScrollAnimator.cpp

Issue 682363002: Remove more scrolling methods from FrameView. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/platform/BUILD.gn ('k') | sky/engine/platform/scroll/ScrollAnimatorNone.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 : m_scrollableArea(scrollableArea) 42 : m_scrollableArea(scrollableArea)
43 , m_currentPosX(0) 43 , m_currentPosX(0)
44 , m_currentPosY(0) 44 , m_currentPosY(0)
45 { 45 {
46 } 46 }
47 47
48 ScrollAnimator::~ScrollAnimator() 48 ScrollAnimator::~ScrollAnimator()
49 { 49 {
50 } 50 }
51 51
52 PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea )
53 {
54 return adoptPtr(new ScrollAnimator(scrollableArea));
55 }
56
52 bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float delta) 57 bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float delta)
53 { 58 {
54 float& currentPos = (orientation == HorizontalScrollbar) ? m_currentPosX : m _currentPosY; 59 float& currentPos = (orientation == HorizontalScrollbar) ? m_currentPosX : m _currentPosY;
55 float newPos = clampScrollPosition(orientation, currentPos + step * delta); 60 float newPos = clampScrollPosition(orientation, currentPos + step * delta);
56 if (currentPos == newPos) 61 if (currentPos == newPos)
57 return false; 62 return false;
58 currentPos = newPos; 63 currentPos = newPos;
59 64
60 notifyPositionChanged(); 65 notifyPositionChanged();
61 66
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 142 }
138 143
139 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos) 144 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos)
140 { 145 {
141 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation); 146 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation);
142 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation); 147 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation);
143 return std::max(std::min(pos, maxScrollPos), minScrollPos); 148 return std::max(std::min(pos, maxScrollPos), minScrollPos);
144 } 149 }
145 150
146 } // namespace blink 151 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/BUILD.gn ('k') | sky/engine/platform/scroll/ScrollAnimatorNone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698