From d409e3882d9322655b6113d1e1688d657eec2b3d Mon Sep 17 00:00:00 2001 From: Javier Fernandez Date: Tue, 17 Jul 2018 02:43:37 -0700 Subject: [PATCH] Don't extend selection for special elements on caret based deletes 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] https://github.com/w3c/editing/issues/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 Reviewed-by: Yoshifumi Inoue Cr-Commit-Position: refs/heads/master@{#575591} --- editing/data/delete.js | 5 +++++ editing/data/forwarddelete.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/editing/data/delete.js b/editing/data/delete.js index 8a2bd70753141d..e5ca838f6479b8 100644 --- a/editing/data/delete.js +++ b/editing/data/delete.js @@ -520,6 +520,11 @@ var browserTests = [ "
foo[]bar
", [true], {"delete":[false,false,"",false,false,""]}], +["foo
b[]
baz", + [["delete",""]], + "foo
[]
baz", + [true], + {"delete":[false,false,"",false,false,""]}], ["foo
[]bar
baz", [["delete",""]], "foo
[]bar
baz", diff --git a/editing/data/forwarddelete.js b/editing/data/forwarddelete.js index eb8d14ee0e596c..bbc2b11a3cab72 100644 --- a/editing/data/forwarddelete.js +++ b/editing/data/forwarddelete.js @@ -215,6 +215,11 @@ var browserTests = [ "foo{}", [true,true], {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}], +["
[]b
foo", + [["forwarddelete",""]], + "
[]
foo", + [true], + {"forwarddelete":[false,false,"",false,false,""]}], ["
{}
foo", [["forwarddelete",""]], "
{}
foo",