| 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 PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> ScrollAnimatorBase::create(Scrollable
Area* scrollableArea) |
| 683 { | 682 { |
| 684 return adoptPtr(new ScrollAnimatorMac(scrollableArea)); | 683 return adoptPtrWillBeNoop(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 { |
| 693 #if ENABLE(OILPAN) |
| 694 ThreadState::current()->registerPreFinalizer(this); |
| 695 #endif |
| 696 |
| 694 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a
lloc] initWithScrollAnimator:this]); | 697 m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate a
lloc] initWithScrollAnimator:this]); |
| 695 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe
r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); | 698 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe
r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); |
| 696 | 699 |
| 697 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { | 700 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { |
| 698 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro
llerDelegate alloc] initWithScrollableArea:scrollableArea]); | 701 m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterContro
llerDelegate alloc] initWithScrollableArea:scrollableArea]); |
| 699 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair"
) alloc] init] autorelease]; | 702 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair"
) alloc] init] autorelease]; |
| 700 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat
e:) withObject:m_scrollbarPainterControllerDelegate.get()]; | 703 [m_scrollbarPainterController.get() performSelector:@selector(setDelegat
e:) withObject:m_scrollbarPainterControllerDelegate.get()]; |
| 701 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo
mmon::recommendedScrollerStyle()]; | 704 [m_scrollbarPainterController.get() setScrollerStyle:ScrollbarThemeMacCo
mmon::recommendedScrollerStyle()]; |
| 702 } | 705 } |
| 703 } | 706 } |
| 704 | 707 |
| 705 ScrollAnimatorMac::~ScrollAnimatorMac() | 708 ScrollAnimatorMac::~ScrollAnimatorMac() |
| 706 { | 709 { |
| 710 } |
| 711 |
| 712 void ScrollAnimatorMac::cleanup() |
| 713 { |
| 707 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { | 714 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { |
| 708 BEGIN_BLOCK_OBJC_EXCEPTIONS; | 715 BEGIN_BLOCK_OBJC_EXCEPTIONS; |
| 709 [m_scrollbarPainterControllerDelegate.get() invalidate]; | 716 [m_scrollbarPainterControllerDelegate.get() invalidate]; |
| 710 [m_scrollbarPainterController.get() setDelegate:nil]; | 717 [m_scrollbarPainterController.get() setDelegate:nil]; |
| 711 [m_horizontalScrollbarPainterDelegate.get() invalidate]; | 718 [m_horizontalScrollbarPainterDelegate.get() invalidate]; |
| 712 [m_verticalScrollbarPainterDelegate.get() invalidate]; | 719 [m_verticalScrollbarPainterDelegate.get() invalidate]; |
| 713 [m_scrollAnimationHelperDelegate.get() invalidate]; | 720 [m_scrollAnimationHelperDelegate.get() invalidate]; |
| 714 END_BLOCK_OBJC_EXCEPTIONS; | 721 END_BLOCK_OBJC_EXCEPTIONS; |
| 715 } | 722 } |
| 723 m_initialScrollbarPaintTimer.stop(); |
| 724 m_sendContentAreaScrolledTimer.stop(); |
| 716 } | 725 } |
| 717 | 726 |
| 718 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or
ientation, ScrollGranularity granularity, float step, float delta) | 727 ScrollResultOneDimensional ScrollAnimatorMac::userScroll(ScrollbarOrientation or
ientation, ScrollGranularity granularity, float step, float delta) |
| 719 { | 728 { |
| 720 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*>
( | 729 bool scrollAnimationEnabledForSystem = static_cast<ScrollbarThemeMacCommon*>
( |
| 721 ScrollbarTheme::theme()) | 730 ScrollbarTheme::theme()) |
| 722 ->scrollAnimationEnabledForSystem
(); | 731 ->scrollAnimationEnabledForSystem
(); |
| 723 m_haveScrolledSincePageLoad = true; | 732 m_haveScrolledSincePageLoad = true; |
| 724 | 733 |
| 725 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna
bled()) | 734 if (!scrollAnimationEnabledForSystem || !m_scrollableArea->scrollAnimatorEna
bled()) |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 return; | 1197 return; |
| 1189 | 1198 |
| 1190 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1199 m_visibleScrollerThumbRect = rectInViewCoordinates; |
| 1191 } | 1200 } |
| 1192 | 1201 |
| 1193 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1202 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
| 1194 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); | 1203 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); |
| 1195 } | 1204 } |
| 1196 | 1205 |
| 1197 } // namespace blink | 1206 } // namespace blink |
| OLD | NEW |