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

Side by Side Diff: Source/platform/scroll/ScrollableArea.cpp

Issue 1056983004: OverscrollGlow for mainThread-{BLINK CHANGES} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed review comments of aelias Created 5 years, 7 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 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 m_scrollOrigin = origin; 113 m_scrollOrigin = origin;
114 m_scrollOriginChanged = true; 114 m_scrollOriginChanged = true;
115 } 115 }
116 } 116 }
117 117
118 GraphicsLayer* ScrollableArea::layerForContainer() const 118 GraphicsLayer* ScrollableArea::layerForContainer() const
119 { 119 {
120 return layerForScrolling() ? layerForScrolling()->parent() : 0; 120 return layerForScrolling() ? layerForScrolling()->parent() : 0;
121 } 121 }
122 122
123 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula rity, float delta) 123 ScrollResultOneDimensional ScrollableArea::scroll(ScrollDirection direction, Scr ollGranularity granularity, float delta)
124 { 124 {
125 ScrollbarOrientation orientation; 125 ScrollbarOrientation orientation;
126 126
127 if (direction == ScrollUp || direction == ScrollDown) 127 if (direction == ScrollUp || direction == ScrollDown)
128 orientation = VerticalScrollbar; 128 orientation = VerticalScrollbar;
129 else 129 else
130 orientation = HorizontalScrollbar; 130 orientation = HorizontalScrollbar;
131 131
132 if (!userInputScrollable(orientation)) 132 if (!userInputScrollable(orientation))
133 return false; 133 return ScrollResultOneDimensional(false);
134 134
135 cancelProgrammaticScrollAnimation(); 135 cancelProgrammaticScrollAnimation();
136 136
137 float step = 0; 137 float step = 0;
138 switch (granularity) { 138 switch (granularity) {
139 case ScrollByLine: 139 case ScrollByLine:
140 step = lineStep(orientation); 140 step = lineStep(orientation);
141 break; 141 break;
142 case ScrollByPage: 142 case ScrollByPage:
143 step = pageStep(orientation); 143 step = pageStep(orientation);
144 break; 144 break;
145 case ScrollByDocument: 145 case ScrollByDocument:
146 step = documentStep(orientation); 146 step = documentStep(orientation);
147 break; 147 break;
148 case ScrollByPixel: 148 case ScrollByPixel:
149 case ScrollByPrecisePixel: 149 case ScrollByPrecisePixel:
150 step = pixelStep(orientation); 150 step = pixelStep(orientation);
151 break; 151 break;
152 } 152 }
153 153
154 if (direction == ScrollUp || direction == ScrollLeft) 154 if (direction == ScrollUp || direction == ScrollLeft)
155 delta = -delta; 155 delta = -delta;
156 156
157 return scrollAnimator()->scroll(orientation, granularity, step, delta).didSc roll; 157 return scrollAnimator()->scroll(orientation, granularity, step, delta);
158 } 158 }
159 159
160 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi or behavior) 160 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi or behavior)
161 { 161 {
162 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO ffset. 162 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO ffset.
163 ASSERT_NOT_REACHED(); 163 ASSERT_NOT_REACHED();
164 } 164 }
165 165
166 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo ol cancelProgrammaticAnimations) 166 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo ol cancelProgrammaticAnimations)
167 { 167 {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 { 515 {
516 return scrollSize(orientation); 516 return scrollSize(orientation);
517 } 517 }
518 518
519 float ScrollableArea::pixelStep(ScrollbarOrientation) const 519 float ScrollableArea::pixelStep(ScrollbarOrientation) const
520 { 520 {
521 return 1; 521 return 1;
522 } 522 }
523 523
524 } // namespace blink 524 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698