Commit faa9e174 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Rewrite editing/inserting/4875189-2.html to use selection_test()

This patch changes "4875189-2.html" to utilize |selection_test()| for ease of
maintenance.

Note: Following patch will rename this file to "replace_in_float.html".

This patch is a preparation for the patch[1].

[1] http://crrev.com/c/737981 Introduce TextOffsetMapping to simplify
word/paragraph selection

Bug: 679977
Change-Id: I20cb0f4060cb6135e4fabb0c7a5bdfe0bcacf53e
Reviewed-on: https://chromium-review.googlesource.com/897217Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533604}
parent 4c95848c
<p>This tests for a bug when replacing the contents of a floating element. Just its contents should be removed during the replace.</p> <!doctype html>
<div contenteditable="true">This shouldn't be in the bordered div.<div id="div" style="float:left; border: 1px solid blue;">You shouldn't see this.</div></div> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script> <script>
var r = document.createRange(); // This tests for a bug when replacing the contents of a floating element. Just
var div = document.getElementById("div"); // its contents should be removed during the replace.
r.setStart(div, 0); const kStyle = 'float:left; border: 1px solid blue;';
r.setEnd(div, div.childNodes.length); selection_test(
var selection = window.getSelection(); '<div contenteditable>abc<div style="${kStyle}">^def|</div></div>',
selection.addRange(r); 'insertHTML XYZ',
document.execCommand("InsertHTML", false, "This should be in a floating blue bordered div.") '<div contenteditable>abc<div style="${kStyle}">XYZ|</div></div>',
'Replace HTML in float:left');
</script> </script>
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 784x20
LayoutText {#text} at (0,0) size 784x19
text run at (0,0) width 441: "This tests for a bug when replacing the contents of a floating element. "
text run at (441,0) width 343: "Just its contents should be removed during the replace."
LayoutBlockFlow {DIV} at (0,36) size 784x20
LayoutText {#text} at (291,0) size 235x19
text run at (291,0) width 235: "This shouldn't be in the bordered div."
LayoutBlockFlow (floating) {DIV} at (0,0) size 291.97x22 [border: (1px solid #0000FF)]
LayoutText {#text} at (1,1) size 290x19
text run at (1,1) width 290: "This should be in a floating blue bordered div."
caret: position 47 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 747x36
text run at (0,0) width 450: "This tests for a bug when replacing the contents of a floating element. "
text run at (449,0) width 298: "Just its contents should be removed during the"
text run at (0,18) width 51: "replace."
LayoutBlockFlow {DIV} at (0,52) size 784x18
LayoutText {#text} at (296,0) size 239x18
text run at (296,0) width 239: "This shouldn't be in the bordered div."
LayoutBlockFlow (floating) {DIV} at (0,0) size 296.47x20 [border: (1px solid #0000FF)]
LayoutText {#text} at (1,1) size 295x18
text run at (1,1) width 295: "This should be in a floating blue bordered div."
caret: position 47 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 784x20
LayoutText {#text} at (0,0) size 744x19
text run at (0,0) width 416: "This tests for a bug when replacing the contents of a floating element. "
text run at (416,0) width 328: "Just its contents should be removed during the replace."
LayoutBlockFlow {DIV} at (0,36) size 784x20
LayoutText {#text} at (274,0) size 223x19
text run at (274,0) width 223: "This shouldn't be in the bordered div."
LayoutBlockFlow (floating) {DIV} at (0,0) size 274.97x22 [border: (1px solid #0000FF)]
LayoutText {#text} at (1,1) size 273x19
text run at (1,1) width 273: "This should be in a floating blue bordered div."
caret: position 47 of child 0 {#text} of child 1 {DIV} 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