OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/page/scrolling/OverscrollController.h" | 5 #include "core/page/scrolling/OverscrollController.h" |
6 | 6 |
7 #include "core/frame/VisualViewport.h" | 7 #include "core/frame/VisualViewport.h" |
8 #include "core/page/ChromeClient.h" | 8 #include "core/page/ChromeClient.h" |
9 #include "platform/geometry/FloatPoint.h" | 9 #include "platform/geometry/FloatPoint.h" |
10 #include "platform/geometry/FloatSize.h" | 10 #include "platform/geometry/FloatSize.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 unused_delta.ScaledBy(visual_viewport_->Scale()); | 60 unused_delta.ScaledBy(visual_viewport_->Scale()); |
61 FloatSize velocity_in_viewport = | 61 FloatSize velocity_in_viewport = |
62 velocity_in_root_frame.ScaledBy(visual_viewport_->Scale()); | 62 velocity_in_root_frame.ScaledBy(visual_viewport_->Scale()); |
63 FloatPoint position_in_viewport = | 63 FloatPoint position_in_viewport = |
64 visual_viewport_->RootFrameToViewport(position_in_root_frame); | 64 visual_viewport_->RootFrameToViewport(position_in_root_frame); |
65 | 65 |
66 ResetAccumulated(scroll_result.did_scroll_x, scroll_result.did_scroll_y); | 66 ResetAccumulated(scroll_result.did_scroll_x, scroll_result.did_scroll_y); |
67 | 67 |
68 if (delta_in_viewport != FloatSize()) { | 68 if (delta_in_viewport != FloatSize()) { |
69 accumulated_root_overscroll_ += delta_in_viewport; | 69 accumulated_root_overscroll_ += delta_in_viewport; |
70 chrome_client_->DidOverscroll(delta_in_viewport, | 70 chrome_client_->DidOverscroll( |
71 accumulated_root_overscroll_, | 71 delta_in_viewport, accumulated_root_overscroll_, position_in_viewport, |
72 position_in_viewport, velocity_in_viewport); | 72 velocity_in_viewport, scroll_boundary_behavior_); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
| 76 void OverscrollController::SetScrollBoundaryBehavior( |
| 77 const WebScrollBoundaryBehavior& behavior) { |
| 78 if (behavior != scroll_boundary_behavior_) { |
| 79 scroll_boundary_behavior_ = behavior; |
| 80 chrome_client_->SetScrollBoundaryBehavior(behavior); |
| 81 } |
| 82 } |
| 83 |
76 } // namespace blink | 84 } // namespace blink |
OLD | NEW |