Skip to content

Commit

Permalink
Don't extend selection for special elements on caret based deletes
Browse files Browse the repository at this point in the history
We should not extend selection looking for special elements if the
delete operation has been triggered by a caret based selection.

This change is based on a recent [1] resolution of the Editing TF,
which acknowledges that behavior of single-cell tables must be the
same that multi-cell tables and even if the last character is
deleted, we should not delete the whole table structure.

A different case would be when the user actively selects the whole
content of a table; in this case, as we do in multi-cell tables,
the structure of single-cell tables should be deleted together
with the content.

[1] w3c/editing#163

Bug: 731320
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I8c3e4efcc63410bf30b4889a715d92e9dda8189b
Reviewed-on: https://chromium-review.googlesource.com/1126255
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575591}
  • Loading branch information
javifernandez authored and chromium-wpt-export-bot committed Jul 17, 2018
1 parent 26b8de8 commit d409e38
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editing/data/delete.js
Expand Up @@ -520,6 +520,11 @@ var browserTests = [
"<div style=\"white-space:nowrap\">foo[]bar</div>",
[true],
{"delete":[false,false,"",false,false,""]}],
["foo<table><tr><td>b[]</table>baz",
[["delete",""]],
"foo<table><tbody><tr><td>[]<br></td></tr></tbody></table>baz",
[true],
{"delete":[false,false,"",false,false,""]}],
["foo<table><tr><td>[]bar</table>baz",
[["delete",""]],
"foo<table><tbody><tr><td>[]bar</td></tr></tbody></table>baz",
Expand Down
5 changes: 5 additions & 0 deletions editing/data/forwarddelete.js
Expand Up @@ -215,6 +215,11 @@ var browserTests = [
"foo{}",
[true,true],
{"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}],
["<table><tr><td>[]b</table>foo",
[["forwarddelete",""]],
"<table><tbody><tr><td>[]<br></td></tr></tbody></table>foo",
[true],
{"forwarddelete":[false,false,"",false,false,""]}],
["<table><tr><td>{}</table>foo",
[["forwarddelete",""]],
"<table><tbody><tr><td>{}</td></tr></tbody></table>foo",
Expand Down

0 comments on commit d409e38

Please sign in to comment.