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

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..a2d99dfa65f731160484df196a6927ced45df318 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() {
+ // TODO(luoe): use contains(node, {includeShadow: true}) when it is fixed for shadow dom.
+ var contents = this.querySelectorAll('content');
+ for (var content of contents) {
+ if (Array.prototype.some.call(content.getDistributedNodes(), node => node.hasSelection()))
+ 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