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

Unified Diff: Source/devtools/front_end/ui/DOMExtension.js

Issue 661103002: DevTools: make web component anchor handling go the generic route. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
Index: Source/devtools/front_end/ui/DOMExtension.js
diff --git a/Source/devtools/front_end/ui/DOMExtension.js b/Source/devtools/front_end/ui/DOMExtension.js
index d862f94212839c823b06dc74b64cd0f377d55f74..d05f132f402001c59d2f98a10845919c369177d5 100644
--- a/Source/devtools/front_end/ui/DOMExtension.js
+++ b/Source/devtools/front_end/ui/DOMExtension.js
@@ -791,12 +791,21 @@ Node.prototype.setTextContentTruncatedIfNeeded = function(text, placeholder)
/**
* @return {?Node}
*/
-Event.prototype.elementFromPoint = function()
+Event.prototype.deepElementFromPoint = function()
{
+ // 1. climb to the component root.
apavlov 2014/10/17 15:40:59 climb -> Climb
var node = this.target;
while (node && node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE && node.nodeType !== Node.DOCUMENT_NODE)
node = node.parentNode;
- return node ? node.elementFromPoint(this.pageX, this.pageY) : null;
+
+ if (!node)
+ return null;
+
+ // 2. Find deepest node by coordinates.
+ node = node.elementFromPoint(this.pageX, this.pageY);
+ while (node && node.shadowRoot)
+ node = node.shadowRoot.elementFromPoint(this.pageX, this.pageY);
+ return node;
}
/**

Powered by Google App Engine
This is Rietveld 408576698