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

Unified Diff: third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html

Issue 2021793002: [Editing][CSS] Drag from a -webkit-user-select:none element should not start selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 4 years, 4 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: third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html b/third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html
new file mode 100644
index 0000000000000000000000000000000000000000..bce6688e4ccb0503e5937eca994b6aa797e49ebd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html
@@ -0,0 +1,38 @@
+<!doctype HTML>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="div" style="-webkit-user-select: none"><div id="s1" style="-webkit-user-select: text" slot="slot1">bar</div></div>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_not_equals(window.eventSender, undefined, 'This test requireswindow.eventSender');
+
+ let host = div.attachShadow({mode: 'open'});
+ let child = document.createElement('div');
+ child.style.webkitUserSelect = 'text';
+ child.textContent = 'foo';
+ host.appendChild(child);
+
+ function moveAndDoubleClick(element) {
+ eventSender.mouseMoveTo(element.offsetLeft + element.offsetWidth / 2, element.offsetTop + element.offsetHeight / 2);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.leapForward(1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.leapForward(1);
+ }
+ moveAndDoubleClick(child);
+
+ let selection = window.getSelection();
+ assert_equals(selection.toString(), 'foo', 'selection.toString');
+
+ selection.removeAllRanges();
+ child.remove();
+ let slot = document.createElement('slot');
+ slot.name = 'slot1';
+ host.appendChild(slot);
+ moveAndDoubleClick(s1);
+ assert_equals(selection.toString(), 'bar', 'selection.toString');
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698