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/input/ScrollManager.h" | 5 #include "core/input/ScrollManager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/DOMNodeIds.h" | 8 #include "core/dom/DOMNodeIds.h" |
9 #include "core/dom/NodeComputedStyle.h" | 9 #include "core/dom/NodeComputedStyle.h" |
10 #include "core/events/GestureEvent.h" | 10 #include "core/events/GestureEvent.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 static bool CanPropagate(const ScrollState& scroll_state, | 88 static bool CanPropagate(const ScrollState& scroll_state, |
89 const Element& element) { | 89 const Element& element) { |
90 // ScrollBoundaryBehavior may have different values on x-axis and y-axis. | 90 // ScrollBoundaryBehavior may have different values on x-axis and y-axis. |
91 // We need to find out the dominant axis of user's intended scroll to decide | 91 // We need to find out the dominant axis of user's intended scroll to decide |
92 // which node's ScrollBoundaryBehavior should be applied, i.e. which the | 92 // which node's ScrollBoundaryBehavior should be applied, i.e. which the |
93 // scroll should be propagated from this node given its relevant* | 93 // scroll should be propagated from this node given its relevant* |
94 // ScrollBoundaryBehavior value. * relevant here depends on the dominant | 94 // ScrollBoundaryBehavior value. * relevant here depends on the dominant |
95 // axis of scroll gesture. | 95 // axis of scroll gesture. |
| 96 // We ignore the scroll-boundary-behavior if the element is not scrollable. |
| 97 if (!element.GetLayoutBox()->GetScrollableArea()) |
| 98 return true; |
96 bool x_dominant = | 99 bool x_dominant = |
97 std::abs(scroll_state.deltaXHint()) > std::abs(scroll_state.deltaYHint()); | 100 std::abs(scroll_state.deltaXHint()) > std::abs(scroll_state.deltaYHint()); |
98 return (x_dominant && element.GetComputedStyle()->ScrollBoundaryBehaviorX() == | 101 return (x_dominant && element.GetComputedStyle()->ScrollBoundaryBehaviorX() == |
99 EScrollBoundaryBehavior::kAuto) || | 102 EScrollBoundaryBehavior::kAuto) || |
100 (!x_dominant && | 103 (!x_dominant && |
101 element.GetComputedStyle()->ScrollBoundaryBehaviorY() == | 104 element.GetComputedStyle()->ScrollBoundaryBehaviorY() == |
102 EScrollBoundaryBehavior::kAuto); | 105 EScrollBoundaryBehavior::kAuto); |
103 } | 106 } |
104 | 107 |
105 void ScrollManager::RecomputeScrollChain(const Node& start_node, | 108 void ScrollManager::RecomputeScrollChain(const Node& start_node, |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 &should_update_capture)) { | 726 &should_update_capture)) { |
724 if (should_update_capture) | 727 if (should_update_capture) |
725 scrollbar_handling_scroll_gesture_ = scrollbar; | 728 scrollbar_handling_scroll_gesture_ = scrollbar; |
726 return true; | 729 return true; |
727 } | 730 } |
728 } | 731 } |
729 return false; | 732 return false; |
730 } | 733 } |
731 | 734 |
732 } // namespace blink | 735 } // namespace blink |
OLD | NEW |