Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: third_party/WebKit/Source/core/input/ScrollManager.cpp

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: rebase and update comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return GetAutoscrollController() && 78 return GetAutoscrollController() &&
79 GetAutoscrollController()->MiddleClickAutoscrollInProgress(); 79 GetAutoscrollController()->MiddleClickAutoscrollInProgress();
80 } 80 }
81 81
82 AutoscrollController* ScrollManager::GetAutoscrollController() const { 82 AutoscrollController* ScrollManager::GetAutoscrollController() const {
83 if (Page* page = frame_->GetPage()) 83 if (Page* page = frame_->GetPage())
84 return &page->GetAutoscrollController(); 84 return &page->GetAutoscrollController();
85 return nullptr; 85 return nullptr;
86 } 86 }
87 87
88 static bool CanPropagate(const ScrollState& scroll_state, 88 bool ScrollManager::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 bool x_dominant = 96 bool x_dominant =
97 std::abs(scroll_state.deltaXHint()) > std::abs(scroll_state.deltaYHint()); 97 std::abs(scroll_state.deltaXHint()) > std::abs(scroll_state.deltaYHint());
98 return (x_dominant && element.GetComputedStyle()->ScrollBoundaryBehaviorX() == 98 return (element == frame_->GetDocument()->ViewportDefiningElement(nullptr)) ||
99 (x_dominant && element.GetComputedStyle()->ScrollBoundaryBehaviorX() ==
99 EScrollBoundaryBehavior::kAuto) || 100 EScrollBoundaryBehavior::kAuto) ||
100 (!x_dominant && 101 (!x_dominant &&
101 element.GetComputedStyle()->ScrollBoundaryBehaviorY() == 102 element.GetComputedStyle()->ScrollBoundaryBehaviorY() ==
102 EScrollBoundaryBehavior::kAuto); 103 EScrollBoundaryBehavior::kAuto);
103 } 104 }
104 105
105 void ScrollManager::RecomputeScrollChain(const Node& start_node, 106 void ScrollManager::RecomputeScrollChain(const Node& start_node,
106 const ScrollState& scroll_state, 107 const ScrollState& scroll_state,
107 std::deque<int>& scroll_chain) { 108 std::deque<int>& scroll_chain) {
108 DCHECK(!scroll_chain.size()); 109 DCHECK(!scroll_chain.size());
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 &should_update_capture)) { 724 &should_update_capture)) {
724 if (should_update_capture) 725 if (should_update_capture)
725 scrollbar_handling_scroll_gesture_ = scrollbar; 726 scrollbar_handling_scroll_gesture_ = scrollbar;
726 return true; 727 return true;
727 } 728 }
728 } 729 }
729 return false; 730 return false;
730 } 731 }
731 732
732 } // namespace blink 733 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698