OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ignorePointerEventsNone); | 88 ignorePointerEventsNone); |
89 } | 89 } |
90 | 90 |
91 Node* hoveredNodeForEvent(LocalFrame* frame, | 91 Node* hoveredNodeForEvent(LocalFrame* frame, |
92 const PlatformMouseEvent& event, | 92 const PlatformMouseEvent& event, |
93 bool ignorePointerEventsNone) { | 93 bool ignorePointerEventsNone) { |
94 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); | 94 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); |
95 } | 95 } |
96 | 96 |
97 Node* hoveredNodeForEvent(LocalFrame* frame, | 97 Node* hoveredNodeForEvent(LocalFrame* frame, |
98 const PlatformTouchEvent& event, | 98 const WebTouchEvent& event, |
99 bool ignorePointerEventsNone) { | 99 bool ignorePointerEventsNone) { |
100 const Vector<PlatformTouchPoint>& points = event.touchPoints(); | 100 if (!event.touchesLength) |
101 if (!points.size()) | |
102 return nullptr; | 101 return nullptr; |
103 return hoveredNodeForPoint(frame, roundedIntPoint(points[0].pos()), | 102 WebTouchPoint transformedPoint = event.touchPointInRootFrame(0); |
| 103 return hoveredNodeForPoint(frame, roundedIntPoint(transformedPoint.position), |
104 ignorePointerEventsNone); | 104 ignorePointerEventsNone); |
105 } | 105 } |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 class InspectorOverlay::InspectorPageOverlayDelegate final | 108 class InspectorOverlay::InspectorPageOverlayDelegate final |
109 : public PageOverlay::Delegate { | 109 : public PageOverlay::Delegate { |
110 public: | 110 public: |
111 explicit InspectorPageOverlayDelegate(InspectorOverlay& overlay) | 111 explicit InspectorPageOverlayDelegate(InspectorOverlay& overlay) |
112 : m_overlay(&overlay) {} | 112 : m_overlay(&overlay) {} |
113 | 113 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 if (mouseEvent.type() == PlatformEvent::MousePressed) | 271 if (mouseEvent.type() == PlatformEvent::MousePressed) |
272 handled = overlayMainFrame()->eventHandler().handleMousePressEvent( | 272 handled = overlayMainFrame()->eventHandler().handleMousePressEvent( |
273 mouseEvent) != WebInputEventResult::NotHandled; | 273 mouseEvent) != WebInputEventResult::NotHandled; |
274 if (mouseEvent.type() == PlatformEvent::MouseReleased) | 274 if (mouseEvent.type() == PlatformEvent::MouseReleased) |
275 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent( | 275 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent( |
276 mouseEvent) != WebInputEventResult::NotHandled; | 276 mouseEvent) != WebInputEventResult::NotHandled; |
277 } | 277 } |
278 | 278 |
279 if (WebInputEvent::isTouchEventType(inputEvent.type())) { | 279 if (WebInputEvent::isTouchEventType(inputEvent.type())) { |
280 PlatformTouchEvent touchEvent = PlatformTouchEventBuilder( | 280 WebTouchEvent transformedEvent = |
281 m_frameImpl->frameView(), | 281 TransformWebTouchEvent(m_frameImpl->frameView(), |
282 static_cast<const WebTouchEvent&>(inputEvent)); | 282 static_cast<const WebTouchEvent&>(inputEvent)); |
283 handled = handleTouchEvent(touchEvent); | 283 handled = handleTouchEvent(transformedEvent); |
284 if (handled) | 284 if (handled) |
285 return true; | 285 return true; |
286 overlayMainFrame()->eventHandler().handleTouchEvent( | 286 overlayMainFrame()->eventHandler().handleTouchEvent( |
287 touchEvent, | 287 transformedEvent, Vector<WebTouchEvent>()); |
288 createPlatformTouchEventVector(m_frameImpl->frameView(), | |
289 std::vector<const WebInputEvent*>())); | |
290 } | 288 } |
291 if (WebInputEvent::isKeyboardEventType(inputEvent.type())) { | 289 if (WebInputEvent::isKeyboardEventType(inputEvent.type())) { |
292 overlayMainFrame()->eventHandler().keyEvent( | 290 overlayMainFrame()->eventHandler().keyEvent( |
293 static_cast<const WebKeyboardEvent&>(inputEvent)); | 291 static_cast<const WebKeyboardEvent&>(inputEvent)); |
294 } | 292 } |
295 | 293 |
296 if (inputEvent.type() == WebInputEvent::MouseWheel) { | 294 if (inputEvent.type() == WebInputEvent::MouseWheel) { |
297 WebMouseWheelEvent transformedEvent = TransformWebMouseWheelEvent( | 295 WebMouseWheelEvent transformedEvent = TransformWebMouseWheelEvent( |
298 m_frameImpl->frameView(), | 296 m_frameImpl->frameView(), |
299 static_cast<const WebMouseWheelEvent&>(inputEvent)); | 297 static_cast<const WebMouseWheelEvent&>(inputEvent)); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 return false; | 761 return false; |
764 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); | 762 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); |
765 if (node && m_inspectModeHighlightConfig) { | 763 if (node && m_inspectModeHighlightConfig) { |
766 highlightNode(node, *m_inspectModeHighlightConfig, false); | 764 highlightNode(node, *m_inspectModeHighlightConfig, false); |
767 inspect(node); | 765 inspect(node); |
768 return true; | 766 return true; |
769 } | 767 } |
770 return false; | 768 return false; |
771 } | 769 } |
772 | 770 |
773 bool InspectorOverlay::handleTouchEvent(const PlatformTouchEvent& event) { | 771 bool InspectorOverlay::handleTouchEvent(const WebTouchEvent& event) { |
774 if (!shouldSearchForNode()) | 772 if (!shouldSearchForNode()) |
775 return false; | 773 return false; |
776 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); | 774 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); |
777 if (node && m_inspectModeHighlightConfig) { | 775 if (node && m_inspectModeHighlightConfig) { |
778 highlightNode(node, *m_inspectModeHighlightConfig, false); | 776 highlightNode(node, *m_inspectModeHighlightConfig, false); |
779 inspect(node); | 777 inspect(node); |
780 return true; | 778 return true; |
781 } | 779 } |
782 return false; | 780 return false; |
783 } | 781 } |
784 | 782 |
785 bool InspectorOverlay::shouldSearchForNode() { | 783 bool InspectorOverlay::shouldSearchForNode() { |
786 return m_inspectMode != InspectorDOMAgent::NotSearching; | 784 return m_inspectMode != InspectorDOMAgent::NotSearching; |
787 } | 785 } |
788 | 786 |
789 void InspectorOverlay::inspect(Node* node) { | 787 void InspectorOverlay::inspect(Node* node) { |
790 if (m_domAgent) | 788 if (m_domAgent) |
791 m_domAgent->inspect(node); | 789 m_domAgent->inspect(node); |
792 } | 790 } |
793 | 791 |
794 } // namespace blink | 792 } // namespace blink |
OLD | NEW |