Closed Bug 1672900 Opened 4 years ago Closed 3 years ago

Deleting all list items in list element at least one of their list item is not empty shouldn't remove the list

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

When selection range boundaries are start of a <li> element and end of a <li> element, we extend the range with climbing up current block boundaries.
https://searchfox.org/mozilla-central/rev/ff85081e3b05f89f9a5921b489b6e01ed4a88c25/editor/libeditor/HTMLEditSubActionHandler.cpp#10875-10892,10908-10945

Then, we delete only <li> elements and if that's all of the <ul> or <ol> element, we create empty <ul> or <ol> element and put caret in it. According to the other browsers' behavior, we should stop climbing up with crossing list item boundaries.

And this renames the method to ExtendOrShrinkRangeToDelete for alining to
new behavior changed by the following patch.

Depends on D125028

When a list element has non-empty list item element, even if the list element is
selected, deleting operation should make the list element empty first (i.e.,
making the list element has only one empty list item element). Then, another
deleting operation/command can delete it completely. This is Blink compat
behavior in most cases except when the list has non-editable list item element
as first and/or last child of it.

Note that the new failures of the browserscpe are not compatible with the
new behavior, that is, it wants a list element is deleted when the last
list item is deleted.
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/delete.py#161-164
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/forwarddelete.py#146-149

Here is same test in the WPT:
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/testing/web-platform/tests/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html#386-402
And only Gecko failed in this case:
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/testing/web-platform/meta/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html.ini#1449-1450
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/testing/web-platform/meta/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html.ini#1937-1938
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/testing/web-platform/meta/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html.ini#425-426
https://searchfox.org/mozilla-central/rev/08c493902519265d570250c8e7ce575c8cd6f5b5/testing/web-platform/meta/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html.ini#787-788

https://wpt.fyi/results/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html%3FDelete,ol?run_id=5734231113203712&run_id=6263979761467392&run_id=5750388243300352&run_id=5090688355008512
https://wpt.fyi/results/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html%3FDelete,ul?run_id=5734231113203712&run_id=6263979761467392&run_id=5750388243300352&run_id=5090688355008512
https://wpt.fyi/results/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html%3FBackspace,ol?run_id=5734231113203712&run_id=6263979761467392&run_id=5750388243300352&run_id=5090688355008512
https://wpt.fyi/results/input-events/input-events-get-target-ranges-deleting-in-list-items.tentative.html%3FBackspace,ul?run_id=5734231113203712&run_id=6263979761467392&run_id=5750388243300352&run_id=5090688355008512

Therefore, the new failures are expected result.

Depends on D125029

Summary: Selecting all children in list item shouldn't remove the list item → Deleting all list items in list element at least one of their list item is not empty shouldn't remove the list
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e88bc0e4b9d4
part 1: Add some edge cases into input-events-get-target-ranges-deleting-in-list-items.tentative.html r=m_kato
https://hg.mozilla.org/integration/autoland/rev/14625acf6197
part 2: Rewrite `HTMLEditor::AutoDeleteRangesHandler::ExtendRangeToIncludeInvisibleNodes()` with modern helper classes r=m_kato
https://hg.mozilla.org/integration/autoland/rev/b8e8fed16b1e
part 3: Make `ExtendOrShrinkRangeToDelete()` selects all contents in all list items if a list element is selected or all list items in a list element is selected r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/30572 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
Upstream PR merged by moz-wptsync-bot
Regressions: 1748018
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: