| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 { | 209 { |
| 210 if (!_scrollableArea) | 210 if (!_scrollableArea) |
| 211 return NSZeroRect; | 211 return NSZeroRect; |
| 212 | 212 |
| 213 blink::IntSize contentsSize = _scrollableArea->contentsSize(); | 213 blink::IntSize contentsSize = _scrollableArea->contentsSize(); |
| 214 return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height()); | 214 return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height()); |
| 215 } | 215 } |
| 216 | 216 |
| 217 - (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair | 217 - (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair |
| 218 { | 218 { |
| 219 if (!_scrollableArea) | 219 return NO; |
| 220 return NO; | |
| 221 | |
| 222 return _scrollableArea->inLiveResize(); | |
| 223 } | 220 } |
| 224 | 221 |
| 225 - (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair | 222 - (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair |
| 226 { | 223 { |
| 227 if (!_scrollableArea) | 224 if (!_scrollableArea) |
| 228 return NSZeroPoint; | 225 return NSZeroPoint; |
| 229 | 226 |
| 230 return _scrollableArea->lastKnownMousePosition(); | 227 return _scrollableArea->lastKnownMousePosition(); |
| 231 } | 228 } |
| 232 | 229 |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 { | 838 { |
| 842 if (!scrollableArea()->scrollbarsCanBeActive()) | 839 if (!scrollableArea()->scrollbarsCanBeActive()) |
| 843 return; | 840 return; |
| 844 | 841 |
| 845 if (!supportsUIStateTransitionProgress()) | 842 if (!supportsUIStateTransitionProgress()) |
| 846 return; | 843 return; |
| 847 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) | 844 if (ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar)) |
| 848 [painter mouseExitedScroller]; | 845 [painter mouseExitedScroller]; |
| 849 } | 846 } |
| 850 | 847 |
| 851 void ScrollAnimatorMac::willStartLiveResize() | |
| 852 { | |
| 853 if (!scrollableArea()->scrollbarsCanBeActive()) | |
| 854 return; | |
| 855 [m_scrollbarPainterController.get() startLiveResize]; | |
| 856 } | |
| 857 | |
| 858 void ScrollAnimatorMac::contentsResized() const | 848 void ScrollAnimatorMac::contentsResized() const |
| 859 { | 849 { |
| 860 if (!scrollableArea()->scrollbarsCanBeActive()) | 850 if (!scrollableArea()->scrollbarsCanBeActive()) |
| 861 return; | 851 return; |
| 862 [m_scrollbarPainterController.get() contentAreaDidResize]; | 852 [m_scrollbarPainterController.get() contentAreaDidResize]; |
| 863 } | 853 } |
| 864 | 854 |
| 865 void ScrollAnimatorMac::willEndLiveResize() | |
| 866 { | |
| 867 if (!scrollableArea()->scrollbarsCanBeActive()) | |
| 868 return; | |
| 869 [m_scrollbarPainterController.get() endLiveResize]; | |
| 870 } | |
| 871 | |
| 872 void ScrollAnimatorMac::contentAreaDidShow() const | 855 void ScrollAnimatorMac::contentAreaDidShow() const |
| 873 { | 856 { |
| 874 if (!scrollableArea()->scrollbarsCanBeActive()) | 857 if (!scrollableArea()->scrollbarsCanBeActive()) |
| 875 return; | 858 return; |
| 876 [m_scrollbarPainterController.get() windowOrderedIn]; | 859 [m_scrollbarPainterController.get() windowOrderedIn]; |
| 877 } | 860 } |
| 878 | 861 |
| 879 void ScrollAnimatorMac::contentAreaDidHide() const | 862 void ScrollAnimatorMac::contentAreaDidHide() const |
| 880 { | 863 { |
| 881 if (!scrollableArea()->scrollbarsCanBeActive()) | 864 if (!scrollableArea()->scrollbarsCanBeActive()) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 { | 897 { |
| 915 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); | 898 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); |
| 916 if (!painter) | 899 if (!painter) |
| 917 return; | 900 return; |
| 918 | 901 |
| 919 ASSERT(!m_verticalScrollbarPainterDelegate); | 902 ASSERT(!m_verticalScrollbarPainterDelegate); |
| 920 m_verticalScrollbarPainterDelegate.adoptNS([[BlinkScrollbarPainterDelegate a
lloc] initWithScrollbar:&scrollbar]); | 903 m_verticalScrollbarPainterDelegate.adoptNS([[BlinkScrollbarPainterDelegate a
lloc] initWithScrollbar:&scrollbar]); |
| 921 | 904 |
| 922 [painter setDelegate:m_verticalScrollbarPainterDelegate.get()]; | 905 [painter setDelegate:m_verticalScrollbarPainterDelegate.get()]; |
| 923 [m_scrollbarPainterController.get() setVerticalScrollerImp:painter]; | 906 [m_scrollbarPainterController.get() setVerticalScrollerImp:painter]; |
| 924 if (scrollableArea()->inLiveResize()) | |
| 925 [painter setKnobAlpha:1]; | |
| 926 } | 907 } |
| 927 | 908 |
| 928 void ScrollAnimatorMac::willRemoveVerticalScrollbar(Scrollbar& scrollbar) | 909 void ScrollAnimatorMac::willRemoveVerticalScrollbar(Scrollbar& scrollbar) |
| 929 { | 910 { |
| 930 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); | 911 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); |
| 931 if (!painter) | 912 if (!painter) |
| 932 return; | 913 return; |
| 933 | 914 |
| 934 ASSERT(m_verticalScrollbarPainterDelegate); | 915 ASSERT(m_verticalScrollbarPainterDelegate); |
| 935 [m_verticalScrollbarPainterDelegate.get() invalidate]; | 916 [m_verticalScrollbarPainterDelegate.get() invalidate]; |
| 936 m_verticalScrollbarPainterDelegate = nullptr; | 917 m_verticalScrollbarPainterDelegate = nullptr; |
| 937 | 918 |
| 938 [painter setDelegate:nil]; | 919 [painter setDelegate:nil]; |
| 939 [m_scrollbarPainterController.get() setVerticalScrollerImp:nil]; | 920 [m_scrollbarPainterController.get() setVerticalScrollerImp:nil]; |
| 940 } | 921 } |
| 941 | 922 |
| 942 void ScrollAnimatorMac::didAddHorizontalScrollbar(Scrollbar& scrollbar) | 923 void ScrollAnimatorMac::didAddHorizontalScrollbar(Scrollbar& scrollbar) |
| 943 { | 924 { |
| 944 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); | 925 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); |
| 945 if (!painter) | 926 if (!painter) |
| 946 return; | 927 return; |
| 947 | 928 |
| 948 ASSERT(!m_horizontalScrollbarPainterDelegate); | 929 ASSERT(!m_horizontalScrollbarPainterDelegate); |
| 949 m_horizontalScrollbarPainterDelegate.adoptNS([[BlinkScrollbarPainterDelegate
alloc] initWithScrollbar:&scrollbar]); | 930 m_horizontalScrollbarPainterDelegate.adoptNS([[BlinkScrollbarPainterDelegate
alloc] initWithScrollbar:&scrollbar]); |
| 950 | 931 |
| 951 [painter setDelegate:m_horizontalScrollbarPainterDelegate.get()]; | 932 [painter setDelegate:m_horizontalScrollbarPainterDelegate.get()]; |
| 952 [m_scrollbarPainterController.get() setHorizontalScrollerImp:painter]; | 933 [m_scrollbarPainterController.get() setHorizontalScrollerImp:painter]; |
| 953 if (scrollableArea()->inLiveResize()) | |
| 954 [painter setKnobAlpha:1]; | |
| 955 } | 934 } |
| 956 | 935 |
| 957 void ScrollAnimatorMac::willRemoveHorizontalScrollbar(Scrollbar& scrollbar) | 936 void ScrollAnimatorMac::willRemoveHorizontalScrollbar(Scrollbar& scrollbar) |
| 958 { | 937 { |
| 959 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); | 938 ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar); |
| 960 if (!painter) | 939 if (!painter) |
| 961 return; | 940 return; |
| 962 | 941 |
| 963 ASSERT(m_horizontalScrollbarPainterDelegate); | 942 ASSERT(m_horizontalScrollbarPainterDelegate); |
| 964 [m_horizontalScrollbarPainterDelegate.get() invalidate]; | 943 [m_horizontalScrollbarPainterDelegate.get() invalidate]; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar()) | 1106 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar()) |
| 1128 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr
ollerThumb); | 1107 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr
ollerThumb); |
| 1129 | 1108 |
| 1130 if (rectInViewCoordinates == m_visibleScrollerThumbRect) | 1109 if (rectInViewCoordinates == m_visibleScrollerThumbRect) |
| 1131 return; | 1110 return; |
| 1132 | 1111 |
| 1133 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1112 m_visibleScrollerThumbRect = rectInViewCoordinates; |
| 1134 } | 1113 } |
| 1135 | 1114 |
| 1136 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |