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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 void ScrollAnimatorMac::ImmediateScrollTo(const ScrollOffset& new_offset) { | 789 void ScrollAnimatorMac::ImmediateScrollTo(const ScrollOffset& new_offset) { |
790 ScrollOffset adjusted_offset = AdjustScrollOffsetIfNecessary(new_offset); | 790 ScrollOffset adjusted_offset = AdjustScrollOffsetIfNecessary(new_offset); |
791 | 791 |
792 bool offset_changed = adjusted_offset != current_offset_; | 792 bool offset_changed = adjusted_offset != current_offset_; |
793 if (!offset_changed && !GetScrollableArea()->ScrollOriginChanged()) | 793 if (!offset_changed && !GetScrollableArea()->ScrollOriginChanged()) |
794 return; | 794 return; |
795 | 795 |
796 ScrollOffset delta = adjusted_offset - current_offset_; | 796 ScrollOffset delta = adjusted_offset - current_offset_; |
797 | 797 |
798 current_offset_ = adjusted_offset; | 798 current_offset_ = adjusted_offset; |
799 NotifyContentAreaScrolled(delta); | 799 NotifyContentAreaScrolled(delta, kUserScroll); |
800 NotifyOffsetChanged(); | 800 NotifyOffsetChanged(); |
801 } | 801 } |
802 | 802 |
803 void ScrollAnimatorMac::ImmediateScrollToOffsetForScrollAnimation( | 803 void ScrollAnimatorMac::ImmediateScrollToOffsetForScrollAnimation( |
804 const ScrollOffset& new_offset) { | 804 const ScrollOffset& new_offset) { |
805 ASSERT(scroll_animation_helper_); | 805 ASSERT(scroll_animation_helper_); |
806 ImmediateScrollTo(new_offset); | 806 ImmediateScrollTo(new_offset); |
807 } | 807 } |
808 | 808 |
809 void ScrollAnimatorMac::ContentAreaWillPaint() const { | 809 void ScrollAnimatorMac::ContentAreaWillPaint() const { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 return; | 917 return; |
918 | 918 |
919 ASSERT(horizontal_scrollbar_painter_delegate_); | 919 ASSERT(horizontal_scrollbar_painter_delegate_); |
920 [horizontal_scrollbar_painter_delegate_.Get() invalidate]; | 920 [horizontal_scrollbar_painter_delegate_.Get() invalidate]; |
921 horizontal_scrollbar_painter_delegate_ = nullptr; | 921 horizontal_scrollbar_painter_delegate_ = nullptr; |
922 | 922 |
923 [painter setDelegate:nil]; | 923 [painter setDelegate:nil]; |
924 [scrollbar_painter_controller_.Get() setHorizontalScrollerImp:nil]; | 924 [scrollbar_painter_controller_.Get() setHorizontalScrollerImp:nil]; |
925 } | 925 } |
926 | 926 |
927 void ScrollAnimatorMac::NotifyContentAreaScrolled(const ScrollOffset& delta) { | 927 void ScrollAnimatorMac::NotifyContentAreaScrolled(const ScrollOffset& delta, |
| 928 ScrollType scrollType) { |
928 // This function is called when a page is going into the page cache, but the | 929 // This function is called when a page is going into the page cache, but the |
929 // page | 930 // page |
930 // isn't really scrolling in that case. We should only pass the message on to | 931 // isn't really scrolling in that case. We should only pass the message on to |
931 // the | 932 // the |
932 // ScrollbarPainterController when we're really scrolling on an active page. | 933 // ScrollbarPainterController when we're really scrolling on an active page. |
933 if (GetScrollableArea()->ScrollbarsCanBeActive()) | 934 if (IsExplicitScrollType(scrollType) && |
| 935 GetScrollableArea()->ScrollbarsCanBeActive()) |
934 SendContentAreaScrolledSoon(delta); | 936 SendContentAreaScrolledSoon(delta); |
935 } | 937 } |
936 | 938 |
937 bool ScrollAnimatorMac::SetScrollbarsVisibleForTesting(bool show) { | 939 bool ScrollAnimatorMac::SetScrollbarsVisibleForTesting(bool show) { |
938 if (show) | 940 if (show) |
939 [scrollbar_painter_controller_.Get() flashScrollers]; | 941 [scrollbar_painter_controller_.Get() flashScrollers]; |
940 else | 942 else |
941 [scrollbar_painter_controller_.Get() hideOverlayScrollers]; | 943 [scrollbar_painter_controller_.Get() hideOverlayScrollers]; |
942 | 944 |
943 [vertical_scrollbar_painter_delegate_.Get() updateVisibilityImmediately:show]; | 945 [vertical_scrollbar_painter_delegate_.Get() updateVisibilityImmediately:show]; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 rect_in_view_coordinates = | 1083 rect_in_view_coordinates = |
1082 vertical_scrollbar->ConvertToContainingFrameViewBase(scroller_thumb); | 1084 vertical_scrollbar->ConvertToContainingFrameViewBase(scroller_thumb); |
1083 | 1085 |
1084 if (rect_in_view_coordinates == visible_scroller_thumb_rect_) | 1086 if (rect_in_view_coordinates == visible_scroller_thumb_rect_) |
1085 return; | 1087 return; |
1086 | 1088 |
1087 visible_scroller_thumb_rect_ = rect_in_view_coordinates; | 1089 visible_scroller_thumb_rect_ = rect_in_view_coordinates; |
1088 } | 1090 } |
1089 | 1091 |
1090 } // namespace blink | 1092 } // namespace blink |
OLD | NEW |