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

Unified Diff: third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js

Issue 2800733004: [DevTools] Account for synthetic events in deepElementFromPoint() (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js
diff --git a/third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js b/third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js
index f9d202ca5a5707aecd46a3361aceb160e9e89138..8f6733c0421cbc65a36ad422cd7bdb48365d237f 100644
--- a/third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js
+++ b/third_party/WebKit/Source/devtools/front_end/dom_extension/DOMExtension.js
@@ -757,6 +757,9 @@ Node.prototype.setTextContentTruncatedIfNeeded = function(text, placeholder) {
* @return {?Node}
*/
Event.prototype.deepElementFromPoint = function() {
+ // Some synthetic events have zero coordinates which lead to a wrong element. Better return nothing in this case.
+ if (!this.which && !this.pageX && !this.pageY && !this.clientX && !this.clientY && !this.movementX && !this.movementY)
+ return null;
var root = this.target && this.target.getComponentRoot();
return root ? root.deepElementFromPoint(this.pageX, this.pageY) : null;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698