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/GestureManager.h" | 5 #include "core/input/GestureManager.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
9 #include "core/editing/SelectionController.h" | 9 #include "core/editing/SelectionController.h" |
10 #include "core/events/GestureEvent.h" | 10 #include "core/events/GestureEvent.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Do a new hit-test in case the mousemove event changed the DOM. | 168 // Do a new hit-test in case the mousemove event changed the DOM. |
169 // Note that if the original hit test wasn't over an element (eg. was over a | 169 // Note that if the original hit test wasn't over an element (eg. was over a |
170 // scrollbar) we don't want to re-hit-test because it may be in the wrong | 170 // scrollbar) we don't want to re-hit-test because it may be in the wrong |
171 // frame (and there's no way the page could have seen the event anyway). Also | 171 // frame (and there's no way the page could have seen the event anyway). Also |
172 // note that the position of the frame may have changed, so we need to | 172 // note that the position of the frame may have changed, so we need to |
173 // recompute the content co-ordinates (updating layout/style as | 173 // recompute the content co-ordinates (updating layout/style as |
174 // hitTestResultAtPoint normally would). | 174 // hitTestResultAtPoint normally would). |
175 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. | 175 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. |
176 // http://crbug.com/398920 | 176 // http://crbug.com/398920 |
177 if (current_hit_test.InnerNode()) { | 177 if (current_hit_test.InnerNode()) { |
178 LocalFrame* main_frame = frame_->LocalFrameRoot(); | 178 LocalFrame& main_frame = frame_->LocalFrameRoot(); |
179 if (main_frame && main_frame->View()) | 179 if (main_frame.View()) |
180 main_frame->View()->UpdateLifecycleToCompositingCleanPlusScrolling(); | 180 main_frame.View()->UpdateLifecycleToCompositingCleanPlusScrolling(); |
181 adjusted_point = frame_view->RootFrameToContents( | 181 adjusted_point = frame_view->RootFrameToContents( |
182 FlooredIntPoint(gesture_event.PositionInRootFrame())); | 182 FlooredIntPoint(gesture_event.PositionInRootFrame())); |
183 current_hit_test = EventHandlingUtil::HitTestResultInFrame( | 183 current_hit_test = EventHandlingUtil::HitTestResultInFrame( |
184 frame_, adjusted_point, hit_type); | 184 frame_, adjusted_point, hit_type); |
185 } | 185 } |
186 | 186 |
187 // Capture data for showUnhandledTapUIIfNeeded. | 187 // Capture data for showUnhandledTapUIIfNeeded. |
188 IntPoint tapped_position = | 188 IntPoint tapped_position = |
189 FlooredIntPoint(gesture_event.PositionInRootFrame()); | 189 FlooredIntPoint(gesture_event.PositionInRootFrame()); |
190 Node* tapped_node = current_hit_test.InnerNode(); | 190 Node* tapped_node = current_hit_test.InnerNode(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (current_hit_test.InnerNode()) { | 230 if (current_hit_test.InnerNode()) { |
231 DCHECK(gesture_event.GetType() == WebInputEvent::kGestureTap); | 231 DCHECK(gesture_event.GetType() == WebInputEvent::kGestureTap); |
232 HitTestResult result = current_hit_test; | 232 HitTestResult result = current_hit_test; |
233 result.SetToShadowHostIfInRestrictedShadowRoot(); | 233 result.SetToShadowHostIfInRestrictedShadowRoot(); |
234 frame_->GetChromeClient().OnMouseDown(*result.InnerNode()); | 234 frame_->GetChromeClient().OnMouseDown(*result.InnerNode()); |
235 } | 235 } |
236 | 236 |
237 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. | 237 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. |
238 // http://crbug.com/398920 | 238 // http://crbug.com/398920 |
239 if (current_hit_test.InnerNode()) { | 239 if (current_hit_test.InnerNode()) { |
240 LocalFrame* main_frame = frame_->LocalFrameRoot(); | 240 LocalFrame& main_frame = frame_->LocalFrameRoot(); |
241 if (main_frame && main_frame->View()) | 241 if (main_frame.View()) |
242 main_frame->View()->UpdateAllLifecyclePhases(); | 242 main_frame.View()->UpdateAllLifecyclePhases(); |
243 adjusted_point = frame_view->RootFrameToContents(tapped_position); | 243 adjusted_point = frame_view->RootFrameToContents(tapped_position); |
244 current_hit_test = EventHandlingUtil::HitTestResultInFrame( | 244 current_hit_test = EventHandlingUtil::HitTestResultInFrame( |
245 frame_, adjusted_point, hit_type); | 245 frame_, adjusted_point, hit_type); |
246 } | 246 } |
247 | 247 |
248 WebMouseEvent fake_mouse_up( | 248 WebMouseEvent fake_mouse_up( |
249 WebInputEvent::kMouseUp, gesture_event, | 249 WebInputEvent::kMouseUp, gesture_event, |
250 WebPointerProperties::Button::kLeft, gesture_event.TapCount(), | 250 WebPointerProperties::Button::kLeft, gesture_event.TapCount(), |
251 static_cast<WebInputEvent::Modifiers>( | 251 static_cast<WebInputEvent::Modifiers>( |
252 modifiers | WebInputEvent::Modifiers::kIsCompatibilityEventForTouch), | 252 modifiers | WebInputEvent::Modifiers::kIsCompatibilityEventForTouch), |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 428 } |
429 return WebInputEventResult::kNotHandled; | 429 return WebInputEventResult::kNotHandled; |
430 } | 430 } |
431 | 431 |
432 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() | 432 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() |
433 const { | 433 const { |
434 return last_show_press_timestamp_; | 434 return last_show_press_timestamp_; |
435 } | 435 } |
436 | 436 |
437 } // namespace blink | 437 } // namespace blink |
OLD | NEW |