Commit 1eff672b authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in "editing/selection/mixed-editability-{4,5}.html"

This patch changes "mixed-editability-{4,5}.html" to utilize |selection_test()|
for ease of maintenance.

Because of "mixed-editability-4.html" and "mixed-editability-5.html" use same
sample, this patch integrates them.

Bug: 679977
Change-Id: Ic5e2e8e69413a8c060b905effdb8e33f611de5b2
Reviewed-on: https://chromium-review.googlesource.com/985932Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547109}
parent 526a6bcc
<!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>
<p>This tests moving the caret forward through content of mixed editability. The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
<div contenteditable="true">
editable
<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
editable
</div>
<script>
var e = document.getElementById("test");
var s = window.getSelection();
s.collapse(e, 0);
// Tests moving the caret forward/backward through content of mixed editability.
// The caret should move to same editability in highet editable root.
selection_test(
[
'<div contenteditable>',
'ab',
'<table contenteditable="false"><tbody><tr>',
'<td contenteditable>|CD</td>',
'</tr></tbody></table>',
'ef',
'</div>',
],
selection => selection.modify('move', 'backward', 'line'),
[
'<div contenteditable>',
'|ab',
'<table contenteditable="false"><tbody><tr>',
'<td contenteditable>CD</td>',
'</tr></tbody></table>',
'ef',
'</div>',
],
'1 move backward line');
s.modify("move", "backward", "line");
selection_test(
[
'<div contenteditable>',
'ab',
'<table contenteditable="false"><tbody><tr>',
'<td contenteditable>|CD</td>',
'</tr></tbody></table>',
'ef',
'</div>',
],
selection => selection.modify('move', 'forward', 'documentBoundary'),
[
'<div contenteditable>',
'ab',
'<table contenteditable="false"><tbody><tr>',
'<td contenteditable>CD</td>',
'</tr></tbody></table>',
'ef|',
'</div>',
],
'2 move forward documentBoundary');
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>This tests moving the caret forward through content of mixed editability. The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
<div contenteditable="true">
editable
<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
editable
</div>
<script>
var e = document.getElementById("test");
var s = window.getSelection();
s.collapse(e, 0);
s.modify("move", "forward", "documentBoundary");
</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
LayoutBlockFlow {P} at (0,0) size 784x40
LayoutText {#text} at (0,0) size 752x39
text run at (0,0) width 457: "This tests moving the caret forward through content of mixed editability. "
text run at (457,0) width 295: "The caret should move down one line from the"
text run at (0,20) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,56) size 784x70
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 49x19
text run at (0,0) width 49: "editable"
LayoutTable {TABLE} at (0,20) size 59x30 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 57x28
LayoutTableRow {TR} at (0,2) size 57x24
LayoutTableCell {TD} at (2,2) size 53x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 49x19
text run at (2,2) width 49: "editable"
LayoutBlockFlow (anonymous) at (0,50) size 784x20
LayoutText {#text} at (0,0) size 49x19
text run at (0,0) width 49: "editable"
caret: position 2 of child 0 {#text} of child 2 {DIV} 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
LayoutBlockFlow {P} at (0,0) size 784x40
LayoutText {#text} at (0,0) size 752x39
text run at (0,0) width 457: "This tests moving the caret forward through content of mixed editability. "
text run at (457,0) width 295: "The caret should move down one line from the"
text run at (0,20) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,56) size 784x70
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 49x19
text run at (0,0) width 49: "editable"
LayoutTable {TABLE} at (0,20) size 59x30 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 57x28
LayoutTableRow {TR} at (0,2) size 57x24
LayoutTableCell {TD} at (2,2) size 53x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 49x19
text run at (2,2) width 49: "editable"
LayoutBlockFlow (anonymous) at (0,50) size 784x20
LayoutText {#text} at (0,0) size 49x19
text run at (0,0) width 49: "editable"
caret: position 9 of child 2 {#text} of child 2 {DIV} 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
LayoutBlockFlow {P} at (0,0) size 784x36
LayoutText {#text} at (0,0) size 769x36
text run at (0,0) width 470: "This tests moving the caret forward through content of mixed editability. "
text run at (469,0) width 300: "The caret should move down one line from the"
text run at (0,18) width 481: "editable piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,52) size 784x64
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 51x18
text run at (0,0) width 51: "editable"
LayoutTable {TABLE} at (0,18) size 61x28 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 59x26
LayoutTableRow {TR} at (0,2) size 59x22
LayoutTableCell {TD} at (2,2) size 55x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 51x18
text run at (2,2) width 51: "editable"
LayoutBlockFlow (anonymous) at (0,46) size 784x18
LayoutText {#text} at (0,0) size 51x18
text run at (0,0) width 51: "editable"
caret: position 2 of child 0 {#text} of child 2 {DIV} 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
LayoutBlockFlow {P} at (0,0) size 784x36
LayoutText {#text} at (0,0) size 769x36
text run at (0,0) width 470: "This tests moving the caret forward through content of mixed editability. "
text run at (469,0) width 300: "The caret should move down one line from the"
text run at (0,18) width 481: "editable piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,52) size 784x64
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 51x18
text run at (0,0) width 51: "editable"
LayoutTable {TABLE} at (0,18) size 61x28 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 59x26
LayoutTableRow {TR} at (0,2) size 59x22
LayoutTableCell {TD} at (2,2) size 55x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 51x18
text run at (2,2) width 51: "editable"
LayoutBlockFlow (anonymous) at (0,46) size 784x18
LayoutText {#text} at (0,0) size 51x18
text run at (0,0) width 51: "editable"
caret: position 9 of child 2 {#text} of child 2 {DIV} 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
LayoutBlockFlow {P} at (0,0) size 784x40
LayoutText {#text} at (0,0) size 762x39
text run at (0,0) width 432: "This tests moving the caret forward through content of mixed editability. "
text run at (432,0) width 330: "The caret should move down one line from the editable"
text run at (0,20) width 404: "piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,56) size 784x70
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 47x19
text run at (0,0) width 47: "editable"
LayoutTable {TABLE} at (0,20) size 57x30 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 55x28
LayoutTableRow {TR} at (0,2) size 55x24
LayoutTableCell {TD} at (2,2) size 51x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 47x19
text run at (2,2) width 47: "editable"
LayoutBlockFlow (anonymous) at (0,50) size 784x20
LayoutText {#text} at (0,0) size 47x19
text run at (0,0) width 47: "editable"
caret: position 2 of child 0 {#text} of child 2 {DIV} 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
LayoutBlockFlow {P} at (0,0) size 784x40
LayoutText {#text} at (0,0) size 762x39
text run at (0,0) width 432: "This tests moving the caret forward through content of mixed editability. "
text run at (432,0) width 330: "The caret should move down one line from the editable"
text run at (0,20) width 404: "piece to the editable piece that's embedded in a non-editable piece."
LayoutBlockFlow {DIV} at (0,56) size 784x70
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 47x19
text run at (0,0) width 47: "editable"
LayoutTable {TABLE} at (0,20) size 57x30 [border: (1px outset #808080)]
LayoutTableSection {TBODY} at (1,1) size 55x28
LayoutTableRow {TR} at (0,2) size 55x24
LayoutTableCell {TD} at (2,2) size 51x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (2,2) size 47x19
text run at (2,2) width 47: "editable"
LayoutBlockFlow (anonymous) at (0,50) size 784x20
LayoutText {#text} at (0,0) size 47x19
text run at (0,0) width 47: "editable"
caret: position 9 of child 2 {#text} of child 2 {DIV} 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