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

Unified Diff: third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html

Issue 2877623005: Make DragController::DragIsMove return false when selection does not have focus (Closed)
Patch Set: Add layout test Created 3 years, 7 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/core/page/DragController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html b/third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html
new file mode 100644
index 0000000000000000000000000000000000000000..fca54a16b51271795efb979319b9dc5534d40e47
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html
@@ -0,0 +1,98 @@
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script>
+// Regression tests for crbug.com/717453.
+
+function mouseMoveTo(element) {
+ const document = element.ownerDocument;
+ const mouseX = document.offsetLeft + element.offsetLeft + element.offsetWidth / 2;
+ const mouseY = document.offsetTop + element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(mouseX, mouseY);
+}
+
+test(() => {
+ assert_not_equals(window.eventSender, 'This test requires eventSender');
yosin_UTC9 2017/05/12 04:05:44 Let's use |assert_exists(window, 'eventSender');|
+
+ assert_selection(
+ [
+ '<textarea id="source">^text|</textarea>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target"></textarea>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const source = document.getElementById('source');
+ const link = document.getElementById('link');
+ const target = document.getElementById('target');
+ source.focus();
+ mouseMoveTo(link);
+ eventSender.mouseDown();
+ eventSender.leapForward(500);
+ mouseMoveTo(target);
+ eventSender.mouseUp();
+ },
+ [
+ '<textarea id="source">text</textarea>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target">^http://www.example.com/|</textarea>'
+ ].join(''));
+}, 'Drag link with unfocused selection in text control');
+
+test(() => {
+ assert_not_equals(window.eventSender, 'This test requires eventSender');
+
+ assert_selection(
+ [
yosin_UTC9 2017/05/12 04:05:45 nit: Please have two spaces indentation.
+ '<div contenteditable id="source">^text|</div>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target"></textarea>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const source = document.getElementById('source');
+ const link = document.getElementById('link');
+ const target = document.getElementById('target');
+ source.focus();
+ mouseMoveTo(link);
+ eventSender.mouseDown();
+ eventSender.leapForward(500);
+ mouseMoveTo(target);
+ eventSender.mouseUp();
+ },
+ [
+ '<div contenteditable id="source">text</div>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target">^http://www.example.com/|</textarea>'
+ ].join(''));
+}, 'Drag link with unfocused selection in contenteditable div');
+
+test(() => {
+ assert_not_equals(window.eventSender, 'This test requires eventSender');
yosin_UTC9 2017/05/12 04:05:44 Let's use |assert_exists(window, 'eventSender');|
+
+ assert_selection(
+ [
yosin_UTC9 2017/05/12 04:05:45 nit: Please have two spaces indentation.
+ '<div id="source">^text|</div>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target"></textarea>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const source = document.getElementById('source');
+ const link = document.getElementById('link');
+ const target = document.getElementById('target');
+ document.body.focus();
+ mouseMoveTo(link);
+ eventSender.mouseDown();
+ eventSender.leapForward(500);
+ mouseMoveTo(target);
+ eventSender.mouseUp();
+ },
+ [
+ '<div id="source">text</div>',
+ '<a href="http://www.example.com/" id="link">link</a>',
+ '<textarea id="target">^http://www.example.com/|</textarea>'
+ ].join(''));
+}, 'Drag link with unfocused selection in uneditable text');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698