| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 HitTestResult result(request, | 74 HitTestResult result(request, |
| 75 frame->view()->rootFrameToContents(pointInRootFrame)); | 75 frame->view()->rootFrameToContents(pointInRootFrame)); |
| 76 frame->contentLayoutItem().hitTest(result); | 76 frame->contentLayoutItem().hitTest(result); |
| 77 Node* node = result.innerPossiblyPseudoNode(); | 77 Node* node = result.innerPossiblyPseudoNode(); |
| 78 while (node && node->getNodeType() == Node::kTextNode) | 78 while (node && node->getNodeType() == Node::kTextNode) |
| 79 node = node->parentNode(); | 79 node = node->parentNode(); |
| 80 return node; | 80 return node; |
| 81 } | 81 } |
| 82 | 82 |
| 83 Node* hoveredNodeForEvent(LocalFrame* frame, | 83 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 84 const PlatformGestureEvent& event, | 84 const WebGestureEvent& event, |
| 85 bool ignorePointerEventsNone) { | 85 bool ignorePointerEventsNone) { |
| 86 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); | 86 return hoveredNodeForPoint(frame, |
| 87 roundedIntPoint(event.positionInRootFrame()), |
| 88 ignorePointerEventsNone); |
| 87 } | 89 } |
| 88 | 90 |
| 89 Node* hoveredNodeForEvent(LocalFrame* frame, | 91 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 90 const PlatformMouseEvent& event, | 92 const PlatformMouseEvent& event, |
| 91 bool ignorePointerEventsNone) { | 93 bool ignorePointerEventsNone) { |
| 92 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); | 94 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); |
| 93 } | 95 } |
| 94 | 96 |
| 95 Node* hoveredNodeForEvent(LocalFrame* frame, | 97 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 96 const PlatformTouchEvent& event, | 98 const PlatformTouchEvent& event, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 229 } |
| 228 | 230 |
| 229 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { | 231 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { |
| 230 bool handled = false; | 232 bool handled = false; |
| 231 | 233 |
| 232 if (isEmpty()) | 234 if (isEmpty()) |
| 233 return false; | 235 return false; |
| 234 | 236 |
| 235 if (WebInputEvent::isGestureEventType(inputEvent.type) && | 237 if (WebInputEvent::isGestureEventType(inputEvent.type) && |
| 236 inputEvent.type == WebInputEvent::GestureTap) { | 238 inputEvent.type == WebInputEvent::GestureTap) { |
| 237 // Only let GestureTab in (we only need it and we know | 239 // We only have a use for gesture tap. |
| 238 // PlatformGestureEventBuilder supports it). | 240 WebGestureEvent scaledEvent = TransformWebGestureEvent( |
| 239 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( | |
| 240 m_frameImpl->frameView(), | 241 m_frameImpl->frameView(), |
| 241 static_cast<const WebGestureEvent&>(inputEvent)); | 242 static_cast<const WebGestureEvent&>(inputEvent)); |
| 242 handled = handleGestureEvent(gestureEvent); | 243 handled = handleGestureEvent(scaledEvent); |
| 243 if (handled) | 244 if (handled) |
| 244 return true; | 245 return true; |
| 245 | 246 |
| 246 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); | 247 overlayMainFrame()->eventHandler().handleGestureEvent(scaledEvent); |
| 247 } | 248 } |
| 248 if (WebInputEvent::isMouseEventType(inputEvent.type) && | 249 if (WebInputEvent::isMouseEventType(inputEvent.type) && |
| 249 inputEvent.type != WebInputEvent::MouseEnter) { | 250 inputEvent.type != WebInputEvent::MouseEnter) { |
| 250 // PlatformMouseEventBuilder does not work with MouseEnter type, so we | 251 // PlatformMouseEventBuilder does not work with MouseEnter type, so we |
| 251 // filter it out manually. | 252 // filter it out manually. |
| 252 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( | 253 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( |
| 253 m_frameImpl->frameView(), | 254 m_frameImpl->frameView(), |
| 254 static_cast<const WebMouseEvent&>(inputEvent)); | 255 static_cast<const WebMouseEvent&>(inputEvent)); |
| 255 | 256 |
| 256 if (mouseEvent.type() == PlatformEvent::MouseMoved) | 257 if (mouseEvent.type() == PlatformEvent::MouseMoved) |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 return false; | 751 return false; |
| 751 | 752 |
| 752 if (m_hoveredNodeForInspectMode) { | 753 if (m_hoveredNodeForInspectMode) { |
| 753 inspect(m_hoveredNodeForInspectMode.get()); | 754 inspect(m_hoveredNodeForInspectMode.get()); |
| 754 m_hoveredNodeForInspectMode.clear(); | 755 m_hoveredNodeForInspectMode.clear(); |
| 755 return true; | 756 return true; |
| 756 } | 757 } |
| 757 return false; | 758 return false; |
| 758 } | 759 } |
| 759 | 760 |
| 760 bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) { | 761 bool InspectorOverlay::handleGestureEvent(const WebGestureEvent& event) { |
| 761 if (!shouldSearchForNode() || event.type() != PlatformEvent::GestureTap) | 762 if (!shouldSearchForNode() || event.type != WebInputEvent::GestureTap) |
| 762 return false; | 763 return false; |
| 763 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); | 764 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); |
| 764 if (node && m_inspectModeHighlightConfig) { | 765 if (node && m_inspectModeHighlightConfig) { |
| 765 highlightNode(node, *m_inspectModeHighlightConfig, false); | 766 highlightNode(node, *m_inspectModeHighlightConfig, false); |
| 766 inspect(node); | 767 inspect(node); |
| 767 return true; | 768 return true; |
| 768 } | 769 } |
| 769 return false; | 770 return false; |
| 770 } | 771 } |
| 771 | 772 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 784 bool InspectorOverlay::shouldSearchForNode() { | 785 bool InspectorOverlay::shouldSearchForNode() { |
| 785 return m_inspectMode != InspectorDOMAgent::NotSearching; | 786 return m_inspectMode != InspectorDOMAgent::NotSearching; |
| 786 } | 787 } |
| 787 | 788 |
| 788 void InspectorOverlay::inspect(Node* node) { | 789 void InspectorOverlay::inspect(Node* node) { |
| 789 if (m_domAgent) | 790 if (m_domAgent) |
| 790 m_domAgent->inspect(node); | 791 m_domAgent->inspect(node); |
| 791 } | 792 } |
| 792 | 793 |
| 793 } // namespace blink | 794 } // namespace blink |
| OLD | NEW |