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

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

Issue 2382913003: Revert of Fix scroll chaining for non-descendants of root scroller. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/dom/DOMNodeIds.h" 7 #include "core/dom/DOMNodeIds.h"
8 #include "core/events/GestureEvent.h" 8 #include "core/events/GestureEvent.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return nullptr; 76 return nullptr;
77 } 77 }
78 78
79 void ScrollManager::recomputeScrollChain(const Node& startNode, 79 void ScrollManager::recomputeScrollChain(const Node& startNode,
80 std::deque<int>& scrollChain) 80 std::deque<int>& scrollChain)
81 { 81 {
82 scrollChain.clear(); 82 scrollChain.clear();
83 83
84 DCHECK(startNode.layoutObject()); 84 DCHECK(startNode.layoutObject());
85 LayoutBox* curBox = startNode.layoutObject()->enclosingBox(); 85 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
86 Element* documentElement = m_frame->document()->documentElement();
87 86
88 // Scrolling propagates along the containing block chain and ends at the 87 // Scrolling propagates along the containing block chain and ends at the
89 // RootScroller element. The RootScroller element will have a custom 88 // RootScroller element. The RootScroller element will have a custom
90 // applyScroll callback that scrolls the frame or element. 89 // applyScroll callback that scrolls the frame or element.
91 while (curBox) { 90 while (curBox) {
92 Node* curNode = curBox->node(); 91 Node* curNode = curBox->node();
93 Element* curElement = nullptr; 92 Element* curElement = nullptr;
94 93
95 // FIXME: this should reject more elements, as part of crbug.com/410974. 94 // FIXME: this should reject more elements, as part of crbug.com/410974.
96 if (curNode && curNode->isElementNode()) { 95 if (curNode && curNode->isElementNode()) {
97 curElement = toElement(curNode); 96 curElement = toElement(curNode);
98 } else if (curNode && curNode->isDocumentNode()) { 97 } else if (curNode && curNode->isDocumentNode()) {
99 // In normal circumastances, the documentElement will be the root 98 // In normal circumastances, the documentElement will be the root
100 // scroller but the documentElement itself isn't a containing block, 99 // scroller but the documentElement itself isn't a containing block,
101 // that'll be the document node rather than the element. 100 // that'll be the document node rather than the element.
102 curElement = documentElement; 101 curElement = m_frame->document()->documentElement();
102 DCHECK(!curElement || isEffectiveRootScroller(*curElement));
103 } 103 }
104 104
105 if (curElement) { 105 if (curElement) {
106 scrollChain.push_front(DOMNodeIds::idForNode(curElement)); 106 scrollChain.push_front(DOMNodeIds::idForNode(curElement));
107 if (isEffectiveRootScroller(*curElement) 107 if (isEffectiveRootScroller(*curElement))
108 || curElement->isSameNode(documentElement))
109 break; 108 break;
110 } 109 }
111 110
112 curBox = curBox->containingBlock(); 111 curBox = curBox->containingBlock();
113 } 112 }
114 } 113 }
115 114
116 bool ScrollManager::logicalScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startNode, Node* mousePressNode) 115 bool ScrollManager::logicalScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startNode, Node* mousePressNode)
117 { 116 {
118 Node* node = startNode; 117 Node* node = startNode;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 DEFINE_TRACE(ScrollManager) 506 DEFINE_TRACE(ScrollManager)
508 { 507 {
509 visitor->trace(m_frame); 508 visitor->trace(m_frame);
510 visitor->trace(m_scrollGestureHandlingNode); 509 visitor->trace(m_scrollGestureHandlingNode);
511 visitor->trace(m_previousGestureScrolledNode); 510 visitor->trace(m_previousGestureScrolledNode);
512 visitor->trace(m_scrollbarHandlingScrollGesture); 511 visitor->trace(m_scrollbarHandlingScrollGesture);
513 visitor->trace(m_resizeScrollableArea); 512 visitor->trace(m_resizeScrollableArea);
514 } 513 }
515 514
516 } // namespace blink 515 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698