Commit 5961ff06 authored by tanvir.rizvi's avatar tanvir.rizvi Committed by Commit Bot

Delete list item inside table deletes table.

Inside a table, if there are two empty
list items, deleting the second list
deletes the entire table.

In an empty list the deep equivalent for
first position and its next position comes
as same.

I think that FirstInSpecialElement was
for the hidden elements like span, br etc,
therefore this CL do not consider
list element for a special element category.

Bug: 731913
Change-Id: I03a6ec7559a5271954c85561d9c27db75a921452
Reviewed-on: https://chromium-review.googlesource.com/921301Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Tanvir Rizvi <tanvir.rizvi@samsung.com>
Cr-Commit-Position: refs/heads/master@{#537723}
parent 0dd08c73
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
[
'<div contenteditable="true">',
'<table>',
'<tr><td>',
'<li></li>',
'<li>|</li>',
'</td></tr>',
'</table>',
'</div>'
],
'Delete',
[
'<div contenteditable="true">',
'<table>',
'<tbody>',
'<tr><td>',
'<li>',
'<br>|<br>',
'</li>',
'</td></tr>',
'</tbody>',
'</table>',
'</div>'
],
'Deleting last item in two element table list, should not delete the table.');
</script>
......@@ -164,6 +164,7 @@ static HTMLElement* FirstInSpecialElement(const Position& pos) {
VisiblePosition first_in_element =
CreateVisiblePosition(FirstPositionInOrBeforeNode(*special_element));
if (IsDisplayInsideTable(special_element) &&
!IsListItem(v_pos.DeepEquivalent().ComputeContainerNode()) &&
v_pos.DeepEquivalent() ==
NextPositionOf(first_in_element).DeepEquivalent())
return special_element;
......
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