OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 const LayoutPoint& point, | 261 const LayoutPoint& point, |
262 HitTestRequest::HitTestRequestType hit_type, | 262 HitTestRequest::HitTestRequestType hit_type, |
263 const LayoutSize& padding) { | 263 const LayoutSize& padding) { |
264 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); | 264 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); |
265 | 265 |
266 ASSERT((hit_type & HitTestRequest::kListBased) || padding.IsEmpty()); | 266 ASSERT((hit_type & HitTestRequest::kListBased) || padding.IsEmpty()); |
267 | 267 |
268 // We always send hitTestResultAtPoint to the main frame if we have one, | 268 // We always send hitTestResultAtPoint to the main frame if we have one, |
269 // otherwise we might hit areas that are obscured by higher frames. | 269 // otherwise we might hit areas that are obscured by higher frames. |
270 if (frame_->GetPage()) { | 270 if (frame_->GetPage()) { |
271 LocalFrame* main_frame = frame_->LocalFrameRoot(); | 271 LocalFrame& main_frame = frame_->LocalFrameRoot(); |
272 if (main_frame && frame_ != main_frame) { | 272 if (frame_ != &main_frame) { |
273 FrameView* frame_view = frame_->View(); | 273 FrameView* frame_view = frame_->View(); |
274 FrameView* main_view = main_frame->View(); | 274 FrameView* main_view = main_frame.View(); |
275 if (frame_view && main_view) { | 275 if (frame_view && main_view) { |
276 IntPoint main_frame_point = main_view->RootFrameToContents( | 276 IntPoint main_frame_point = main_view->RootFrameToContents( |
277 frame_view->ContentsToRootFrame(RoundedIntPoint(point))); | 277 frame_view->ContentsToRootFrame(RoundedIntPoint(point))); |
278 return main_frame->GetEventHandler().HitTestResultAtPoint( | 278 return main_frame.GetEventHandler().HitTestResultAtPoint( |
279 main_frame_point, hit_type, padding); | 279 main_frame_point, hit_type, padding); |
280 } | 280 } |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 // hitTestResultAtPoint is specifically used to hitTest into all frames, thus | 284 // hitTestResultAtPoint is specifically used to hitTest into all frames, thus |
285 // it always allows child frame content. | 285 // it always allows child frame content. |
286 HitTestRequest request(hit_type | HitTestRequest::kAllowChildFrameContent); | 286 HitTestRequest request(hit_type | HitTestRequest::kAllowChildFrameContent); |
287 HitTestResult result(request, point, padding.Height().ToUnsigned(), | 287 HitTestResult result(request, point, padding.Height().ToUnsigned(), |
288 padding.Width().ToUnsigned(), | 288 padding.Width().ToUnsigned(), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 ASSERT(frame_->GetDocument()); | 372 ASSERT(frame_->GetDocument()); |
373 | 373 |
374 UpdateCursor(); | 374 UpdateCursor(); |
375 } | 375 } |
376 | 376 |
377 void EventHandler::UpdateCursor() { | 377 void EventHandler::UpdateCursor() { |
378 TRACE_EVENT0("input", "EventHandler::updateCursor"); | 378 TRACE_EVENT0("input", "EventHandler::updateCursor"); |
379 | 379 |
380 // We must do a cross-frame hit test because the frame that triggered the | 380 // We must do a cross-frame hit test because the frame that triggered the |
381 // cursor update could be occluded by a different frame. | 381 // cursor update could be occluded by a different frame. |
382 ASSERT(frame_ == frame_->LocalFrameRoot()); | 382 CHECK(frame_ == &frame_->LocalFrameRoot()); |
haraken
2017/05/02 07:21:54
ASSERT should be replaced with DCHECK.
joelhockey
2017/05/02 07:48:23
thanks, I've made them all DCHECK_EQ
| |
383 | 383 |
384 FrameView* view = frame_->View(); | 384 FrameView* view = frame_->View(); |
385 if (!view || !view->ShouldSetCursor()) | 385 if (!view || !view->ShouldSetCursor()) |
386 return; | 386 return; |
387 | 387 |
388 LayoutViewItem layout_view_item = view->GetLayoutViewItem(); | 388 LayoutViewItem layout_view_item = view->GetLayoutViewItem(); |
389 if (layout_view_item.IsNull()) | 389 if (layout_view_item.IsNull()) |
390 return; | 390 return; |
391 | 391 |
392 frame_->GetDocument()->UpdateStyleAndLayout(); | 392 frame_->GetDocument()->UpdateStyleAndLayout(); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 capturing_mouse_events_node_ = mev.InnerNode(); | 631 capturing_mouse_events_node_ = mev.InnerNode(); |
632 event_handler_will_reset_capturing_mouse_events_node_ = true; | 632 event_handler_will_reset_capturing_mouse_events_node_ = true; |
633 } | 633 } |
634 mouse_event_manager_->InvalidateClick(); | 634 mouse_event_manager_->InvalidateClick(); |
635 return result; | 635 return result; |
636 } | 636 } |
637 | 637 |
638 UserGestureIndicator gesture_indicator( | 638 UserGestureIndicator gesture_indicator( |
639 DocumentUserGestureToken::Create(frame_->GetDocument())); | 639 DocumentUserGestureToken::Create(frame_->GetDocument())); |
640 frame_->LocalFrameRoot() | 640 frame_->LocalFrameRoot() |
641 ->GetEventHandler() | 641 .GetEventHandler() |
642 .last_mouse_down_user_gesture_token_ = | 642 .last_mouse_down_user_gesture_token_ = |
643 UserGestureIndicator::CurrentToken(); | 643 UserGestureIndicator::CurrentToken(); |
644 | 644 |
645 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { | 645 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
646 // We store whether middle click autoscroll is in progress before calling | 646 // We store whether middle click autoscroll is in progress before calling |
647 // stopAutoscroll() because it will set m_autoscrollType to NoAutoscroll on | 647 // stopAutoscroll() because it will set m_autoscrollType to NoAutoscroll on |
648 // return. | 648 // return. |
649 bool is_middle_click_autoscroll_in_progress = | 649 bool is_middle_click_autoscroll_in_progress = |
650 scroll_manager_->MiddleClickAutoscrollInProgress(); | 650 scroll_manager_->MiddleClickAutoscrollInProgress(); |
651 scroll_manager_->StopAutoscroll(); | 651 scroll_manager_->StopAutoscroll(); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
974 if (subframe) | 974 if (subframe) |
975 return PassMouseReleaseEventToSubframe(mev, subframe); | 975 return PassMouseReleaseEventToSubframe(mev, subframe); |
976 | 976 |
977 // Mouse events will be associated with the Document where mousedown | 977 // Mouse events will be associated with the Document where mousedown |
978 // occurred. If, e.g., there is a mousedown, then a drag to a different | 978 // occurred. If, e.g., there is a mousedown, then a drag to a different |
979 // Document and mouseup there, the mouseup's gesture will be associated with | 979 // Document and mouseup there, the mouseup's gesture will be associated with |
980 // the mousedown's Document. It's not absolutely certain that this is the | 980 // the mousedown's Document. It's not absolutely certain that this is the |
981 // correct behavior. | 981 // correct behavior. |
982 std::unique_ptr<UserGestureIndicator> gesture_indicator; | 982 std::unique_ptr<UserGestureIndicator> gesture_indicator; |
983 if (frame_->LocalFrameRoot() | 983 if (frame_->LocalFrameRoot() |
984 ->GetEventHandler() | 984 .GetEventHandler() |
985 .last_mouse_down_user_gesture_token_) { | 985 .last_mouse_down_user_gesture_token_) { |
986 gesture_indicator = WTF::WrapUnique(new UserGestureIndicator( | 986 gesture_indicator = WTF::WrapUnique(new UserGestureIndicator( |
987 frame_->LocalFrameRoot() | 987 frame_->LocalFrameRoot() |
988 ->GetEventHandler() | 988 .GetEventHandler() |
989 .last_mouse_down_user_gesture_token_.Release())); | 989 .last_mouse_down_user_gesture_token_.Release())); |
990 } else { | 990 } else { |
991 gesture_indicator = WTF::WrapUnique(new UserGestureIndicator( | 991 gesture_indicator = WTF::WrapUnique(new UserGestureIndicator( |
992 DocumentUserGestureToken::Create(frame_->GetDocument()))); | 992 DocumentUserGestureToken::Create(frame_->GetDocument()))); |
993 } | 993 } |
994 | 994 |
995 WebInputEventResult event_result = UpdatePointerTargetAndDispatchEvents( | 995 WebInputEventResult event_result = UpdatePointerTargetAndDispatchEvents( |
996 EventTypeNames::mouseup, mev.InnerNode(), mev.CanvasRegionId(), | 996 EventTypeNames::mouseup, mev.InnerNode(), mev.CanvasRegionId(), |
997 mev.Event(), Vector<WebMouseEvent>()); | 997 mev.Event(), Vector<WebMouseEvent>()); |
998 | 998 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 // If the target node is a text node, dispatch on the parent node - | 1168 // If the target node is a text node, dispatch on the parent node - |
1169 // rdar://4196646 | 1169 // rdar://4196646 |
1170 if (new_node_under_mouse && new_node_under_mouse->IsTextNode()) | 1170 if (new_node_under_mouse && new_node_under_mouse->IsTextNode()) |
1171 new_node_under_mouse = FlatTreeTraversal::Parent(*new_node_under_mouse); | 1171 new_node_under_mouse = FlatTreeTraversal::Parent(*new_node_under_mouse); |
1172 } | 1172 } |
1173 return new_node_under_mouse; | 1173 return new_node_under_mouse; |
1174 } | 1174 } |
1175 | 1175 |
1176 bool EventHandler::IsTouchPointerIdActiveOnFrame(int pointer_id, | 1176 bool EventHandler::IsTouchPointerIdActiveOnFrame(int pointer_id, |
1177 LocalFrame* frame) const { | 1177 LocalFrame* frame) const { |
1178 DCHECK_EQ(frame_, frame_->LocalFrameRoot()); | 1178 DCHECK_EQ(frame_, &frame_->LocalFrameRoot()); |
1179 return pointer_event_manager_->IsTouchPointerIdActiveOnFrame(pointer_id, | 1179 return pointer_event_manager_->IsTouchPointerIdActiveOnFrame(pointer_id, |
1180 frame); | 1180 frame); |
1181 } | 1181 } |
1182 | 1182 |
1183 bool EventHandler::RootFrameTouchPointerActiveInCurrentFrame( | 1183 bool EventHandler::RootFrameTouchPointerActiveInCurrentFrame( |
1184 int pointer_id) const { | 1184 int pointer_id) const { |
1185 return frame_ != frame_->LocalFrameRoot() && | 1185 return frame_ != &frame_->LocalFrameRoot() && |
1186 frame_->LocalFrameRoot() | 1186 frame_->LocalFrameRoot() |
1187 ->GetEventHandler() | 1187 .GetEventHandler() |
1188 .IsTouchPointerIdActiveOnFrame(pointer_id, frame_); | 1188 .IsTouchPointerIdActiveOnFrame(pointer_id, frame_); |
1189 } | 1189 } |
1190 | 1190 |
1191 bool EventHandler::IsPointerEventActive(int pointer_id) { | 1191 bool EventHandler::IsPointerEventActive(int pointer_id) { |
1192 return pointer_event_manager_->IsActive(pointer_id) || | 1192 return pointer_event_manager_->IsActive(pointer_id) || |
1193 RootFrameTouchPointerActiveInCurrentFrame(pointer_id); | 1193 RootFrameTouchPointerActiveInCurrentFrame(pointer_id); |
1194 } | 1194 } |
1195 | 1195 |
1196 void EventHandler::SetPointerCapture(int pointer_id, EventTarget* target) { | 1196 void EventHandler::SetPointerCapture(int pointer_id, EventTarget* target) { |
1197 // TODO(crbug.com/591387): This functionality should be per page not per | 1197 // TODO(crbug.com/591387): This functionality should be per page not per |
1198 // frame. | 1198 // frame. |
1199 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { | 1199 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { |
1200 frame_->LocalFrameRoot()->GetEventHandler().SetPointerCapture(pointer_id, | 1200 frame_->LocalFrameRoot().GetEventHandler().SetPointerCapture(pointer_id, |
1201 target); | 1201 target); |
1202 } else { | 1202 } else { |
1203 pointer_event_manager_->SetPointerCapture(pointer_id, target); | 1203 pointer_event_manager_->SetPointerCapture(pointer_id, target); |
1204 } | 1204 } |
1205 } | 1205 } |
1206 | 1206 |
1207 void EventHandler::ReleasePointerCapture(int pointer_id, EventTarget* target) { | 1207 void EventHandler::ReleasePointerCapture(int pointer_id, EventTarget* target) { |
1208 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { | 1208 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { |
1209 frame_->LocalFrameRoot()->GetEventHandler().ReleasePointerCapture( | 1209 frame_->LocalFrameRoot().GetEventHandler().ReleasePointerCapture(pointer_id, |
1210 pointer_id, target); | 1210 target); |
1211 } else { | 1211 } else { |
1212 pointer_event_manager_->ReleasePointerCapture(pointer_id, target); | 1212 pointer_event_manager_->ReleasePointerCapture(pointer_id, target); |
1213 } | 1213 } |
1214 } | 1214 } |
1215 | 1215 |
1216 bool EventHandler::HasPointerCapture(int pointer_id, | 1216 bool EventHandler::HasPointerCapture(int pointer_id, |
1217 const EventTarget* target) const { | 1217 const EventTarget* target) const { |
1218 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { | 1218 if (RootFrameTouchPointerActiveInCurrentFrame(pointer_id)) { |
1219 return frame_->LocalFrameRoot()->GetEventHandler().HasPointerCapture( | 1219 return frame_->LocalFrameRoot().GetEventHandler().HasPointerCapture( |
1220 pointer_id, target); | 1220 pointer_id, target); |
1221 } else { | 1221 } else { |
1222 return pointer_event_manager_->HasPointerCapture(pointer_id, target); | 1222 return pointer_event_manager_->HasPointerCapture(pointer_id, target); |
1223 } | 1223 } |
1224 } | 1224 } |
1225 | 1225 |
1226 bool EventHandler::HasProcessedPointerCapture(int pointer_id, | 1226 bool EventHandler::HasProcessedPointerCapture(int pointer_id, |
1227 const EventTarget* target) const { | 1227 const EventTarget* target) const { |
1228 return pointer_event_manager_->HasProcessedPointerCapture(pointer_id, target); | 1228 return pointer_event_manager_->HasProcessedPointerCapture(pointer_id, target); |
1229 } | 1229 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1304 if (dom_event_result != DispatchEventResult::kNotCanceled) | 1304 if (dom_event_result != DispatchEventResult::kNotCanceled) |
1305 return EventHandlingUtil::ToWebInputEventResult(dom_event_result); | 1305 return EventHandlingUtil::ToWebInputEventResult(dom_event_result); |
1306 } | 1306 } |
1307 | 1307 |
1308 return WebInputEventResult::kNotHandled; | 1308 return WebInputEventResult::kNotHandled; |
1309 } | 1309 } |
1310 | 1310 |
1311 WebInputEventResult EventHandler::HandleGestureEvent( | 1311 WebInputEventResult EventHandler::HandleGestureEvent( |
1312 const WebGestureEvent& gesture_event) { | 1312 const WebGestureEvent& gesture_event) { |
1313 // Propagation to inner frames is handled below this function. | 1313 // Propagation to inner frames is handled below this function. |
1314 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1314 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1315 DCHECK_NE(0, gesture_event.FrameScale()); | 1315 DCHECK_NE(0, gesture_event.FrameScale()); |
1316 | 1316 |
1317 // Scrolling-related gesture events invoke EventHandler recursively for each | 1317 // Scrolling-related gesture events invoke EventHandler recursively for each |
1318 // frame down the chain, doing a single-frame hit-test per frame. This matches | 1318 // frame down the chain, doing a single-frame hit-test per frame. This matches |
1319 // handleWheelEvent. | 1319 // handleWheelEvent. |
1320 // FIXME: Add a test that traverses this path, e.g. for devtools overlay. | 1320 // FIXME: Add a test that traverses this path, e.g. for devtools overlay. |
1321 if (gesture_event.IsScrollEvent()) | 1321 if (gesture_event.IsScrollEvent()) |
1322 return HandleGestureScrollEvent(gesture_event); | 1322 return HandleGestureScrollEvent(gesture_event); |
1323 | 1323 |
1324 // Hit test across all frames and do touch adjustment as necessary for the | 1324 // Hit test across all frames and do touch adjustment as necessary for the |
1325 // event type. | 1325 // event type. |
1326 GestureEventWithHitTestResults targeted_event = | 1326 GestureEventWithHitTestResults targeted_event = |
1327 TargetGestureEvent(gesture_event); | 1327 TargetGestureEvent(gesture_event); |
1328 | 1328 |
1329 return HandleGestureEvent(targeted_event); | 1329 return HandleGestureEvent(targeted_event); |
1330 } | 1330 } |
1331 | 1331 |
1332 WebInputEventResult EventHandler::HandleGestureEvent( | 1332 WebInputEventResult EventHandler::HandleGestureEvent( |
1333 const GestureEventWithHitTestResults& targeted_event) { | 1333 const GestureEventWithHitTestResults& targeted_event) { |
1334 TRACE_EVENT0("input", "EventHandler::handleGestureEvent"); | 1334 TRACE_EVENT0("input", "EventHandler::handleGestureEvent"); |
1335 if (!frame_->GetPage()) | 1335 if (!frame_->GetPage()) |
1336 return WebInputEventResult::kNotHandled; | 1336 return WebInputEventResult::kNotHandled; |
1337 | 1337 |
1338 // Propagation to inner frames is handled below this function. | 1338 // Propagation to inner frames is handled below this function. |
1339 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1339 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1340 | 1340 |
1341 // Non-scrolling related gesture events do a single cross-frame hit-test and | 1341 // Non-scrolling related gesture events do a single cross-frame hit-test and |
1342 // jump directly to the inner most frame. This matches handleMousePressEvent | 1342 // jump directly to the inner most frame. This matches handleMousePressEvent |
1343 // etc. | 1343 // etc. |
1344 ASSERT(!targeted_event.Event().IsScrollEvent()); | 1344 ASSERT(!targeted_event.Event().IsScrollEvent()); |
1345 | 1345 |
1346 // Update mouseout/leave/over/enter events before jumping directly to the | 1346 // Update mouseout/leave/over/enter events before jumping directly to the |
1347 // inner most frame. | 1347 // inner most frame. |
1348 if (targeted_event.Event().GetType() == WebInputEvent::kGestureTap) | 1348 if (targeted_event.Event().GetType() == WebInputEvent::kGestureTap) |
1349 UpdateGestureTargetNodeForMouseEvent(targeted_event); | 1349 UpdateGestureTargetNodeForMouseEvent(targeted_event); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 touch_rect, HeapVector<Member<Node>>(nodes)); | 1473 touch_rect, HeapVector<Member<Node>>(nodes)); |
1474 } | 1474 } |
1475 | 1475 |
1476 // Update the hover and active state across all frames for this gesture. | 1476 // Update the hover and active state across all frames for this gesture. |
1477 // This logic is different than the mouse case because mice send MouseLeave | 1477 // This logic is different than the mouse case because mice send MouseLeave |
1478 // events to frames as they're exited. With gestures, a single event | 1478 // events to frames as they're exited. With gestures, a single event |
1479 // conceptually both 'leaves' whatever frame currently had hover and enters a | 1479 // conceptually both 'leaves' whatever frame currently had hover and enters a |
1480 // new frame | 1480 // new frame |
1481 void EventHandler::UpdateGestureHoverActiveState(const HitTestRequest& request, | 1481 void EventHandler::UpdateGestureHoverActiveState(const HitTestRequest& request, |
1482 Element* inner_element) { | 1482 Element* inner_element) { |
1483 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1483 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1484 | 1484 |
1485 HeapVector<Member<LocalFrame>> new_hover_frame_chain; | 1485 HeapVector<Member<LocalFrame>> new_hover_frame_chain; |
1486 LocalFrame* new_hover_frame_in_document = | 1486 LocalFrame* new_hover_frame_in_document = |
1487 inner_element ? inner_element->GetDocument().GetFrame() : nullptr; | 1487 inner_element ? inner_element->GetDocument().GetFrame() : nullptr; |
1488 // Insert the ancestors of the frame having the new hovered element to the | 1488 // Insert the ancestors of the frame having the new hovered element to the |
1489 // frame chain. The frame chain doesn't include the main frame to avoid the | 1489 // frame chain. The frame chain doesn't include the main frame to avoid the |
1490 // redundant work that cleans the hover state because the hover state for the | 1490 // redundant work that cleans the hover state because the hover state for the |
1491 // main frame is updated by calling Document::updateHoverActiveState. | 1491 // main frame is updated by calling Document::updateHoverActiveState. |
1492 while (new_hover_frame_in_document && new_hover_frame_in_document != frame_) { | 1492 while (new_hover_frame_in_document && new_hover_frame_in_document != frame_) { |
1493 new_hover_frame_chain.push_back(new_hover_frame_in_document); | 1493 new_hover_frame_chain.push_back(new_hover_frame_in_document); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1534 // Recursively set the new active/hover states on every frame in the chain of | 1534 // Recursively set the new active/hover states on every frame in the chain of |
1535 // innerElement. | 1535 // innerElement. |
1536 frame_->GetDocument()->UpdateHoverActiveState(request, inner_element); | 1536 frame_->GetDocument()->UpdateHoverActiveState(request, inner_element); |
1537 } | 1537 } |
1538 | 1538 |
1539 // Update the mouseover/mouseenter/mouseout/mouseleave events across all frames | 1539 // Update the mouseover/mouseenter/mouseout/mouseleave events across all frames |
1540 // for this gesture, before passing the targeted gesture event directly to a hit | 1540 // for this gesture, before passing the targeted gesture event directly to a hit |
1541 // frame. | 1541 // frame. |
1542 void EventHandler::UpdateGestureTargetNodeForMouseEvent( | 1542 void EventHandler::UpdateGestureTargetNodeForMouseEvent( |
1543 const GestureEventWithHitTestResults& targeted_event) { | 1543 const GestureEventWithHitTestResults& targeted_event) { |
1544 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1544 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1545 | 1545 |
1546 // Behaviour of this function is as follows: | 1546 // Behaviour of this function is as follows: |
1547 // - Create the chain of all entered frames. | 1547 // - Create the chain of all entered frames. |
1548 // - Compare the last frame chain under the gesture to newly entered frame | 1548 // - Compare the last frame chain under the gesture to newly entered frame |
1549 // chain from the main frame one by one. | 1549 // chain from the main frame one by one. |
1550 // - If the last frame doesn't match with the entered frame, then create the | 1550 // - If the last frame doesn't match with the entered frame, then create the |
1551 // chain of exited frames from the last frame chain. | 1551 // chain of exited frames from the last frame chain. |
1552 // - Dispatch mouseout/mouseleave events of the exited frames from the inside | 1552 // - Dispatch mouseout/mouseleave events of the exited frames from the inside |
1553 // out. | 1553 // out. |
1554 // - Dispatch mouseover/mouseenter events of the entered frames into the | 1554 // - Dispatch mouseover/mouseenter events of the entered frames into the |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1631 String(), fake_mouse_move); | 1631 String(), fake_mouse_move); |
1632 } | 1632 } |
1633 } | 1633 } |
1634 } | 1634 } |
1635 | 1635 |
1636 GestureEventWithHitTestResults EventHandler::TargetGestureEvent( | 1636 GestureEventWithHitTestResults EventHandler::TargetGestureEvent( |
1637 const WebGestureEvent& gesture_event, | 1637 const WebGestureEvent& gesture_event, |
1638 bool read_only) { | 1638 bool read_only) { |
1639 TRACE_EVENT0("input", "EventHandler::targetGestureEvent"); | 1639 TRACE_EVENT0("input", "EventHandler::targetGestureEvent"); |
1640 | 1640 |
1641 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1641 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1642 // Scrolling events get hit tested per frame (like wheel events do). | 1642 // Scrolling events get hit tested per frame (like wheel events do). |
1643 ASSERT(!gesture_event.IsScrollEvent()); | 1643 ASSERT(!gesture_event.IsScrollEvent()); |
1644 | 1644 |
1645 HitTestRequest::HitTestRequestType hit_type = | 1645 HitTestRequest::HitTestRequestType hit_type = |
1646 gesture_manager_->GetHitTypeForGestureType(gesture_event.GetType()); | 1646 gesture_manager_->GetHitTypeForGestureType(gesture_event.GetType()); |
1647 TimeDelta active_interval; | 1647 TimeDelta active_interval; |
1648 bool should_keep_active_for_min_interval = false; | 1648 bool should_keep_active_for_min_interval = false; |
1649 if (read_only) { | 1649 if (read_only) { |
1650 hit_type |= HitTestRequest::kReadOnly; | 1650 hit_type |= HitTestRequest::kReadOnly; |
1651 } else if (gesture_event.GetType() == WebInputEvent::kGestureTap && | 1651 } else if (gesture_event.GetType() == WebInputEvent::kGestureTap && |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1899 void EventHandler::ScheduleHoverStateUpdate() { | 1899 void EventHandler::ScheduleHoverStateUpdate() { |
1900 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. | 1900 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. |
1901 if (!hover_timer_.IsActive() && | 1901 if (!hover_timer_.IsActive() && |
1902 !mouse_event_manager_->IsMousePositionUnknown()) | 1902 !mouse_event_manager_->IsMousePositionUnknown()) |
1903 hover_timer_.StartOneShot(0, BLINK_FROM_HERE); | 1903 hover_timer_.StartOneShot(0, BLINK_FROM_HERE); |
1904 } | 1904 } |
1905 | 1905 |
1906 void EventHandler::ScheduleCursorUpdate() { | 1906 void EventHandler::ScheduleCursorUpdate() { |
1907 // We only want one timer for the page, rather than each frame having it's own | 1907 // We only want one timer for the page, rather than each frame having it's own |
1908 // timer competing which eachother (since there's only one mouse cursor). | 1908 // timer competing which eachother (since there's only one mouse cursor). |
1909 ASSERT(frame_ == frame_->LocalFrameRoot()); | 1909 CHECK(frame_ == &frame_->LocalFrameRoot()); |
1910 | 1910 |
1911 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. | 1911 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. |
1912 if (!cursor_update_timer_.IsActive()) | 1912 if (!cursor_update_timer_.IsActive()) |
1913 cursor_update_timer_.StartOneShot(kCursorUpdateInterval, BLINK_FROM_HERE); | 1913 cursor_update_timer_.StartOneShot(kCursorUpdateInterval, BLINK_FROM_HERE); |
1914 } | 1914 } |
1915 | 1915 |
1916 bool EventHandler::CursorUpdatePending() { | 1916 bool EventHandler::CursorUpdatePending() { |
1917 return cursor_update_timer_.IsActive(); | 1917 return cursor_update_timer_.IsActive(); |
1918 } | 1918 } |
1919 | 1919 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2117 MouseEventWithHitTestResults& mev, | 2117 MouseEventWithHitTestResults& mev, |
2118 LocalFrame* subframe) { | 2118 LocalFrame* subframe) { |
2119 WebInputEventResult result = | 2119 WebInputEventResult result = |
2120 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); | 2120 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); |
2121 if (result != WebInputEventResult::kNotHandled) | 2121 if (result != WebInputEventResult::kNotHandled) |
2122 return result; | 2122 return result; |
2123 return WebInputEventResult::kHandledSystem; | 2123 return WebInputEventResult::kHandledSystem; |
2124 } | 2124 } |
2125 | 2125 |
2126 } // namespace blink | 2126 } // namespace blink |
OLD | NEW |