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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // page cache, and | 1026 // page cache, and |
1027 // a relayout will happen on its own. Otherwise, we must initiate a re-layout | 1027 // a relayout will happen on its own. Otherwise, we must initiate a re-layout |
1028 // ourselves. | 1028 // ourselves. |
1029 if (!needs_scroller_style_update_) | 1029 if (!needs_scroller_style_update_) |
1030 GetScrollableArea()->ScrollbarStyleChanged(); | 1030 GetScrollableArea()->ScrollbarStyleChanged(); |
1031 | 1031 |
1032 needs_scroller_style_update_ = false; | 1032 needs_scroller_style_update_ = false; |
1033 } | 1033 } |
1034 | 1034 |
1035 void ScrollAnimatorMac::StartScrollbarPaintTimer() { | 1035 void ScrollAnimatorMac::StartScrollbarPaintTimer() { |
1036 initial_scrollbar_paint_task_handle_ = task_runner_->PostCancellableTask( | 1036 // Post a task with 1 ms delay to give a chance to run other immediate tasks |
1037 BLINK_FROM_HERE, WTF::Bind(&ScrollAnimatorMac::InitialScrollbarPaintTask, | 1037 // that may cancel this. |
1038 WrapWeakPersistent(this))); | 1038 initial_scrollbar_paint_task_handle_ = |
| 1039 task_runner_->PostDelayedCancellableTask( |
| 1040 BLINK_FROM_HERE, |
| 1041 WTF::Bind(&ScrollAnimatorMac::InitialScrollbarPaintTask, |
| 1042 WrapWeakPersistent(this)), |
| 1043 1); |
1039 } | 1044 } |
1040 | 1045 |
1041 bool ScrollAnimatorMac::ScrollbarPaintTimerIsActive() const { | 1046 bool ScrollAnimatorMac::ScrollbarPaintTimerIsActive() const { |
1042 return initial_scrollbar_paint_task_handle_.IsActive(); | 1047 return initial_scrollbar_paint_task_handle_.IsActive(); |
1043 } | 1048 } |
1044 | 1049 |
1045 void ScrollAnimatorMac::StopScrollbarPaintTimer() { | 1050 void ScrollAnimatorMac::StopScrollbarPaintTimer() { |
1046 initial_scrollbar_paint_task_handle_.Cancel(); | 1051 initial_scrollbar_paint_task_handle_.Cancel(); |
1047 } | 1052 } |
1048 | 1053 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 rect_in_view_coordinates = | 1088 rect_in_view_coordinates = |
1084 vertical_scrollbar->ConvertToContainingFrameViewBase(scroller_thumb); | 1089 vertical_scrollbar->ConvertToContainingFrameViewBase(scroller_thumb); |
1085 | 1090 |
1086 if (rect_in_view_coordinates == visible_scroller_thumb_rect_) | 1091 if (rect_in_view_coordinates == visible_scroller_thumb_rect_) |
1087 return; | 1092 return; |
1088 | 1093 |
1089 visible_scroller_thumb_rect_ = rect_in_view_coordinates; | 1094 visible_scroller_thumb_rect_ = rect_in_view_coordinates; |
1090 } | 1095 } |
1091 | 1096 |
1092 } // namespace blink | 1097 } // namespace blink |
OLD | NEW |