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

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: added function for comparison Created 5 years, 6 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 m_scrollOrigin = origin; 115 m_scrollOrigin = origin;
116 m_scrollOriginChanged = true; 116 m_scrollOriginChanged = true;
117 } 117 }
118 } 118 }
119 119
120 GraphicsLayer* ScrollableArea::layerForContainer() const 120 GraphicsLayer* ScrollableArea::layerForContainer() const
121 { 121 {
122 return layerForScrolling() ? layerForScrolling()->parent() : 0; 122 return layerForScrolling() ? layerForScrolling()->parent() : 0;
123 } 123 }
124 124
125 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula rity, float delta) 125 ScrollResultOneDimensional ScrollableArea::scroll(ScrollDirection direction, Scr ollGranularity granularity, float delta)
126 { 126 {
127 ASSERT(!isLogical(direction)); 127 ASSERT(!isLogical(direction));
128 128
129 ScrollbarOrientation orientation; 129 ScrollbarOrientation orientation;
130 if (direction == ScrollUp || direction == ScrollDown) 130 if (direction == ScrollUp || direction == ScrollDown)
131 orientation = VerticalScrollbar; 131 orientation = VerticalScrollbar;
132 else 132 else
133 orientation = HorizontalScrollbar; 133 orientation = HorizontalScrollbar;
134 134
135 if (!userInputScrollable(orientation)) 135 if (!userInputScrollable(orientation))
136 return false; 136 return ScrollResultOneDimensional(false, delta);
137 137
138 cancelProgrammaticScrollAnimation(); 138 cancelProgrammaticScrollAnimation();
139 139
140 float step = 0; 140 float step = 0;
141 switch (granularity) { 141 switch (granularity) {
142 case ScrollByLine: 142 case ScrollByLine:
143 step = lineStep(orientation); 143 step = lineStep(orientation);
144 break; 144 break;
145 case ScrollByPage: 145 case ScrollByPage:
146 step = pageStep(orientation); 146 step = pageStep(orientation);
147 break; 147 break;
148 case ScrollByDocument: 148 case ScrollByDocument:
149 step = documentStep(orientation); 149 step = documentStep(orientation);
150 break; 150 break;
151 case ScrollByPixel: 151 case ScrollByPixel:
152 case ScrollByPrecisePixel: 152 case ScrollByPrecisePixel:
153 step = pixelStep(orientation); 153 step = pixelStep(orientation);
154 break; 154 break;
155 } 155 }
156 156
157 if (direction == ScrollUp || direction == ScrollLeft) 157 if (direction == ScrollUp || direction == ScrollLeft)
158 delta = -delta; 158 delta = -delta;
159 159
160 return scrollAnimator()->scroll(orientation, granularity, step, delta).didSc roll; 160 return scrollAnimator()->scroll(orientation, granularity, step, delta);
161 } 161 }
162 162
163 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi or behavior) 163 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi or behavior)
164 { 164 {
165 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO ffset. 165 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO ffset.
166 ASSERT_NOT_REACHED(); 166 ASSERT_NOT_REACHED();
167 } 167 }
168 168
169 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo ol cancelProgrammaticAnimations) 169 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo ol cancelProgrammaticAnimations)
170 { 170 {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 { 576 {
577 return scrollSize(orientation); 577 return scrollSize(orientation);
578 } 578 }
579 579
580 float ScrollableArea::pixelStep(ScrollbarOrientation) const 580 float ScrollableArea::pixelStep(ScrollbarOrientation) const
581 { 581 {
582 return 1; 582 return 1;
583 } 583 }
584 584
585 } // namespace blink 585 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698