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

Side by Side Diff: Source/core/platform/mac/ScrollAnimatorMac.mm

Issue 24130008: Rename ENABLE(RUBBER_BANDING) to USE(RUBBER_BANDING). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea ) 594 PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea )
595 { 595 {
596 return adoptPtr(new ScrollAnimatorMac(scrollableArea)); 596 return adoptPtr(new ScrollAnimatorMac(scrollableArea));
597 } 597 }
598 598
599 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) 599 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
600 : ScrollAnimator(scrollableArea) 600 : ScrollAnimator(scrollableArea)
601 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired) 601 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai ntTimerFired)
602 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired) 602 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc rolledTimerFired)
603 #if ENABLE(RUBBER_BANDING) 603 #if USE(RUBBER_BANDING)
604 , m_scrollElasticityController(this) 604 , m_scrollElasticityController(this)
605 , m_snapRubberBandTimer(this, &ScrollAnimatorMac::snapRubberBandTimerFired) 605 , m_snapRubberBandTimer(this, &ScrollAnimatorMac::snapRubberBandTimerFired)
606 #endif 606 #endif
607 , m_haveScrolledSincePageLoad(false) 607 , m_haveScrolledSincePageLoad(false)
608 , m_needsScrollerStyleUpdate(false) 608 , m_needsScrollerStyleUpdate(false)
609 { 609 {
610 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]); 610 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a lloc] initWithScrollAnimator:this]);
611 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); 611 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
612 612
613 if (isScrollbarOverlayAPIAvailable()) { 613 if (isScrollbarOverlayAPIAvailable()) {
(...skipping 18 matching lines...) Expand all
632 } 632 }
633 633
634 static bool scrollAnimationEnabledForSystem() 634 static bool scrollAnimationEnabledForSystem()
635 { 635 {
636 NSString* scrollAnimationDefaultsKey = 636 NSString* scrollAnimationDefaultsKey =
637 @"AppleScrollAnimationEnabled"; 637 @"AppleScrollAnimationEnabled";
638 static bool enabled = [[NSUserDefaults standardUserDefaults] boolForKey:scro llAnimationDefaultsKey]; 638 static bool enabled = [[NSUserDefaults standardUserDefaults] boolForKey:scro llAnimationDefaultsKey];
639 return enabled; 639 return enabled;
640 } 640 }
641 641
642 #if ENABLE(RUBBER_BANDING) 642 #if USE(RUBBER_BANDING)
643 static bool rubberBandingEnabledForSystem() 643 static bool rubberBandingEnabledForSystem()
644 { 644 {
645 static bool initialized = false; 645 static bool initialized = false;
646 static bool enabled = true; 646 static bool enabled = true;
647 // Caches the result, which is consistent with other apps like the Finder, w hich all 647 // Caches the result, which is consistent with other apps like the Finder, w hich all
648 // require a restart after changing this default. 648 // require a restart after changing this default.
649 if (!initialized) { 649 if (!initialized) {
650 // Uses -objectForKey: and not -boolForKey: in order to default to true if the value wasn't set. 650 // Uses -objectForKey: and not -boolForKey: in order to default to true if the value wasn't set.
651 id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrol lViewRubberbanding"]; 651 id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrol lViewRubberbanding"];
652 if ([value isKindOfClass:[NSNumber class]]) 652 if ([value isKindOfClass:[NSNumber class]])
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 713
714 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo sition.y() - m_currentPosY); 714 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo sition.y() - m_currentPosY);
715 715
716 m_currentPosX = adjustedPosition.x(); 716 m_currentPosX = adjustedPosition.x();
717 m_currentPosY = adjustedPosition.y(); 717 m_currentPosY = adjustedPosition.y();
718 notifyPositionChanged(delta); 718 notifyPositionChanged(delta);
719 } 719 }
720 720
721 bool ScrollAnimatorMac::isRubberBandInProgress() const 721 bool ScrollAnimatorMac::isRubberBandInProgress() const
722 { 722 {
723 #if !ENABLE(RUBBER_BANDING) 723 #if !USE(RUBBER_BANDING)
724 return false; 724 return false;
725 #else 725 #else
726 return m_scrollElasticityController.isRubberBandInProgress(); 726 return m_scrollElasticityController.isRubberBandInProgress();
727 #endif 727 #endif
728 } 728 }
729 729
730 void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoin t& newPosition) 730 void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoin t& newPosition)
731 { 731 {
732 ASSERT(m_scrollAnimationHelper); 732 ASSERT(m_scrollAnimationHelper);
733 immediateScrollTo(newPosition); 733 immediateScrollTo(newPosition);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 m_haveScrolledSincePageLoad = true; 999 m_haveScrolledSincePageLoad = true;
1000 1000
1001 if (phase == PlatformWheelEventPhaseBegan) 1001 if (phase == PlatformWheelEventPhaseBegan)
1002 didBeginScrollGesture(); 1002 didBeginScrollGesture();
1003 else if (phase == PlatformWheelEventPhaseEnded || phase == PlatformWheelEven tPhaseCancelled) 1003 else if (phase == PlatformWheelEventPhaseEnded || phase == PlatformWheelEven tPhaseCancelled)
1004 didEndScrollGesture(); 1004 didEndScrollGesture();
1005 else if (phase == PlatformWheelEventPhaseMayBegin) 1005 else if (phase == PlatformWheelEventPhaseMayBegin)
1006 mayBeginScrollGesture(); 1006 mayBeginScrollGesture();
1007 } 1007 }
1008 1008
1009 #if ENABLE(RUBBER_BANDING) 1009 #if USE(RUBBER_BANDING)
1010 bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) 1010 bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
1011 { 1011 {
1012 m_haveScrolledSincePageLoad = true; 1012 m_haveScrolledSincePageLoad = true;
1013 1013
1014 if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSyste m()) 1014 if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSyste m())
1015 return ScrollAnimator::handleWheelEvent(wheelEvent); 1015 return ScrollAnimator::handleWheelEvent(wheelEvent);
1016 1016
1017 // FIXME: This is somewhat roundabout hack to allow forwarding wheel events 1017 // FIXME: This is somewhat roundabout hack to allow forwarding wheel events
1018 // up to the parent scrollable area. It takes advantage of the fact that 1018 // up to the parent scrollable area. It takes advantage of the fact that
1019 // the base class implementation of handleWheelEvent will not accept the 1019 // the base class implementation of handleWheelEvent will not accept the
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 return; 1294 return;
1295 1295
1296 m_visibleScrollerThumbRect = rectInViewCoordinates; 1296 m_visibleScrollerThumbRect = rectInViewCoordinates;
1297 } 1297 }
1298 1298
1299 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1299 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1300 return isScrollbarOverlayAPIAvailable(); 1300 return isScrollbarOverlayAPIAvailable();
1301 } 1301 }
1302 1302
1303 } // namespace WebCore 1303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/mac/ScrollAnimatorMac.h ('k') | Source/core/platform/mac/ScrollElasticityController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698