Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Side by Side Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/layout/HitTestResult.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 return true; 152 return true;
153 } 153 }
154 154
155 static Node* hoveredNodeForPoint(LocalFrame* frame, const IntPoint& pointInRootF rame, bool ignorePointerEventsNone) 155 static Node* hoveredNodeForPoint(LocalFrame* frame, const IntPoint& pointInRootF rame, bool ignorePointerEventsNone)
156 { 156 {
157 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitTestR equest::ReadOnly | HitTestRequest::AllowChildFrameContent; 157 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitTestR equest::ReadOnly | HitTestRequest::AllowChildFrameContent;
158 if (ignorePointerEventsNone) 158 if (ignorePointerEventsNone)
159 hitType |= HitTestRequest::IgnorePointerEventsNone; 159 hitType |= HitTestRequest::IgnorePointerEventsNone;
160 HitTestRequest request(hitType); 160 HitTestRequest request(hitType);
161 HitTestResult result(frame->view()->rootFrameToContents(pointInRootFrame)); 161 HitTestResult result(request, frame->view()->rootFrameToContents(pointInRoot Frame));
162 frame->contentRenderer()->hitTest(request, result); 162 frame->contentRenderer()->hitTest(result);
163 Node* node = result.innerPossiblyPseudoNode(); 163 Node* node = result.innerPossiblyPseudoNode();
164 while (node && node->nodeType() == Node::TEXT_NODE) 164 while (node && node->nodeType() == Node::TEXT_NODE)
165 node = node->parentNode(); 165 node = node->parentNode();
166 return node; 166 return node;
167 } 167 }
168 168
169 static Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformGestureEvent& event, bool ignorePointerEventsNone) 169 static Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformGestureEvent& event, bool ignorePointerEventsNone)
170 { 170 {
171 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone) ; 171 return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone) ;
172 } 172 }
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 bool result = InspectorHighlight::getBoxModel(node, model); 1526 bool result = InspectorHighlight::getBoxModel(node, model);
1527 if (!result) 1527 if (!result)
1528 *errorString = "Could not compute box model."; 1528 *errorString = "Could not compute box model.";
1529 } 1529 }
1530 1530
1531 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId) 1531 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId)
1532 { 1532 {
1533 if (!pushDocumentUponHandlelessOperation(errorString)) 1533 if (!pushDocumentUponHandlelessOperation(errorString))
1534 return; 1534 return;
1535 HitTestRequest request(HitTestRequest::Move | HitTestRequest::ReadOnly | Hit TestRequest::AllowChildFrameContent); 1535 HitTestRequest request(HitTestRequest::Move | HitTestRequest::ReadOnly | Hit TestRequest::AllowChildFrameContent);
1536 HitTestResult result(IntPoint(x, y)); 1536 HitTestResult result(request, IntPoint(x, y));
1537 m_document->frame()->contentRenderer()->hitTest(request, result); 1537 m_document->frame()->contentRenderer()->hitTest(result);
1538 Node* node = result.innerPossiblyPseudoNode(); 1538 Node* node = result.innerPossiblyPseudoNode();
1539 while (node && node->nodeType() == Node::TEXT_NODE) 1539 while (node && node->nodeType() == Node::TEXT_NODE)
1540 node = node->parentNode(); 1540 node = node->parentNode();
1541 if (!node) { 1541 if (!node) {
1542 *errorString = "No node found at given location"; 1542 *errorString = "No node found at given location";
1543 return; 1543 return;
1544 } 1544 }
1545 *nodeId = pushNodePathToFrontend(node); 1545 *nodeId = pushNodePathToFrontend(node);
1546 } 1546 }
1547 1547
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 visitor->trace(m_searchResults); 2299 visitor->trace(m_searchResults);
2300 #endif 2300 #endif
2301 visitor->trace(m_hoveredNodeForInspectMode); 2301 visitor->trace(m_hoveredNodeForInspectMode);
2302 visitor->trace(m_history); 2302 visitor->trace(m_history);
2303 visitor->trace(m_domEditor); 2303 visitor->trace(m_domEditor);
2304 visitor->trace(m_listener); 2304 visitor->trace(m_listener);
2305 InspectorBaseAgent::trace(visitor); 2305 InspectorBaseAgent::trace(visitor);
2306 } 2306 }
2307 2307
2308 } // namespace blink 2308 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/layout/HitTestResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698