| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 HitTestResult result(request, | 76 HitTestResult result(request, |
| 77 frame->view()->rootFrameToContents(pointInRootFrame)); | 77 frame->view()->rootFrameToContents(pointInRootFrame)); |
| 78 frame->contentLayoutItem().hitTest(result); | 78 frame->contentLayoutItem().hitTest(result); |
| 79 Node* node = result.innerPossiblyPseudoNode(); | 79 Node* node = result.innerPossiblyPseudoNode(); |
| 80 while (node && node->getNodeType() == Node::kTextNode) | 80 while (node && node->getNodeType() == Node::kTextNode) |
| 81 node = node->parentNode(); | 81 node = node->parentNode(); |
| 82 return node; | 82 return node; |
| 83 } | 83 } |
| 84 | 84 |
| 85 Node* hoveredNodeForEvent(LocalFrame* frame, | 85 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 86 const PlatformGestureEvent& event, | 86 const WebGestureEvent& event, |
| 87 bool ignorePointerEventsNone) { | 87 bool ignorePointerEventsNone) { |
| 88 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); | 88 return hoveredNodeForPoint(frame, |
| 89 roundedIntPoint(event.positionInRootFrame()), |
| 90 ignorePointerEventsNone); |
| 89 } | 91 } |
| 90 | 92 |
| 91 Node* hoveredNodeForEvent(LocalFrame* frame, | 93 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 92 const PlatformMouseEvent& event, | 94 const PlatformMouseEvent& event, |
| 93 bool ignorePointerEventsNone) { | 95 bool ignorePointerEventsNone) { |
| 94 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); | 96 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); |
| 95 } | 97 } |
| 96 | 98 |
| 97 Node* hoveredNodeForEvent(LocalFrame* frame, | 99 Node* hoveredNodeForEvent(LocalFrame* frame, |
| 98 const PlatformTouchEvent& event, | 100 const PlatformTouchEvent& event, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 236 } |
| 235 | 237 |
| 236 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { | 238 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { |
| 237 bool handled = false; | 239 bool handled = false; |
| 238 | 240 |
| 239 if (isEmpty()) | 241 if (isEmpty()) |
| 240 return false; | 242 return false; |
| 241 | 243 |
| 242 if (WebInputEvent::isGestureEventType(inputEvent.type) && | 244 if (WebInputEvent::isGestureEventType(inputEvent.type) && |
| 243 inputEvent.type == WebInputEvent::GestureTap) { | 245 inputEvent.type == WebInputEvent::GestureTap) { |
| 244 // Only let GestureTab in (we only need it and we know | 246 // Only let GestureTap in we only need. |
| 245 // PlatformGestureEventBuilder supports it). | 247 WebGestureEvent scaledEvent = |
| 246 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( | 248 ScaleWebGestureEvent(m_frameImpl->frameView(), |
| 247 m_frameImpl->frameView(), | 249 static_cast<const WebGestureEvent&>(inputEvent)); |
| 248 static_cast<const WebGestureEvent&>(inputEvent)); | 250 handled = handleGestureEvent(scaledEvent); |
| 249 handled = handleGestureEvent(gestureEvent); | |
| 250 if (handled) | 251 if (handled) |
| 251 return true; | 252 return true; |
| 252 | 253 |
| 253 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); | 254 overlayMainFrame()->eventHandler().handleGestureEvent(scaledEvent); |
| 254 } | 255 } |
| 255 if (WebInputEvent::isMouseEventType(inputEvent.type) && | 256 if (WebInputEvent::isMouseEventType(inputEvent.type) && |
| 256 inputEvent.type != WebInputEvent::MouseEnter) { | 257 inputEvent.type != WebInputEvent::MouseEnter) { |
| 257 // PlatformMouseEventBuilder does not work with MouseEnter type, so we | 258 // PlatformMouseEventBuilder does not work with MouseEnter type, so we |
| 258 // filter it out manually. | 259 // filter it out manually. |
| 259 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( | 260 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( |
| 260 m_frameImpl->frameView(), | 261 m_frameImpl->frameView(), |
| 261 static_cast<const WebMouseEvent&>(inputEvent)); | 262 static_cast<const WebMouseEvent&>(inputEvent)); |
| 262 | 263 |
| 263 if (mouseEvent.type() == PlatformEvent::MouseMoved) | 264 if (mouseEvent.type() == PlatformEvent::MouseMoved) |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 return false; | 826 return false; |
| 826 | 827 |
| 827 if (m_hoveredNodeForInspectMode) { | 828 if (m_hoveredNodeForInspectMode) { |
| 828 inspect(m_hoveredNodeForInspectMode.get()); | 829 inspect(m_hoveredNodeForInspectMode.get()); |
| 829 m_hoveredNodeForInspectMode.clear(); | 830 m_hoveredNodeForInspectMode.clear(); |
| 830 return true; | 831 return true; |
| 831 } | 832 } |
| 832 return false; | 833 return false; |
| 833 } | 834 } |
| 834 | 835 |
| 835 bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) { | 836 bool InspectorOverlay::handleGestureEvent(const WebGestureEvent& event) { |
| 836 if (!shouldSearchForNode() || event.type() != PlatformEvent::GestureTap) | 837 if (!shouldSearchForNode() || event.type != WebInputEvent::GestureTap) |
| 837 return false; | 838 return false; |
| 838 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); | 839 Node* node = hoveredNodeForEvent(m_frameImpl->frame(), event, false); |
| 839 if (node && m_inspectModeHighlightConfig) { | 840 if (node && m_inspectModeHighlightConfig) { |
| 840 highlightNode(node, *m_inspectModeHighlightConfig, false); | 841 highlightNode(node, *m_inspectModeHighlightConfig, false); |
| 841 inspect(node); | 842 inspect(node); |
| 842 return true; | 843 return true; |
| 843 } | 844 } |
| 844 return false; | 845 return false; |
| 845 } | 846 } |
| 846 | 847 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 874 !node->isElementNode() || !node->ownerDocument()->isActive() || | 875 !node->isElementNode() || !node->ownerDocument()->isActive() || |
| 875 !m_cssAgent || !m_domAgent) | 876 !m_cssAgent || !m_domAgent) |
| 876 return; | 877 return; |
| 877 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent, | 878 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent, |
| 878 &overlayMainFrame()->script()); | 879 &overlayMainFrame()->script()); |
| 879 toChromeClientImpl(m_frameImpl->frame()->host()->chromeClient()) | 880 toChromeClientImpl(m_frameImpl->frame()->host()->chromeClient()) |
| 880 .setCursorOverridden(true); | 881 .setCursorOverridden(true); |
| 881 } | 882 } |
| 882 | 883 |
| 883 } // namespace blink | 884 } // namespace blink |
| OLD | NEW |