Changeset 89016 in webkit
- Timestamp:
- Jun 16, 2011 1:31:21 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89011 r89016 1 2011-06-16 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r89011. 4 http://trac.webkit.org/changeset/89011 5 https://bugs.webkit.org/show_bug.cgi?id=62789 6 7 Broke mac build (Requested by vitalyr_ on #webkit). 8 9 * platform/chromium/ScrollAnimatorChromiumMac.h: 10 * platform/chromium/ScrollAnimatorChromiumMac.mm: 11 (-[ScrollAnimationHelperDelegate _immediateScrollToPoint:]): 12 (-[ScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]): 13 (WebCore::ScrollAnimatorChromiumMac::ScrollAnimatorChromiumMac): 14 (WebCore::ScrollAnimatorChromiumMac::scroll): 15 (WebCore::ScrollAnimatorChromiumMac::handleWheelEvent): 16 (WebCore::ScrollAnimatorChromiumMac::smoothScrollWithEvent): 17 (WebCore::ScrollAnimatorChromiumMac::beginScrollGesture): 18 (WebCore::ScrollAnimatorChromiumMac::snapRubberBand): 19 (WebCore::ScrollAnimatorChromiumMac::snapRubberBandTimerFired): 20 * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h: 21 * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm: 22 1 23 2011-06-16 Sailesh Agrawal <sail@chromium.org> 2 24 -
trunk/Source/WebCore/platform/chromium/ScrollAnimatorChromiumMac.h
r89011 r89016 72 72 void immediateScrollByDeltaY(float deltaY); 73 73 74 void immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition);75 76 74 void setIsDrawingIntoLayer(bool b) { m_drawingIntoLayer = b; } 77 75 bool isDrawingIntoLayer() const { return m_drawingIntoLayer; } … … 79 77 bool haveScrolledSincePageLoad() const { return m_haveScrolledSincePageLoad; } 80 78 81 virtual void setIsActive(bool);82 83 79 #if USE(WK_SCROLLBAR_PAINTER) 84 void updateScrollerStyle();85 86 80 bool scrollbarPaintTimerIsActive() const; 87 81 void startScrollbarPaintTimer(); … … 122 116 virtual void willRemoveHorizontalScrollbar(Scrollbar*); 123 117 124 void setNeedsScrollerStyleUpdate(bool needsUpdate) { m_needsScrollerStyleUpdate = needsUpdate; }125 bool needsScrollerStyleUpdate() const { return m_needsScrollerStyleUpdate; }126 127 118 float adjustScrollXPositionIfNecessary(float) const; 128 119 float adjustScrollYPositionIfNecessary(float) const; … … 142 133 bool m_momentumScrollInProgress; 143 134 bool m_ignoreMomentumScrolls; 144 145 bool m_scrollerInitiallyPinnedOnLeft; 146 bool m_scrollerInitiallyPinnedOnRight; 147 int m_cumulativeHorizontalScroll; 148 bool m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin; 149 150 CFTimeInterval m_lastMomentumScrollTimestamp; 135 136 CFTimeInterval m_lastMomemtumScrollTimestamp; 151 137 FloatSize m_overflowScrollDelta; 152 138 FloatSize m_stretchScrollForce; … … 162 148 bool m_drawingIntoLayer; 163 149 bool m_haveScrolledSincePageLoad; 164 bool m_needsScrollerStyleUpdate;165 150 IntRect m_visibleScrollerThumbRect; 166 151 }; -
trunk/Source/WebCore/platform/chromium/ScrollAnimatorChromiumMac.mm
r89011 r89016 57 57 - (BOOL)_isAnimating; 58 58 - (NSPoint)targetOrigin; 59 - (CGFloat)_progress;60 59 @end 61 60 … … 107 106 if (!_animator) 108 107 return; 109 _animator->immediateScrollToPoint ForScrollAnimation(newPosition);108 _animator->immediateScrollToPoint(newPosition); 110 109 } 111 110 … … 244 243 return; 245 244 246 wkSetScrollbarPainterControllerStyle((WKScrollbarPainterControllerRef)scrollerImpPair, newRecommendedScrollerStyle); 247 _animator->updateScrollerStyle(); 245 WKScrollbarPainterControllerRef painterController = (WKScrollbarPainterControllerRef)scrollerImpPair; 246 WebCore::ScrollbarThemeChromiumMac* macTheme = (WebCore::ScrollbarThemeChromiumMac*)WebCore::ScrollbarTheme::nativeTheme(); 247 248 WKScrollbarPainterRef oldVerticalPainter = wkVerticalScrollbarPainterForController(painterController); 249 if (oldVerticalPainter) { 250 WebCore::Scrollbar* verticalScrollbar = _animator->scrollableArea()->verticalScrollbar(); 251 WKScrollbarPainterRef newVerticalPainter = wkMakeScrollbarReplacementPainter(oldVerticalPainter, 252 newRecommendedScrollerStyle, 253 verticalScrollbar->controlSize(), 254 false); 255 macTheme->setNewPainterForScrollbar(verticalScrollbar, newVerticalPainter); 256 wkSetPainterForPainterController(painterController, newVerticalPainter, false); 257 258 // The different scrollbar styles have different thicknesses, so we must re-set the 259 // frameRect to the new thickness, and the re-layout below will ensure the position 260 // and length are properly updated. 261 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlSize()); 262 verticalScrollbar->setFrameRect(WebCore::IntRect(0, 0, thickness, thickness)); 263 } 264 265 WKScrollbarPainterRef oldHorizontalPainter = wkHorizontalScrollbarPainterForController(painterController); 266 if (oldHorizontalPainter) { 267 WebCore::Scrollbar* horizontalScrollbar = _animator->scrollableArea()->horizontalScrollbar(); 268 WKScrollbarPainterRef newHorizontalPainter = wkMakeScrollbarReplacementPainter(oldHorizontalPainter, 269 newRecommendedScrollerStyle, 270 horizontalScrollbar->controlSize(), 271 true); 272 macTheme->setNewPainterForScrollbar(horizontalScrollbar, newHorizontalPainter); 273 wkSetPainterForPainterController(painterController, newHorizontalPainter, true); 274 275 // The different scrollbar styles have different thicknesses, so we must re-set the 276 // frameRect to the new thickness, and the re-layout below will ensure the position 277 // and length are properly updated. 278 int thickness = macTheme->scrollbarThickness(horizontalScrollbar->controlSize()); 279 horizontalScrollbar->setFrameRect(WebCore::IntRect(0, 0, thickness, thickness)); 280 } 281 282 wkSetScrollbarPainterControllerStyle(painterController, newRecommendedScrollerStyle); 283 284 // The different scrollbar styles affect layout, so we must re-layout everything. 285 _animator->scrollableArea()->scrollbarStyleChanged(); 248 286 } 249 287 … … 469 507 , m_momentumScrollInProgress(false) 470 508 , m_ignoreMomentumScrolls(false) 471 , m_lastMome ntumScrollTimestamp(0)509 , m_lastMomemtumScrollTimestamp(0) 472 510 , m_startTime(0) 473 511 , m_snapRubberBandTimer(this, &ScrollAnimatorChromiumMac::snapRubberBandTimerFired) … … 475 513 , m_drawingIntoLayer(false) 476 514 , m_haveScrolledSincePageLoad(false) 477 , m_needsScrollerStyleUpdate(false)478 515 { 479 516 m_scrollAnimationHelperDelegate.adoptNS([[ScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]); … … 520 557 NSPoint targetOrigin = [m_scrollAnimationHelper.get() targetOrigin]; 521 558 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targetOrigin.y) : NSMakePoint(targetOrigin.x, newPos); 522 } else {559 } else 523 560 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_currentPosY) : NSMakePoint(m_currentPosX, newPos); 524 m_scrollableArea->didStartAnimatedScroll(); 525 } 561 526 562 [m_scrollAnimationHelper.get() scrollToPoint:newPoint]; 527 563 return true; … … 593 629 m_currentPosY = newPosY; 594 630 notityPositionChanged(); 595 }596 597 void ScrollAnimatorChromiumMac::immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition)598 {599 ASSERT(m_scrollAnimationHelper);600 CGFloat progress = [m_scrollAnimationHelper.get() _progress];601 602 immediateScrollToPoint(newPosition);603 604 if (progress >= 1.0)605 m_scrollableArea->didCompleteAnimatedScroll();606 631 } 607 632 … … 768 793 } 769 794 return multiplier; 770 }771 772 static inline bool isScrollingLeftAndShouldNotRubberBand(PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)773 {774 return wheelEvent.deltaX() > 0 && !scrollableArea->shouldRubberBandInDirection(ScrollLeft);775 }776 777 static inline bool isScrollingRightAndShouldNotRubberBand(PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)778 {779 return wheelEvent.deltaX() < 0 && !scrollableArea->shouldRubberBandInDirection(ScrollRight);780 795 } 781 796 … … 803 818 return; 804 819 } 805 806 if (m_scrollableArea->horizontalScrollbar()) { 807 // If there is a scrollbar, we aggregate the wheel events to get an 808 // overall trend of the scroll. If the direction of the scroll is ever 809 // in the opposite direction of the pin location, then we switch the 810 // boolean, and rubber band. That is, if we were pinned to the left, 811 // and we ended up scrolling to the right, we rubber band. 812 m_cumulativeHorizontalScroll += wheelEvent.deltaX(); 813 if (m_scrollerInitiallyPinnedOnLeft && m_cumulativeHorizontalScroll < 0) 814 m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = true; 815 if (m_scrollerInitiallyPinnedOnRight && m_cumulativeHorizontalScroll > 0) 816 m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = true; 817 } 818 819 // After a gesture begins, we go through: 820 // 1+ PlatformWheelEventPhaseNone 821 // 0+ PlatformWheelEventPhaseChanged 822 // 1 PlatformWheelEventPhaseEnded if there was at least one changed event 823 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseNone && !m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin) { 824 if ((isScrollingLeftAndShouldNotRubberBand(wheelEvent, m_scrollableArea) && 825 m_scrollerInitiallyPinnedOnLeft && 826 m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition()) || 827 (isScrollingRightAndShouldNotRubberBand(wheelEvent, m_scrollableArea) && 828 m_scrollerInitiallyPinnedOnRight && 829 m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition())) { 830 ScrollAnimator::handleWheelEvent(wheelEvent); 831 return; 832 } 833 } 834 } 835 836 bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone); 837 if (m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_snapRubberBandTimer.isActive())) { 838 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) { 820 } 821 822 wheelEvent.accept(); 823 824 bool isMometumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone); 825 if (m_ignoreMomentumScrolls && (isMometumScrollEvent || m_snapRubberBandTimer.isActive())) { 826 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) 839 827 m_ignoreMomentumScrolls = false; 840 wheelEvent.accept(); 841 } 842 return; 843 } 844 845 wheelEvent.accept(); 828 return; 829 } 830 846 831 smoothScrollWithEvent(wheelEvent); 847 832 } … … 927 912 m_overflowScrollDelta = FloatSize(); 928 913 929 float eventCoal escedDeltaX = -wheelEvent.deltaX();930 float eventCoal escedDeltaY = -wheelEvent.deltaY();931 932 deltaX += eventCoal escedDeltaX;933 deltaY += eventCoal escedDeltaY;914 float eventCoallescedDeltaX = -wheelEvent.deltaX(); 915 float eventCoallescedDeltaY = -wheelEvent.deltaY(); 916 917 deltaX += eventCoallescedDeltaX; 918 deltaY += eventCoallescedDeltaY; 934 919 935 920 // Slightly prefer scrolling vertically by applying the = case to deltaY … … 954 939 m_momentumScrollInProgress = true; 955 940 956 CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMome ntumScrollTimestamp;941 CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomemtumScrollTimestamp; 957 942 if (m_inScrollGesture || m_momentumScrollInProgress) { 958 if (m_lastMome ntumScrollTimestamp && timeDelta > 0 && timeDelta < scrollVelocityZeroingTimeout) {959 m_momentumVelocity.setWidth(eventCoal escedDeltaX / (float)timeDelta);960 m_momentumVelocity.setHeight(eventCoal escedDeltaY / (float)timeDelta);961 m_lastMome ntumScrollTimestamp = wheelEvent.timestamp();943 if (m_lastMomemtumScrollTimestamp && timeDelta > 0 && timeDelta < scrollVelocityZeroingTimeout) { 944 m_momentumVelocity.setWidth(eventCoallescedDeltaX / (float)timeDelta); 945 m_momentumVelocity.setHeight(eventCoallescedDeltaY / (float)timeDelta); 946 m_lastMomemtumScrollTimestamp = wheelEvent.timestamp(); 962 947 } else { 963 m_lastMome ntumScrollTimestamp = wheelEvent.timestamp();948 m_lastMomemtumScrollTimestamp = wheelEvent.timestamp(); 964 949 m_momentumVelocity = FloatSize(); 965 950 } … … 1015 1000 if (!allowsHorizontalStretching()) { 1016 1001 deltaX = 0; 1017 eventCoal escedDeltaX = 0;1002 eventCoallescedDeltaX = 0; 1018 1003 } else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) { 1019 1004 deltaX *= scrollWheelMultiplier(); … … 1028 1013 if (!allowsVerticalStretching()) { 1029 1014 deltaY = 0; 1030 eventCoal escedDeltaY = 0;1015 eventCoallescedDeltaY = 0; 1031 1016 } else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) { 1032 1017 deltaY *= scrollWheelMultiplier(); … … 1042 1027 1043 1028 if (m_momentumScrollInProgress) { 1044 if ((pinnedInDirection(eventCoal escedDeltaX, eventCoalescedDeltaY) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_lastMomentumScrollTimestamp) {1029 if ((pinnedInDirection(eventCoallescedDeltaX, eventCoallescedDeltaY) || (fabsf(eventCoallescedDeltaX) + fabsf(eventCoallescedDeltaY) <= 0)) && m_lastMomemtumScrollTimestamp) { 1045 1030 m_ignoreMomentumScrolls = true; 1046 1031 m_momentumScrollInProgress = false; … … 1067 1052 m_momentumScrollInProgress = false; 1068 1053 m_ignoreMomentumScrolls = false; 1069 m_lastMome ntumScrollTimestamp = 0;1054 m_lastMomemtumScrollTimestamp = 0; 1070 1055 } 1071 1056 } … … 1079 1064 m_momentumScrollInProgress = false; 1080 1065 m_ignoreMomentumScrolls = false; 1081 m_lastMome ntumScrollTimestamp = 0;1066 m_lastMomemtumScrollTimestamp = 0; 1082 1067 m_momentumVelocity = FloatSize(); 1083 m_scrollerInitiallyPinnedOnLeft = m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition(); 1084 m_scrollerInitiallyPinnedOnRight = m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition(); 1085 m_cumulativeHorizontalScroll = 0; 1086 m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = false; 1087 1068 1088 1069 IntSize stretchAmount = m_scrollableArea->overhangAmount(); 1089 1070 m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width())); … … 1105 1086 void ScrollAnimatorChromiumMac::snapRubberBand() 1106 1087 { 1107 CFTimeInterval timeDelta = [[NSProcessInfo processInfo] systemUptime] - m_lastMome ntumScrollTimestamp;1108 if (m_lastMome ntumScrollTimestamp && timeDelta >= scrollVelocityZeroingTimeout)1088 CFTimeInterval timeDelta = [[NSProcessInfo processInfo] systemUptime] - m_lastMomemtumScrollTimestamp; 1089 if (m_lastMomemtumScrollTimestamp && timeDelta >= scrollVelocityZeroingTimeout) 1109 1090 m_momentumVelocity = FloatSize(); 1110 1091 … … 1153 1134 return; 1154 1135 } 1155 1156 m_scrollableArea->didStartRubberBand(roundedIntSize(m_startStretch));1157 1136 1158 1137 m_origOrigin = (m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin()) - m_startStretch; … … 1208 1187 #endif 1209 1188 1210 void ScrollAnimatorChromiumMac::setIsActive(bool active)1211 {1212 ScrollAnimator::setIsActive(active);1213 1214 if (isScrollbarOverlayAPIAvailable()) {1215 if (needsScrollerStyleUpdate())1216 updateScrollerStyle();1217 }1218 }1219 1220 1189 #if USE(WK_SCROLLBAR_PAINTER) 1221 void ScrollAnimatorChromiumMac::updateScrollerStyle()1222 {1223 if (!isActive()) {1224 setNeedsScrollerStyleUpdate(true);1225 return;1226 }1227 1228 ScrollbarThemeChromiumMac* macTheme = (ScrollbarThemeChromiumMac*)ScrollbarTheme::nativeTheme();1229 int newStyle = wkScrollbarPainterControllerStyle(m_scrollbarPainterController.get());1230 1231 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) {1232 verticalScrollbar->invalidate();1233 1234 WKScrollbarPainterRef oldVerticalPainter = wkVerticalScrollbarPainterForController(m_scrollbarPainterController.get());1235 WKScrollbarPainterRef newVerticalPainter = wkMakeScrollbarReplacementPainter(oldVerticalPainter,1236 newStyle,1237 verticalScrollbar->controlSize(),1238 false);1239 macTheme->setNewPainterForScrollbar(verticalScrollbar, newVerticalPainter);1240 wkSetPainterForPainterController(m_scrollbarPainterController.get(), newVerticalPainter, false);1241 1242 // The different scrollbar styles have different thicknesses, so we must re-set the1243 // frameRect to the new thickness, and the re-layout below will ensure the position1244 // and length are properly updated.1245 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlSize());1246 verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness));1247 }1248 1249 if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar()) {1250 horizontalScrollbar->invalidate();1251 1252 WKScrollbarPainterRef oldHorizontalPainter = wkHorizontalScrollbarPainterForController(m_scrollbarPainterController.get());1253 WKScrollbarPainterRef newHorizontalPainter = wkMakeScrollbarReplacementPainter(oldHorizontalPainter,1254 newStyle,1255 horizontalScrollbar->controlSize(),1256 true);1257 macTheme->setNewPainterForScrollbar(horizontalScrollbar, newHorizontalPainter);1258 wkSetPainterForPainterController(m_scrollbarPainterController.get(), newHorizontalPainter, true);1259 1260 // The different scrollbar styles have different thicknesses, so we must re-set the1261 // frameRect to the new thickness, and the re-layout below will ensure the position1262 // and length are properly updated.1263 int thickness = macTheme->scrollbarThickness(horizontalScrollbar->controlSize());1264 horizontalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness));1265 }1266 1267 // If needsScrollerStyleUpdate() is true, then the page is restoring from the page cache, and1268 // a relayout will happen on its own. Otherwise, we must initiate a re-layout ourselves.1269 if (!needsScrollerStyleUpdate())1270 scrollableArea()->scrollbarStyleChanged();1271 1272 setNeedsScrollerStyleUpdate(false);1273 }1274 1275 1190 void ScrollAnimatorChromiumMac::startScrollbarPaintTimer() 1276 1191 { -
trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h
r89011 r89016 96 96 WKScrollbarPainterRef wkVerticalScrollbarPainterForController(WKScrollbarPainterControllerRef); 97 97 WKScrollbarPainterRef wkHorizontalScrollbarPainterForController(WKScrollbarPainterControllerRef); 98 NSScrollerStyle wkScrollbarPainterControllerStyle(WKScrollbarPainterControllerRef);99 98 100 99 #endif // USE(WK_SCROLLBAR_PAINTER) -
trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm
r89011 r89016 214 214 } 215 215 216 NSScrollerStyle wkScrollbarPainterControllerStyle(WKScrollbarPainterControllerRef controller)217 {218 return [controller scrollerStyle];219 }220 221 216 WKScrollbarPainterRef wkMakeScrollbarReplacementPainter(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal) 222 217 {
Note: See TracChangeset
for help on using the changeset viewer.