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 "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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 // TODO(bokan): This should be merged with logicalScroll assuming | 156 // TODO(bokan): This should be merged with logicalScroll assuming |
157 // defaultSpaceEventHandler's chaining scroll can be done crossing frames. | 157 // defaultSpaceEventHandler's chaining scroll can be done crossing frames. |
158 bool ScrollManager::bubblingScroll(ScrollDirection direction, | 158 bool ScrollManager::bubblingScroll(ScrollDirection direction, |
159 ScrollGranularity granularity, | 159 ScrollGranularity granularity, |
160 Node* startingNode, | 160 Node* startingNode, |
161 Node* mousePressNode) { | 161 Node* mousePressNode) { |
162 // The layout needs to be up to date to determine if we can scroll. We may be | 162 // The layout needs to be up to date to determine if we can scroll. We may be |
163 // here because of an onLoad event, in which case the final layout hasn't been
performed yet. | 163 // here because of an onLoad event, in which case the final layout hasn't been |
| 164 // performed yet. |
164 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 165 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
165 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 166 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
166 if (logicalScroll(direction, granularity, startingNode, mousePressNode)) | 167 if (logicalScroll(direction, granularity, startingNode, mousePressNode)) |
167 return true; | 168 return true; |
168 | 169 |
169 Frame* parentFrame = m_frame->tree().parent(); | 170 Frame* parentFrame = m_frame->tree().parent(); |
170 if (!parentFrame || !parentFrame->isLocalFrame()) | 171 if (!parentFrame || !parentFrame->isLocalFrame()) |
171 return false; | 172 return false; |
172 // FIXME: Broken for OOPI. | 173 // FIXME: Broken for OOPI. |
173 return toLocalFrame(parentFrame) | 174 return toLocalFrame(parentFrame) |
(...skipping 21 matching lines...) Expand all Loading... |
195 scrollState.distributeToScrollChainDescendant(); | 196 scrollState.distributeToScrollChainDescendant(); |
196 } | 197 } |
197 | 198 |
198 WebInputEventResult ScrollManager::handleGestureScrollBegin( | 199 WebInputEventResult ScrollManager::handleGestureScrollBegin( |
199 const PlatformGestureEvent& gestureEvent) { | 200 const PlatformGestureEvent& gestureEvent) { |
200 Document* document = m_frame->document(); | 201 Document* document = m_frame->document(); |
201 | 202 |
202 if (document->layoutViewItem().isNull()) | 203 if (document->layoutViewItem().isNull()) |
203 return WebInputEventResult::NotHandled; | 204 return WebInputEventResult::NotHandled; |
204 | 205 |
205 // If there's no layoutObject on the node, send the event to the nearest ances
tor with a layoutObject. | 206 // If there's no layoutObject on the node, send the event to the nearest |
206 // Needed for <option> and <optgroup> elements so we can touch scroll <select>
s | 207 // ancestor with a layoutObject. Needed for <option> and <optgroup> elements |
| 208 // so we can touch scroll <select>s |
207 while (m_scrollGestureHandlingNode && | 209 while (m_scrollGestureHandlingNode && |
208 !m_scrollGestureHandlingNode->layoutObject()) | 210 !m_scrollGestureHandlingNode->layoutObject()) |
209 m_scrollGestureHandlingNode = | 211 m_scrollGestureHandlingNode = |
210 m_scrollGestureHandlingNode->parentOrShadowHostNode(); | 212 m_scrollGestureHandlingNode->parentOrShadowHostNode(); |
211 | 213 |
212 if (!m_scrollGestureHandlingNode) | 214 if (!m_scrollGestureHandlingNode) |
213 m_scrollGestureHandlingNode = m_frame->document()->documentElement(); | 215 m_scrollGestureHandlingNode = m_frame->document()->documentElement(); |
214 | 216 |
215 if (!m_scrollGestureHandlingNode) | 217 if (!m_scrollGestureHandlingNode) |
216 return WebInputEventResult::NotHandled; | 218 return WebInputEventResult::NotHandled; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 if (scrollbar->gestureEvent(targetedEvent.event(), &shouldUpdateCapture)) { | 534 if (scrollbar->gestureEvent(targetedEvent.event(), &shouldUpdateCapture)) { |
533 if (shouldUpdateCapture) | 535 if (shouldUpdateCapture) |
534 m_scrollbarHandlingScrollGesture = scrollbar; | 536 m_scrollbarHandlingScrollGesture = scrollbar; |
535 return true; | 537 return true; |
536 } | 538 } |
537 } | 539 } |
538 return false; | 540 return false; |
539 } | 541 } |
540 | 542 |
541 } // namespace blink | 543 } // namespace blink |
OLD | NEW |