| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "core/inspector/InjectedScriptManager.h" | 63 #include "core/inspector/InjectedScriptManager.h" |
| 64 #include "core/inspector/InspectorHistory.h" | 64 #include "core/inspector/InspectorHistory.h" |
| 65 #include "core/inspector/InspectorOverlay.h" | 65 #include "core/inspector/InspectorOverlay.h" |
| 66 #include "core/inspector/InspectorPageAgent.h" | 66 #include "core/inspector/InspectorPageAgent.h" |
| 67 #include "core/inspector/InspectorState.h" | 67 #include "core/inspector/InspectorState.h" |
| 68 #include "core/inspector/InstrumentingAgents.h" | 68 #include "core/inspector/InstrumentingAgents.h" |
| 69 #include "core/loader/DocumentLoader.h" | 69 #include "core/loader/DocumentLoader.h" |
| 70 #include "core/page/Frame.h" | 70 #include "core/page/Frame.h" |
| 71 #include "core/page/FrameTree.h" | 71 #include "core/page/FrameTree.h" |
| 72 #include "core/page/Page.h" | 72 #include "core/page/Page.h" |
| 73 #include "core/platform/PlatformGestureEvent.h" |
| 73 #include "core/platform/PlatformMouseEvent.h" | 74 #include "core/platform/PlatformMouseEvent.h" |
| 74 #include "core/platform/PlatformTouchEvent.h" | 75 #include "core/platform/PlatformTouchEvent.h" |
| 75 #include "core/rendering/HitTestResult.h" | 76 #include "core/rendering/HitTestResult.h" |
| 76 #include "core/rendering/RenderView.h" | 77 #include "core/rendering/RenderView.h" |
| 77 #include "core/xml/DocumentXPathEvaluator.h" | 78 #include "core/xml/DocumentXPathEvaluator.h" |
| 78 #include "core/xml/XPathResult.h" | 79 #include "core/xml/XPathResult.h" |
| 79 #include "wtf/HashSet.h" | 80 #include "wtf/HashSet.h" |
| 80 #include "wtf/ListHashSet.h" | 81 #include "wtf/ListHashSet.h" |
| 81 #include "wtf/OwnPtr.h" | 82 #include "wtf/OwnPtr.h" |
| 82 #include "wtf/Vector.h" | 83 #include "wtf/Vector.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 hitType |= HitTestRequest::IgnorePointerEventsNone; | 156 hitType |= HitTestRequest::IgnorePointerEventsNone; |
| 156 HitTestRequest request(hitType); | 157 HitTestRequest request(hitType); |
| 157 HitTestResult result(frame->view()->windowToContents(point)); | 158 HitTestResult result(frame->view()->windowToContents(point)); |
| 158 frame->contentRenderer()->hitTest(request, result); | 159 frame->contentRenderer()->hitTest(request, result); |
| 159 Node* node = result.innerNode(); | 160 Node* node = result.innerNode(); |
| 160 while (node && node->nodeType() == Node::TEXT_NODE) | 161 while (node && node->nodeType() == Node::TEXT_NODE) |
| 161 node = node->parentNode(); | 162 node = node->parentNode(); |
| 162 return node; | 163 return node; |
| 163 } | 164 } |
| 164 | 165 |
| 166 static Node* hoveredNodeForEvent(Frame* frame, const PlatformGestureEvent& event
, bool ignorePointerEventsNone) |
| 167 { |
| 168 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone)
; |
| 169 } |
| 170 |
| 165 static Node* hoveredNodeForEvent(Frame* frame, const PlatformMouseEvent& event,
bool ignorePointerEventsNone) | 171 static Node* hoveredNodeForEvent(Frame* frame, const PlatformMouseEvent& event,
bool ignorePointerEventsNone) |
| 166 { | 172 { |
| 167 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone)
; | 173 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone)
; |
| 168 } | 174 } |
| 169 | 175 |
| 170 static Node* hoveredNodeForEvent(Frame* frame, const PlatformTouchEvent& event,
bool ignorePointerEventsNone) | 176 static Node* hoveredNodeForEvent(Frame* frame, const PlatformTouchEvent& event,
bool ignorePointerEventsNone) |
| 171 { | 177 { |
| 172 const Vector<PlatformTouchPoint>& points = event.touchPoints(); | 178 const Vector<PlatformTouchPoint>& points = event.touchPoints(); |
| 173 if (!points.size()) | 179 if (!points.size()) |
| 174 return 0; | 180 return 0; |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 if (m_searchingForNode == NotSearching) | 1052 if (m_searchingForNode == NotSearching) |
| 1047 return false; | 1053 return false; |
| 1048 | 1054 |
| 1049 if (Node* node = m_overlay->highlightedNode()) { | 1055 if (Node* node = m_overlay->highlightedNode()) { |
| 1050 inspect(node); | 1056 inspect(node); |
| 1051 return true; | 1057 return true; |
| 1052 } | 1058 } |
| 1053 return false; | 1059 return false; |
| 1054 } | 1060 } |
| 1055 | 1061 |
| 1062 bool InspectorDOMAgent::handleGestureEvent(Frame* frame, const PlatformGestureEv
ent& event) |
| 1063 { |
| 1064 if (m_searchingForNode == NotSearching || event.type() != PlatformEvent::Ges
tureTap) |
| 1065 return false; |
| 1066 Node* node = hoveredNodeForEvent(frame, event, false); |
| 1067 if (node && m_inspectModeHighlightConfig) { |
| 1068 m_overlay->highlightNode(node, 0 /* eventTarget */, *m_inspectModeHighli
ghtConfig); |
| 1069 inspect(node); |
| 1070 return true; |
| 1071 } |
| 1072 return false; |
| 1073 } |
| 1074 |
| 1056 bool InspectorDOMAgent::handleTouchEvent(Frame* frame, const PlatformTouchEvent&
event) | 1075 bool InspectorDOMAgent::handleTouchEvent(Frame* frame, const PlatformTouchEvent&
event) |
| 1057 { | 1076 { |
| 1058 if (m_searchingForNode == NotSearching) | 1077 if (m_searchingForNode == NotSearching) |
| 1059 return false; | 1078 return false; |
| 1060 Node* node = hoveredNodeForEvent(frame, event, false); | 1079 Node* node = hoveredNodeForEvent(frame, event, false); |
| 1061 if (node && m_inspectModeHighlightConfig) { | 1080 if (node && m_inspectModeHighlightConfig) { |
| 1062 m_overlay->highlightNode(node, 0 /* eventTarget */, *m_inspectModeHighli
ghtConfig); | 1081 m_overlay->highlightNode(node, 0 /* eventTarget */, *m_inspectModeHighli
ghtConfig); |
| 1063 inspect(node); | 1082 inspect(node); |
| 1064 return true; | 1083 return true; |
| 1065 } | 1084 } |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 | 1850 |
| 1832 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); | 1851 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); |
| 1833 if (injectedScript.hasNoValue()) | 1852 if (injectedScript.hasNoValue()) |
| 1834 return 0; | 1853 return 0; |
| 1835 | 1854 |
| 1836 return injectedScript.wrapNode(node, objectGroup); | 1855 return injectedScript.wrapNode(node, objectGroup); |
| 1837 } | 1856 } |
| 1838 | 1857 |
| 1839 } // namespace WebCore | 1858 } // namespace WebCore |
| 1840 | 1859 |
| OLD | NEW |