RESOLVED FIXED Bug 216739
Selection API: Further improvements to VisibleSelection, FrameSelection, and DOMSelection to preserve anchor and focus
https://bugs.webkit.org/show_bug.cgi?id=216739
Summary Selection API: Further improvements to VisibleSelection, FrameSelection, and ...
Darin Adler
Reported 2020-09-19 18:47:50 PDT
Selection API: Further improvements to VisibleSelection, FrameSelection, and DOMSelection to preserve anchor and focus
Attachments
Patch (34.61 KB, patch)
2020-09-19 19:47 PDT, Darin Adler
rniwa: review+
ews-feeder: commit-queue-
Patch for landing (36.44 KB, patch)
2020-09-20 12:00 PDT, Darin Adler
no flags
Darin Adler
Comment 1 2020-09-19 19:47:47 PDT
Ryosuke Niwa
Comment 2 2020-09-19 21:40:27 PDT
Comment on attachment 409222 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409222&action=review Looks like editing/execCommand/insert-list-nested-with-orphaned.html is failing legitimately. > Source/WebCore/editing/VisibleSelection.cpp:234 > + m_baseIsFirst = m_base <= m_extent; We may need to take care of the case when m_base / m_extent turns until null even though m_anchor / m_focus aren't null.
Darin Adler
Comment 3 2020-09-20 11:49:11 PDT
(In reply to Ryosuke Niwa from comment #2) > Looks like editing/execCommand/insert-list-nested-with-orphaned.html is > failing legitimately. I’ve been studying the test, and I think the change in behavior is a small progression. The test does InsertOrderedList on a selection, and the new behavior is that after insertion the whole thing is still selected. The old behavior was that the caret was at the beginning of the line of the last list item. I don’t see this behavior, changing a selection into a caret, as intentional in the implementation and it’s not done in any normal case. What I don’t understand yet is why the selection anchor and focus are not visible in the dump. Trying to figure that out now.
Darin Adler
Comment 4 2020-09-20 11:53:26 PDT
(In reply to Darin Adler from comment #3) > What I don’t understand yet is why the selection anchor and focus are not > visible in the dump. Trying to figure that out now. Looks like dump-as-markup.js only dumps an anchor, focus, or caret indicator when they happen to have a text node as the container node, and misses them when the node is a non-text node. This seems like something we should fix by enhancing dump-as-markup.js, but further explains what is happening here. The caret is not going to move itself into a text node any more, even if it is a caret! It was doing that before as non-standard behavior. We set the selection to the children of a node, so that node is going to be the container specified in the selection endpoints, no reason that they would move themselves to be in a text node.
Darin Adler
Comment 5 2020-09-20 12:00:55 PDT
Created attachment 409240 [details] Patch for landing
Darin Adler
Comment 6 2020-09-20 12:37:50 PDT
Radar WebKit Bug Importer
Comment 7 2020-09-21 12:02:45 PDT
Note You need to log in before you can comment on or make changes to this bug.