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

Side by Side Diff: third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm

Issue 1496693005: Update RootFrameViewport::userScroll to distribute scrolls between viewports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 .scrollAnimationEnabledForSystem( ); 735 .scrollAnimationEnabledForSystem( );
736 m_haveScrolledSincePageLoad = true; 736 m_haveScrolledSincePageLoad = true;
737 737
738 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled()) 738 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna bled())
739 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta); 739 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta);
740 740
741 if (granularity == ScrollByPixel || granularity == ScrollByPrecisePixel) 741 if (granularity == ScrollByPixel || granularity == ScrollByPrecisePixel)
742 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta); 742 return ScrollAnimatorBase::userScroll(orientation, granularity, step, de lta);
743 743
744 float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_cu rrentPosY; 744 float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_cu rrentPosY;
745 float newPos = std::max<float>(std::min<float>(currentPos + (step * delta), m_scrollableArea->maximumScrollPosition(orientation)), m_scrollableArea->minimum ScrollPosition(orientation)); 745 float usedPixelDelta = computeDeltaToConsume(orientation, step * delta);
746 float newPos = currentPos + usedPixelDelta;
746 if (currentPos == newPos) 747 if (currentPos == newPos)
747 return ScrollResultOneDimensional(false); 748 return ScrollResultOneDimensional(false);
748 749
749 NSPoint newPoint; 750 NSPoint newPoint;
750 if ([m_scrollAnimationHelper.get() _isAnimating]) { 751 if ([m_scrollAnimationHelper.get() _isAnimating]) {
751 NSPoint targetOrigin = [m_scrollAnimationHelper.get() targetOrigin]; 752 NSPoint targetOrigin = [m_scrollAnimationHelper.get() targetOrigin];
752 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targ etOrigin.y) : NSMakePoint(targetOrigin.x, newPos); 753 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targ etOrigin.y) : NSMakePoint(targetOrigin.x, newPos);
753 } else 754 } else
754 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_cu rrentPosY) : NSMakePoint(m_currentPosX, newPos); 755 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_cu rrentPosY) : NSMakePoint(m_currentPosX, newPos);
755 756
756 [m_scrollAnimationHelper.get() scrollToPoint:newPoint]; 757 [m_scrollAnimationHelper.get() scrollToPoint:newPoint];
757 758
758 float usedDelta = (newPos - currentPos) / step; 759 return ScrollResultOneDimensional(true, delta - (usedPixelDelta / step));
759 return ScrollResultOneDimensional(true, delta - usedDelta);
760 } 760 }
761 761
762 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset) 762 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
763 { 763 {
764 [m_scrollAnimationHelper.get() _stopRun]; 764 [m_scrollAnimationHelper.get() _stopRun];
765 immediateScrollTo(offset); 765 immediateScrollTo(offset);
766 } 766 }
767 767
768 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& position) const 768 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& position) const
769 { 769 {
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 return; 1201 return;
1202 1202
1203 m_visibleScrollerThumbRect = rectInViewCoordinates; 1203 m_visibleScrollerThumbRect = rectInViewCoordinates;
1204 } 1204 }
1205 1205
1206 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1206 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1207 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); 1207 return ScrollbarThemeMacCommon::isOverlayAPIAvailable();
1208 } 1208 }
1209 1209
1210 } // namespace blink 1210 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.cpp ('k') | third_party/WebKit/Source/platform/scroll/ScrollAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698