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

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: Rebased Created 6 years, 10 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
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 m_scrollOffset = newOffset; 278 m_scrollOffset = newOffset;
279 279
280 if (scrollbarsSuppressed()) 280 if (scrollbarsSuppressed())
281 return; 281 return;
282 282
283 repaintFixedElementsAfterScrolling(); 283 repaintFixedElementsAfterScrolling();
284 scrollContents(scrollDelta); 284 scrollContents(scrollDelta);
285 updateFixedElementsAfterScrolling(); 285 updateFixedElementsAfterScrolling();
286 } 286 }
287 287
288 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) 288 void ScrollView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior b ehavior)
289 { 289 {
290 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); 290 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
291 291
292 if (newScrollPosition == scrollPosition()) 292 if (newScrollPosition == scrollPosition())
293 return; 293 return;
294 294
295 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); 295 if (behavior == ScrollBehaviorInstant)
296 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y()));
297 else
298 ScrollableArea::programmaticallyScrollSmoothlyToOffset(newScrollPosition );
296 } 299 }
297 300
298 bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity ) 301 bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity )
299 { 302 {
300 ScrollDirection physicalDirection = 303 ScrollDirection physicalDirection =
301 toPhysicalDirection(direction, isVerticalDocument(), isFlippedDocument() ); 304 toPhysicalDirection(direction, isVerticalDocument(), isFlippedDocument() );
302 305
303 return ScrollableArea::scroll(physicalDirection, granularity); 306 return ScrollableArea::scroll(physicalDirection, granularity);
304 } 307 }
305 308
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 int ScrollView::pageStep(ScrollbarOrientation orientation) const 1138 int ScrollView::pageStep(ScrollbarOrientation orientation) const
1136 { 1139 {
1137 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); 1140 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height();
1138 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; 1141 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ;
1139 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); 1142 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages());
1140 1143
1141 return std::max(pageStep, 1); 1144 return std::max(pageStep, 1);
1142 } 1145 }
1143 1146
1144 } // namespace WebCore 1147 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698