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

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

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/scroll/ScrollView.h ('k') | Source/platform/scroll/ScrollableArea.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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 if (scrollbarsSuppressed()) 273 if (scrollbarsSuppressed())
274 return; 274 return;
275 275
276 if (isFrameView()) 276 if (isFrameView())
277 m_pendingScrollDelta += scrollDelta; 277 m_pendingScrollDelta += scrollDelta;
278 else 278 else
279 scrollContents(scrollDelta); 279 scrollContents(scrollDelta);
280 } 280 }
281 281
282 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) 282 void ScrollView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior s crollBehavior)
283 { 283 {
284 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); 284 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
285 285
286 if (newScrollPosition == scrollPosition()) 286 if (newScrollPosition == scrollPosition())
287 return; 287 return;
288 288
289 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); 289 if (scrollBehavior == ScrollBehaviorInstant)
290 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y()));
291 else
292 ScrollableArea::programmaticallyScrollSmoothlyToOffset(newScrollPosition );
290 } 293 }
291 294
292 bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity ) 295 bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity )
293 { 296 {
294 ScrollDirection physicalDirection = 297 ScrollDirection physicalDirection =
295 toPhysicalDirection(direction, isVerticalDocument(), isFlippedDocument() ); 298 toPhysicalDirection(direction, isVerticalDocument(), isFlippedDocument() );
296 299
297 return ScrollableArea::scroll(physicalDirection, granularity); 300 return ScrollableArea::scroll(physicalDirection, granularity);
298 } 301 }
299 302
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 return; 1120 return;
1118 1121
1119 ScrollableArea::setScrollOrigin(origin); 1122 ScrollableArea::setScrollOrigin(origin);
1120 1123
1121 // Update if the scroll origin changes, since our position will be different if the content size did not change. 1124 // Update if the scroll origin changes, since our position will be different if the content size did not change.
1122 if (updatePositionAtAll && updatePositionSynchronously) 1125 if (updatePositionAtAll && updatePositionSynchronously)
1123 updateScrollbars(scrollOffset()); 1126 updateScrollbars(scrollOffset());
1124 } 1127 }
1125 1128
1126 } // namespace WebCore 1129 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollView.h ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698