OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "platform/animation/TimingFunction.h" | 33 #include "platform/animation/TimingFunction.h" |
34 #include "platform/geometry/FloatRect.h" | 34 #include "platform/geometry/FloatRect.h" |
35 #include "platform/geometry/IntRect.h" | 35 #include "platform/geometry/IntRect.h" |
36 #include "platform/mac/BlockExceptions.h" | 36 #include "platform/mac/BlockExceptions.h" |
37 #include "platform/mac/NSScrollerImpDetails.h" | 37 #include "platform/mac/NSScrollerImpDetails.h" |
38 #include "platform/scroll/ScrollableArea.h" | 38 #include "platform/scroll/ScrollableArea.h" |
39 #include "platform/scroll/ScrollbarTheme.h" | 39 #include "platform/scroll/ScrollbarTheme.h" |
40 #include "platform/scroll/ScrollbarThemeMacCommon.h" | 40 #include "platform/scroll/ScrollbarThemeMacCommon.h" |
41 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h" | 41 #include "platform/scroll/ScrollbarThemeMacOverlayAPI.h" |
42 #include "wtf/MainThread.h" | 42 #include "wtf/MainThread.h" |
43 #include "wtf/PassOwnPtr.h" | |
44 | 43 |
45 using namespace blink; | 44 using namespace blink; |
46 | 45 |
47 static bool supportsUIStateTransitionProgress() | 46 static bool supportsUIStateTransitionProgress() |
48 { | 47 { |
49 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. | 48 // FIXME: This is temporary until all platforms that support ScrollbarPainte
r support this part of the API. |
50 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; | 49 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N
SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; |
51 return globalSupportsUIStateTransitionProgress; | 50 return globalSupportsUIStateTransitionProgress; |
52 } | 51 } |
53 | 52 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 [_trackAlphaAnimation.get() invalidate]; | 671 [_trackAlphaAnimation.get() invalidate]; |
673 [_uiStateTransitionAnimation.get() invalidate]; | 672 [_uiStateTransitionAnimation.get() invalidate]; |
674 [_expansionTransitionAnimation.get() invalidate]; | 673 [_expansionTransitionAnimation.get() invalidate]; |
675 END_BLOCK_OBJC_EXCEPTIONS; | 674 END_BLOCK_OBJC_EXCEPTIONS; |
676 } | 675 } |
677 | 676 |
678 @end | 677 @end |
679 | 678 |
680 namespace blink { | 679 namespace blink { |
681 | 680 |
682 PassOwnPtr<ScrollAnimatorBase> ScrollAnimatorBase::create(ScrollableArea* scroll
ableArea) | 681 ScrollAnimatorBase* ScrollAnimatorBase::create(ScrollableArea* scrollableArea) |
683 { | 682 { |
684 return adoptPtr(new ScrollAnimatorMac(scrollableArea)); | 683 return new ScrollAnimatorMac(scrollableArea); |
685 } | 684 } |
686 | 685 |
687 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) | 686 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) |
688 : ScrollAnimatorBase(scrollableArea) | 687 : ScrollAnimatorBase(scrollableArea) |
689 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai
ntTimerFired) | 688 , m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPai
ntTimerFired) |
690 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc
rolledTimerFired) | 689 , m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaSc
rolledTimerFired) |
691 , m_haveScrolledSincePageLoad(false) | 690 , m_haveScrolledSincePageLoad(false) |
692 , m_needsScrollerStyleUpdate(false) | 691 , m_needsScrollerStyleUpdate(false) |
693 { | 692 { |
694 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a
lloc] initWithScrollAnimator:this]); | 693 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a
lloc] initWithScrollAnimator:this]); |
695 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe
r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); | 694 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe
r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); |
696 | 695 |
697 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { | 696 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { |
698 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro
llerDelegate alloc] initWithScrollableArea:scrollableArea]); | 697 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro
llerDelegate alloc] initWithScrollableArea:scrollableArea]); |
699 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair"
) alloc] init] autorelease]; | 698 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair"
) alloc] init] autorelease]; |
700 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat
e:) withObject:m_scrollbarPainterControllerDelegate.get()]; | 699 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat
e:) withObject:m_scrollbarPainterControllerDelegate.get()]; |
701 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo
mmon::recommendedScrollerStyle()]; | 700 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo
mmon::recommendedScrollerStyle()]; |
702 } | 701 } |
703 } | 702 } |
704 | 703 |
705 ScrollAnimatorMac::~ScrollAnimatorMac() | 704 ScrollAnimatorMac::~ScrollAnimatorMac() |
706 { | 705 { |
| 706 cleanup(); |
| 707 } |
| 708 |
| 709 void ScrollAnimatorMac::cleanup() |
| 710 { |
707 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { | 711 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { |
708 BEGIN_BLOCK_OBJC_EXCEPTIONS; | 712 BEGIN_BLOCK_OBJC_EXCEPTIONS; |
709 [m_scrollbarPainterControllerDelegate.get() invalidate]; | 713 [m_scrollbarPainterControllerDelegate.get() invalidate]; |
710 [m_scrollbarPainterController.get() setDelegate:nil]; | 714 [m_scrollbarPainterController.get() setDelegate:nil]; |
711 [m_horizontalScrollbarPainterDelegate.get() invalidate]; | 715 [m_horizontalScrollbarPainterDelegate.get() invalidate]; |
712 [m_verticalScrollbarPainterDelegate.get() invalidate]; | 716 [m_verticalScrollbarPainterDelegate.get() invalidate]; |
713 [m_scrollAnimationHelperDelegate.get() invalidate]; | 717 [m_scrollAnimationHelperDelegate.get() invalidate]; |
714 END_BLOCK_OBJC_EXCEPTIONS; | 718 END_BLOCK_OBJC_EXCEPTIONS; |
715 } | 719 } |
| 720 m_initialScrollbarPaintTimer.stop(); |
| 721 m_sendContentAreaScrolledTimer.stop(); |
716 } | 722 } |
717 | 723 |
718 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or
ientation, ScrollGranularity granularity, float step, float delta) | 724 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or
ientation, ScrollGranularity granularity, float step, float delta) |
719 { | 725 { |
720 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*>
( | 726 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*>
( |
721 ScrollbarTheme::theme()) | 727 ScrollbarTheme::theme()) |
722 ->scrollAnimationEnabledForSystem
(); | 728 ->scrollAnimationEnabledForSystem
(); |
723 m_haveScrolledSincePageLoad = true; | 729 m_haveScrolledSincePageLoad = true; |
724 | 730 |
725 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna
bled()) | 731 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna
bled()) |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 return; | 1194 return; |
1189 | 1195 |
1190 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1196 m_visibleScrollerThumbRect = rectInViewCoordinates; |
1191 } | 1197 } |
1192 | 1198 |
1193 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1199 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
1194 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); | 1200 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); |
1195 } | 1201 } |
1196 | 1202 |
1197 } // namespace blink | 1203 } // namespace blink |
OLD | NEW |