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

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

Issue 2387393003: Revert of Refactor ScrollableArea::setScrollPosition. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | 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 * 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 FloatSize unscrollableAxisDelta = pixelDelta - scrollableAxisDelta; 171 FloatSize unscrollableAxisDelta = pixelDelta - scrollableAxisDelta;
172 result.unusedScrollDeltaX += unscrollableAxisDelta.width(); 172 result.unusedScrollDeltaX += unscrollableAxisDelta.width();
173 result.unusedScrollDeltaY += unscrollableAxisDelta.height(); 173 result.unusedScrollDeltaY += unscrollableAxisDelta.height();
174 174
175 return result; 175 return result;
176 } 176 }
177 177
178 void ScrollableArea::setScrollPosition(const DoublePoint& position, 178 void ScrollableArea::setScrollPosition(const DoublePoint& position,
179 ScrollType scrollType, 179 ScrollType scrollType,
180 ScrollBehavior behavior) { 180 ScrollBehavior behavior) {
181 DoublePoint clampedPosition = clampScrollPosition(position);
182 if (shouldUseIntegerScrollOffset())
183 clampedPosition = flooredIntPoint(clampedPosition);
184 if (clampedPosition == scrollPositionDouble())
185 return;
186
187 if (behavior == ScrollBehaviorAuto) 181 if (behavior == ScrollBehaviorAuto)
188 behavior = scrollBehaviorStyle(); 182 behavior = scrollBehaviorStyle();
189 183
190 switch (scrollType) { 184 switch (scrollType) {
191 case CompositorScroll: 185 case CompositorScroll:
192 scrollPositionChanged(clampedPosition, scrollType); 186 scrollPositionChanged(clampScrollPosition(position), scrollType);
193 break; 187 break;
194 case AnchoringScroll: 188 case AnchoringScroll:
195 scrollAnimator().adjustAnimationAndSetScrollPosition(clampedPosition, 189 scrollAnimator().adjustAnimationAndSetScrollPosition(position,
196 scrollType); 190 scrollType);
197 break; 191 break;
198 case ProgrammaticScroll: 192 case ProgrammaticScroll:
199 programmaticScrollHelper(clampedPosition, behavior); 193 programmaticScrollHelper(position, behavior);
200 break; 194 break;
201 case UserScroll: 195 case UserScroll:
202 userScrollHelper(clampedPosition, behavior); 196 userScrollHelper(position, behavior);
203 break; 197 break;
204 default: 198 default:
205 ASSERT_NOT_REACHED(); 199 ASSERT_NOT_REACHED();
206 } 200 }
207 } 201 }
208 202
209 void ScrollableArea::scrollBy(const DoubleSize& delta, 203 void ScrollableArea::scrollBy(const DoubleSize& delta,
210 ScrollType type, 204 ScrollType type,
211 ScrollBehavior behavior) { 205 ScrollBehavior behavior) {
212 setScrollPosition(scrollPositionDouble() + delta, type, behavior); 206 setScrollPosition(scrollPositionDouble() + delta, type, behavior);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()), 598 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()),
605 std::max(0, size.height() - horizontalScrollbarHeight())); 599 std::max(0, size.height() - horizontalScrollbarHeight()));
606 } 600 }
607 601
608 DEFINE_TRACE(ScrollableArea) { 602 DEFINE_TRACE(ScrollableArea) {
609 visitor->trace(m_scrollAnimator); 603 visitor->trace(m_scrollAnimator);
610 visitor->trace(m_programmaticScrollAnimator); 604 visitor->trace(m_programmaticScrollAnimator);
611 } 605 }
612 606
613 } // namespace blink 607 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698