Commit 9f7ed66f authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in "editing/selection/mixed-editability-1.html"

This patch changes "mixed-editability-1.html" to utilize |selection_test()| for
ease of maintenance.

Following patch will move "mixed-editability-1.html" to "mouse/" direcotry
for test classification.

Bug: 679977
Change-Id: I8de73dabf0a9ba33921b0d97b5f781c21b07a883
Reviewed-on: https://chromium-review.googlesource.com/986033Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547112}
parent 330a613e
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<body contenteditable="true"><span id="start" contenteditable="false">On</span>ly the first two letters of the first word in this sentence should be selected. To run this test manually, double click between the first two letters of the first word of the first sentence.</body>
function doubleClick(selection) {
resetMouse();
const target = selection.document.getElementById('target');
eventSender.mouseMoveTo(
selection.computeLeft(target) + target.offsetWidth / 2,
selection.computeTop(target) + target.offsetHeight / 2);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
}
<script>
if (window.testRunner) {
var s = window.getSelection();
var start = document.getElementById("start");
var x, y;
x = start.offsetLeft + start.offsetWidth / 2;
y = start.offsetTop + start.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
function resetMouse() {
if (!window.eventSender)
throw 'This test requires eventSender';
eventSender.mouseMoveTo(0, 0);
eventSender.mouseDown();
eventSender.mouseUp();
}
selection_test(
[
'<div contenteditable>',
'<span contenteditable="false" id="target">AB</span>bd',
'</div>',
],
selection => doubleClick(selection),
[
'<div contenteditable>',
'<span contenteditable="false" id="target">^AB|</span>bd',
'</div>',
],
'Select word should not cross editing boundaries.');
</script>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutInline {SPAN} at (0,0) size 20x19
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "On"
LayoutText {#text} at (20,0) size 782x39
text run at (20,0) width 464: "ly the first two letters of the first word in this sentence should be selected. "
text run at (484,0) width 294: "To run this test manually, double click between"
text run at (778,0) width 4: " "
text run at (0,20) width 351: "the first two letters of the first word of the first sentence."
selection start: position 0 of child 0 {#text} of child 0 {SPAN} of body
selection end: position 2 of child 0 {#text} of child 0 {SPAN} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutInline {SPAN} at (0,0) size 20x18
LayoutText {#text} at (0,0) size 20x18
text run at (0,0) width 20: "On"
LayoutText {#text} at (19,0) size 743x36
text run at (19,0) width 476: "ly the first two letters of the first word in this sentence should be selected. "
text run at (494,0) width 245: "To run this test manually, double click"
text run at (738,0) width 5: " "
text run at (0,18) width 417: "between the first two letters of the first word of the first sentence."
selection start: position 0 of child 0 {#text} of child 0 {SPAN} of body
selection end: position 2 of child 0 {#text} of child 0 {SPAN} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutInline {SPAN} at (0,0) size 19x19
LayoutText {#text} at (0,0) size 19x19
text run at (0,0) width 19: "On"
LayoutText {#text} at (19,0) size 766x39
text run at (19,0) width 442: "ly the first two letters of the first word in this sentence should be selected. "
text run at (461,0) width 301: "To run this test manually, double click between the"
text run at (762,0) width 4: " "
text run at (0,20) width 313: "first two letters of the first word of the first sentence."
selection start: position 0 of child 0 {#text} of child 0 {SPAN} of body
selection end: position 2 of child 0 {#text} of child 0 {SPAN} of body
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment