| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 BEGIN_BLOCK_OBJC_EXCEPTIONS; | 489 BEGIN_BLOCK_OBJC_EXCEPTIONS; |
| 490 [_knobAlphaAnimation.get() stopAnimation]; | 490 [_knobAlphaAnimation.get() stopAnimation]; |
| 491 [_trackAlphaAnimation.get() stopAnimation]; | 491 [_trackAlphaAnimation.get() stopAnimation]; |
| 492 [_uiStateTransitionAnimation.get() stopAnimation]; | 492 [_uiStateTransitionAnimation.get() stopAnimation]; |
| 493 [_expansionTransitionAnimation.get() stopAnimation]; | 493 [_expansionTransitionAnimation.get() stopAnimation]; |
| 494 END_BLOCK_OBJC_EXCEPTIONS; | 494 END_BLOCK_OBJC_EXCEPTIONS; |
| 495 } | 495 } |
| 496 | 496 |
| 497 - (ScrollAnimatorMac&)scrollAnimator | 497 - (ScrollAnimatorMac&)scrollAnimator |
| 498 { | 498 { |
| 499 return static_cast<ScrollAnimatorMac&>(_scrollbar->scrollableArea()->scrollA
nimator()); | 499 return static_cast<ScrollAnimatorMac&>(_scrollbar->getScrollableArea()->scro
llAnimator()); |
| 500 } | 500 } |
| 501 | 501 |
| 502 - (NSRect)convertRectToBacking:(NSRect)aRect | 502 - (NSRect)convertRectToBacking:(NSRect)aRect |
| 503 { | 503 { |
| 504 return aRect; | 504 return aRect; |
| 505 } | 505 } |
| 506 | 506 |
| 507 - (NSRect)convertRectFromBacking:(NSRect)aRect | 507 - (NSRect)convertRectFromBacking:(NSRect)aRect |
| 508 { | 508 { |
| 509 return aRect; | 509 return aRect; |
| 510 } | 510 } |
| 511 | 511 |
| 512 - (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp | 512 - (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp |
| 513 { | 513 { |
| 514 if (!_scrollbar) | 514 if (!_scrollbar) |
| 515 return NSZeroPoint; | 515 return NSZeroPoint; |
| 516 | 516 |
| 517 ASSERT_UNUSED(scrollerImp, scrollerImp == scrollbarPainterForScrollbar(*_scr
ollbar)); | 517 ASSERT_UNUSED(scrollerImp, scrollerImp == scrollbarPainterForScrollbar(*_scr
ollbar)); |
| 518 | 518 |
| 519 return _scrollbar->convertFromContainingWidget(_scrollbar->scrollableArea()-
>lastKnownMousePosition()); | 519 return _scrollbar->convertFromContainingWidget(_scrollbar->getScrollableArea
()->lastKnownMousePosition()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 - (void)setUpAlphaAnimation:(RetainPtr<BlinkScrollbarPartAnimation>&)scrollbarPa
rtAnimation scrollerPainter:(ScrollbarPainter)scrollerPainter part:(blink::Scrol
lbarPart)part animateAlphaTo:(CGFloat)newAlpha duration:(NSTimeInterval)duration | 522 - (void)setUpAlphaAnimation:(RetainPtr<BlinkScrollbarPartAnimation>&)scrollbarPa
rtAnimation scrollerPainter:(ScrollbarPainter)scrollerPainter part:(blink::Scrol
lbarPart)part animateAlphaTo:(CGFloat)newAlpha duration:(NSTimeInterval)duration |
| 523 { | 523 { |
| 524 // If the user has scrolled the page, then the scrollbars must be animated h
ere. | 524 // If the user has scrolled the page, then the scrollbars must be animated h
ere. |
| 525 // This overrides the early returns. | 525 // This overrides the early returns. |
| 526 bool mustAnimate = [self scrollAnimator].haveScrolledSincePageLoad(); | 526 bool mustAnimate = [self scrollAnimator].haveScrolledSincePageLoad(); |
| 527 | 527 |
| 528 if ([self scrollAnimator].scrollbarPaintTimerIsActive() && !mustAnimate) | 528 if ([self scrollAnimator].scrollbarPaintTimerIsActive() && !mustAnimate) |
| 529 return; | 529 return; |
| 530 | 530 |
| 531 if (_scrollbar->scrollableArea()->shouldSuspendScrollAnimations() && !mustAn
imate) { | 531 if (_scrollbar->getScrollableArea()->shouldSuspendScrollAnimations() && !mus
tAnimate) { |
| 532 [self scrollAnimator].startScrollbarPaintTimer(); | 532 [self scrollAnimator].startScrollbarPaintTimer(); |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 | 535 |
| 536 // At this point, we are definitely going to animate now, so stop the timer. | 536 // At this point, we are definitely going to animate now, so stop the timer. |
| 537 [self scrollAnimator].stopScrollbarPaintTimer(); | 537 [self scrollAnimator].stopScrollbarPaintTimer(); |
| 538 | 538 |
| 539 // If we are currently animating, stop | 539 // If we are currently animating, stop |
| 540 if (scrollbarPartAnimation) { | 540 if (scrollbarPartAnimation) { |
| 541 [scrollbarPartAnimation.get() stopAnimation]; | 541 [scrollbarPartAnimation.get() stopAnimation]; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 float newY = clampTo<float, float>(position.y(), minPos.y(), maxPos.y()); | 772 float newY = clampTo<float, float>(position.y(), minPos.y(), maxPos.y()); |
| 773 | 773 |
| 774 return FloatPoint(newX, newY); | 774 return FloatPoint(newX, newY); |
| 775 } | 775 } |
| 776 | 776 |
| 777 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) | 777 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) |
| 778 { | 778 { |
| 779 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); | 779 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); |
| 780 | 780 |
| 781 bool positionChanged = adjustedPosition != m_currentPos; | 781 bool positionChanged = adjustedPosition != m_currentPos; |
| 782 if (!positionChanged && !scrollableArea()->scrollOriginChanged()) | 782 if (!positionChanged && !getScrollableArea()->scrollOriginChanged()) |
| 783 return; | 783 return; |
| 784 | 784 |
| 785 FloatSize delta = adjustedPosition - m_currentPos; | 785 FloatSize delta = adjustedPosition - m_currentPos; |
| 786 | 786 |
| 787 m_currentPos = adjustedPosition; | 787 m_currentPos = adjustedPosition; |
| 788 notifyContentAreaScrolled(delta); | 788 notifyContentAreaScrolled(delta); |
| 789 notifyPositionChanged(); | 789 notifyPositionChanged(); |
| 790 } | 790 } |
| 791 | 791 |
| 792 void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoin
t& newPosition) | 792 void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoin
t& newPosition) |
| 793 { | 793 { |
| 794 ASSERT(m_scrollAnimationHelper); | 794 ASSERT(m_scrollAnimationHelper); |
| 795 immediateScrollTo(newPosition); | 795 immediateScrollTo(newPosition); |
| 796 } | 796 } |
| 797 | 797 |
| 798 void ScrollAnimatorMac::contentAreaWillPaint() const | 798 void ScrollAnimatorMac::contentAreaWillPaint() const |
| 799 { | 799 { |
| 800 if (!scrollableArea()->scrollbarsCanBeActive()) | 800 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 801 return; | 801 return; |
| 802 [m_scrollbarPainterController.get() contentAreaWillDraw]; | 802 [m_scrollbarPainterController.get() contentAreaWillDraw]; |
| 803 } | 803 } |
| 804 | 804 |
| 805 void ScrollAnimatorMac::mouseEnteredContentArea() const | 805 void ScrollAnimatorMac::mouseEnteredContentArea() const |
| 806 { | 806 { |
| 807 if (!scrollableArea()->scrollbarsCanBeActive()) | 807 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 808 return; | 808 return; |
| 809 [m_scrollbarPainterController.get() mouseEnteredContentArea]; | 809 [m_scrollbarPainterController.get() mouseEnteredContentArea]; |
| 810 } | 810 } |
| 811 | 811 |
| 812 void ScrollAnimatorMac::mouseExitedContentArea() const | 812 void ScrollAnimatorMac::mouseExitedContentArea() const |
| 813 { | 813 { |
| 814 if (!scrollableArea()->scrollbarsCanBeActive()) | 814 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 815 return; | 815 return; |
| 816 [m_scrollbarPainterController.get() mouseExitedContentArea]; | 816 [m_scrollbarPainterController.get() mouseExitedContentArea]; |
| 817 } | 817 } |
| 818 | 818 |
| 819 void ScrollAnimatorMac::mouseMovedInContentArea() const | 819 void ScrollAnimatorMac::mouseMovedInContentArea() const |
| 820 { | 820 { |
| 821 if (!scrollableArea()->scrollbarsCanBeActive()) | 821 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 822 return; | 822 return; |
| 823 [m_scrollbarPainterController.get() mouseMovedInContentArea]; | 823 [m_scrollbarPainterController.get() mouseMovedInContentArea]; |
| 824 } | 824 } |
| 825 | 825 |
| 826 void ScrollAnimatorMac::mouseEnteredScrollbar(Scrollbar& scrollbar) const | 826 void ScrollAnimatorMac::mouseEnteredScrollbar(Scrollbar& scrollbar) const |
| 827 { | 827 { |
| 828 if (!scrollableArea()->scrollbarsCanBeActive()) | 828 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 829 return; | 829 return; |
| 830 | 830 |
| 831 if (!supportsUIStateTransitionProgress()) | 831 if (!supportsUIStateTransitionProgress()) |
| 832 return; | 832 return; |
| 833 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) | 833 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) |
| 834 [painter mouseEnteredScroller]; | 834 [painter mouseEnteredScroller]; |
| 835 } | 835 } |
| 836 | 836 |
| 837 void ScrollAnimatorMac::mouseExitedScrollbar(Scrollbar& scrollbar) const | 837 void ScrollAnimatorMac::mouseExitedScrollbar(Scrollbar& scrollbar) const |
| 838 { | 838 { |
| 839 if (!scrollableArea()->scrollbarsCanBeActive()) | 839 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 840 return; | 840 return; |
| 841 | 841 |
| 842 if (!supportsUIStateTransitionProgress()) | 842 if (!supportsUIStateTransitionProgress()) |
| 843 return; | 843 return; |
| 844 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) | 844 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) |
| 845 [painter mouseExitedScroller]; | 845 [painter mouseExitedScroller]; |
| 846 } | 846 } |
| 847 | 847 |
| 848 void ScrollAnimatorMac::contentsResized() const | 848 void ScrollAnimatorMac::contentsResized() const |
| 849 { | 849 { |
| 850 if (!scrollableArea()->scrollbarsCanBeActive()) | 850 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 851 return; | 851 return; |
| 852 [m_scrollbarPainterController.get() contentAreaDidResize]; | 852 [m_scrollbarPainterController.get() contentAreaDidResize]; |
| 853 } | 853 } |
| 854 | 854 |
| 855 void ScrollAnimatorMac::contentAreaDidShow() const | 855 void ScrollAnimatorMac::contentAreaDidShow() const |
| 856 { | 856 { |
| 857 if (!scrollableArea()->scrollbarsCanBeActive()) | 857 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 858 return; | 858 return; |
| 859 [m_scrollbarPainterController.get() windowOrderedIn]; | 859 [m_scrollbarPainterController.get() windowOrderedIn]; |
| 860 } | 860 } |
| 861 | 861 |
| 862 void ScrollAnimatorMac::contentAreaDidHide() const | 862 void ScrollAnimatorMac::contentAreaDidHide() const |
| 863 { | 863 { |
| 864 if (!scrollableArea()->scrollbarsCanBeActive()) | 864 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 865 return; | 865 return; |
| 866 [m_scrollbarPainterController.get() windowOrderedOut]; | 866 [m_scrollbarPainterController.get() windowOrderedOut]; |
| 867 } | 867 } |
| 868 | 868 |
| 869 void ScrollAnimatorMac::didBeginScrollGesture() const | 869 void ScrollAnimatorMac::didBeginScrollGesture() const |
| 870 { | 870 { |
| 871 if (!scrollableArea()->scrollbarsCanBeActive()) | 871 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 872 return; | 872 return; |
| 873 [m_scrollbarPainterController.get() beginScrollGesture]; | 873 [m_scrollbarPainterController.get() beginScrollGesture]; |
| 874 } | 874 } |
| 875 | 875 |
| 876 void ScrollAnimatorMac::didEndScrollGesture() const | 876 void ScrollAnimatorMac::didEndScrollGesture() const |
| 877 { | 877 { |
| 878 if (!scrollableArea()->scrollbarsCanBeActive()) | 878 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 879 return; | 879 return; |
| 880 [m_scrollbarPainterController.get() endScrollGesture]; | 880 [m_scrollbarPainterController.get() endScrollGesture]; |
| 881 } | 881 } |
| 882 | 882 |
| 883 void ScrollAnimatorMac::mayBeginScrollGesture() const | 883 void ScrollAnimatorMac::mayBeginScrollGesture() const |
| 884 { | 884 { |
| 885 if (!scrollableArea()->scrollbarsCanBeActive()) | 885 if (!getScrollableArea()->scrollbarsCanBeActive()) |
| 886 return; | 886 return; |
| 887 [m_scrollbarPainterController.get() beginScrollGesture]; | 887 [m_scrollbarPainterController.get() beginScrollGesture]; |
| 888 [m_scrollbarPainterController.get() contentAreaScrolled]; | 888 [m_scrollbarPainterController.get() contentAreaScrolled]; |
| 889 } | 889 } |
| 890 | 890 |
| 891 void ScrollAnimatorMac::finishCurrentScrollAnimations() | 891 void ScrollAnimatorMac::finishCurrentScrollAnimations() |
| 892 { | 892 { |
| 893 [m_scrollbarPainterController.get() hideOverlayScrollers]; | 893 [m_scrollbarPainterController.get() hideOverlayScrollers]; |
| 894 } | 894 } |
| 895 | 895 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 if (!painter) | 958 if (!painter) |
| 959 return false; | 959 return false; |
| 960 return [painter knobAlpha] > 0; | 960 return [painter knobAlpha] > 0; |
| 961 } | 961 } |
| 962 | 962 |
| 963 void ScrollAnimatorMac::notifyContentAreaScrolled(const FloatSize& delta) | 963 void ScrollAnimatorMac::notifyContentAreaScrolled(const FloatSize& delta) |
| 964 { | 964 { |
| 965 // This function is called when a page is going into the page cache, but the
page | 965 // This function is called when a page is going into the page cache, but the
page |
| 966 // isn't really scrolling in that case. We should only pass the message on t
o the | 966 // isn't really scrolling in that case. We should only pass the message on t
o the |
| 967 // ScrollbarPainterController when we're really scrolling on an active page. | 967 // ScrollbarPainterController when we're really scrolling on an active page. |
| 968 if (scrollableArea()->scrollbarsCanBeActive()) | 968 if (getScrollableArea()->scrollbarsCanBeActive()) |
| 969 sendContentAreaScrolledSoon(delta); | 969 sendContentAreaScrolledSoon(delta); |
| 970 } | 970 } |
| 971 | 971 |
| 972 bool ScrollAnimatorMac::setScrollbarsVisibleForTesting(bool show) | 972 bool ScrollAnimatorMac::setScrollbarsVisibleForTesting(bool show) |
| 973 { | 973 { |
| 974 if (show) | 974 if (show) |
| 975 [m_scrollbarPainterController.get() flashScrollers]; | 975 [m_scrollbarPainterController.get() flashScrollers]; |
| 976 else | 976 else |
| 977 [m_scrollbarPainterController.get() hideOverlayScrollers]; | 977 [m_scrollbarPainterController.get() hideOverlayScrollers]; |
| 978 | 978 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 996 if (phase == PlatformWheelEventPhaseBegan) | 996 if (phase == PlatformWheelEventPhaseBegan) |
| 997 didBeginScrollGesture(); | 997 didBeginScrollGesture(); |
| 998 else if (phase == PlatformWheelEventPhaseEnded || phase == PlatformWheelEven
tPhaseCancelled) | 998 else if (phase == PlatformWheelEventPhaseEnded || phase == PlatformWheelEven
tPhaseCancelled) |
| 999 didEndScrollGesture(); | 999 didEndScrollGesture(); |
| 1000 else if (phase == PlatformWheelEventPhaseMayBegin) | 1000 else if (phase == PlatformWheelEventPhaseMayBegin) |
| 1001 mayBeginScrollGesture(); | 1001 mayBeginScrollGesture(); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 void ScrollAnimatorMac::updateScrollerStyle() | 1004 void ScrollAnimatorMac::updateScrollerStyle() |
| 1005 { | 1005 { |
| 1006 if (!scrollableArea()->scrollbarsCanBeActive()) { | 1006 if (!getScrollableArea()->scrollbarsCanBeActive()) { |
| 1007 m_needsScrollerStyleUpdate = true; | 1007 m_needsScrollerStyleUpdate = true; |
| 1008 return; | 1008 return; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 ScrollbarThemeMac* macTheme = macOverlayScrollbarTheme(); | 1011 ScrollbarThemeMac* macTheme = macOverlayScrollbarTheme(); |
| 1012 if (!macTheme) { | 1012 if (!macTheme) { |
| 1013 m_needsScrollerStyleUpdate = false; | 1013 m_needsScrollerStyleUpdate = false; |
| 1014 return; | 1014 return; |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle
]; | 1017 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle
]; |
| 1018 | 1018 |
| 1019 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) { | 1019 if (Scrollbar* verticalScrollbar = getScrollableArea()->verticalScrollbar())
{ |
| 1020 verticalScrollbar->setNeedsPaintInvalidation(AllParts); | 1020 verticalScrollbar->setNeedsPaintInvalidation(AllParts); |
| 1021 | 1021 |
| 1022 ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get(
) verticalScrollerImp]; | 1022 ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get(
) verticalScrollerImp]; |
| 1023 ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp
") scrollerImpWithStyle:newStyle | 1023 ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp
") scrollerImpWithStyle:newStyle |
| 1024
controlSize:(NSControlSize)verticalScrollbar->controlSize() | 1024
controlSize:(NSControlSize)verticalScrollbar->controlSize() |
| 1025
horizontal:NO | 1025
horizontal:NO |
| 1026
replacingScrollerImp:oldVerticalPainter]; | 1026
replacingScrollerImp:oldVerticalPainter]; |
| 1027 [m_scrollbarPainterController.get() setVerticalScrollerImp:newVerticalPa
inter]; | 1027 [m_scrollbarPainterController.get() setVerticalScrollerImp:newVerticalPa
inter]; |
| 1028 macTheme->setNewPainterForScrollbar(*verticalScrollbar, newVerticalPaint
er); | 1028 macTheme->setNewPainterForScrollbar(*verticalScrollbar, newVerticalPaint
er); |
| 1029 | 1029 |
| 1030 // The different scrollbar styles have different thicknesses, so we must
re-set the | 1030 // The different scrollbar styles have different thicknesses, so we must
re-set the |
| 1031 // frameRect to the new thickness, and the re-layout below will ensure t
he position | 1031 // frameRect to the new thickness, and the re-layout below will ensure t
he position |
| 1032 // and length are properly updated. | 1032 // and length are properly updated. |
| 1033 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlS
ize()); | 1033 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlS
ize()); |
| 1034 verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness)); | 1034 verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness)); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar()
) { | 1037 if (Scrollbar* horizontalScrollbar = getScrollableArea()->horizontalScrollba
r()) { |
| 1038 horizontalScrollbar->setNeedsPaintInvalidation(AllParts); | 1038 horizontalScrollbar->setNeedsPaintInvalidation(AllParts); |
| 1039 | 1039 |
| 1040 ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.ge
t() horizontalScrollerImp]; | 1040 ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.ge
t() horizontalScrollerImp]; |
| 1041 ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerI
mp") scrollerImpWithStyle:newStyle | 1041 ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerI
mp") scrollerImpWithStyle:newStyle |
| 1042
controlSize:(NSControlSize)horizontalScrollbar->controlSize() | 1042
controlSize:(NSControlSize)horizontalScrollbar->controlSize() |
| 1043
horizontal:YES | 1043
horizontal:YES |
| 1044
replacingScrollerImp:oldHorizontalPainter]; | 1044
replacingScrollerImp:oldHorizontalPainter]; |
| 1045 [m_scrollbarPainterController.get() setHorizontalScrollerImp:newHorizont
alPainter]; | 1045 [m_scrollbarPainterController.get() setHorizontalScrollerImp:newHorizont
alPainter]; |
| 1046 macTheme->setNewPainterForScrollbar(*horizontalScrollbar, newHorizontalP
ainter); | 1046 macTheme->setNewPainterForScrollbar(*horizontalScrollbar, newHorizontalP
ainter); |
| 1047 | 1047 |
| 1048 // The different scrollbar styles have different thicknesses, so we must
re-set the | 1048 // The different scrollbar styles have different thicknesses, so we must
re-set the |
| 1049 // frameRect to the new thickness, and the re-layout below will ensure t
he position | 1049 // frameRect to the new thickness, and the re-layout below will ensure t
he position |
| 1050 // and length are properly updated. | 1050 // and length are properly updated. |
| 1051 int thickness = macTheme->scrollbarThickness(horizontalScrollbar->contro
lSize()); | 1051 int thickness = macTheme->scrollbarThickness(horizontalScrollbar->contro
lSize()); |
| 1052 horizontalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness)); | 1052 horizontalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness)); |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 // If m_needsScrollerStyleUpdate is true, then the page is restoring from th
e page cache, and | 1055 // If m_needsScrollerStyleUpdate is true, then the page is restoring from th
e page cache, and |
| 1056 // a relayout will happen on its own. Otherwise, we must initiate a re-layou
t ourselves. | 1056 // a relayout will happen on its own. Otherwise, we must initiate a re-layou
t ourselves. |
| 1057 if (!m_needsScrollerStyleUpdate) | 1057 if (!m_needsScrollerStyleUpdate) |
| 1058 scrollableArea()->scrollbarStyleChanged(); | 1058 getScrollableArea()->scrollbarStyleChanged(); |
| 1059 | 1059 |
| 1060 m_needsScrollerStyleUpdate = false; | 1060 m_needsScrollerStyleUpdate = false; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 void ScrollAnimatorMac::startScrollbarPaintTimer() | 1063 void ScrollAnimatorMac::startScrollbarPaintTimer() |
| 1064 { | 1064 { |
| 1065 m_taskRunner->postDelayedTask(BLINK_FROM_HERE, m_initialScrollbarPaintTaskFa
ctory->cancelAndCreate(), 0.1); | 1065 m_taskRunner->postDelayedTask(BLINK_FROM_HERE, m_initialScrollbarPaintTaskFa
ctory->cancelAndCreate(), 0.1); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 bool ScrollAnimatorMac::scrollbarPaintTimerIsActive() const | 1068 bool ScrollAnimatorMac::scrollbarPaintTimerIsActive() const |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar()) | 1106 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar()) |
| 1107 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr
ollerThumb); | 1107 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr
ollerThumb); |
| 1108 | 1108 |
| 1109 if (rectInViewCoordinates == m_visibleScrollerThumbRect) | 1109 if (rectInViewCoordinates == m_visibleScrollerThumbRect) |
| 1110 return; | 1110 return; |
| 1111 | 1111 |
| 1112 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1112 m_visibleScrollerThumbRect = rectInViewCoordinates; |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |