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

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

Issue 2588833004: DevTools: better hasSelection check to include composed trees (Closed)
Patch Set: ac Created 4 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js
diff --git a/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js b/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js
index 2a2cb03bd15e6062cdea6878f92a303e2264fb94..dd835adfcdbc5ae24d60f72871fa972a6a81cb7c 100644
--- a/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js
+++ b/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js
@@ -277,6 +277,12 @@ Node.prototype.isComponentSelectionCollapsed = function() {
* @return {boolean}
*/
Node.prototype.hasSelection = function() {
+ // FIXME: use contains(node, {includeShadow: true}) when it is fixed for shadow dom.
dgozman 2016/12/22 01:59:33 TODO(luoe)
luoe 2016/12/22 02:03:56 Done.
+ var contents = this.querySelectorAll('content');
+ for (var content of contents) {
+ if (Array.prototype.some.call(content.getDistributedNodes(), node => node.hasSelection()))
allada 2016/12/20 18:41:36 Why Array.prototype.some.call? Why not just acces
luoe 2016/12/20 19:23:58 getDistributedNodes() returns a NodeList, which do
allada 2016/12/21 23:28:26 I see.
+ return true;
+ }
if (this.isComponentSelectionCollapsed())
return false;
return this.getComponentSelection().containsNode(this, true);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698