RESOLVED FIXED 151442
Selection.deleteFromDocument should not leave a selection character
https://bugs.webkit.org/show_bug.cgi?id=151442
Summary Selection.deleteFromDocument should not leave a selection character
Carlos Garcia Campos
Reported 2015-11-19 04:16:57 PST
This is what happens with test imported/blink/editing/selection/deleteFromDocument-crash.html. It first run selectAll in the focused text area, and removeFromDocument() leaves the last character of the selection in the text area. This is what is causing a failure in GTK+ and win ports. The reason why it passes for mac is because the mac editor behaviour considers selections as not directional. For non directional selections, FrameSelection::willBeModified() when direction is backwards switches the selection base extent. So, when the caret is moved once character backwards in the case of mac, the cursor position is 0 and it doesn't have any effect. For the other ports, the position is the last one (extent). This was fixed in blink r172511, so we could just merge it in WebKit.
Attachments
Patch (9.61 KB, patch)
2015-11-19 04:22 PST, Carlos Garcia Campos
buildbot: commit-queue-
Archive of layout-test-results from ews115 for mac-yosemite (843.09 KB, application/zip)
2015-11-19 05:14 PST, Build Bot
no flags
Updated patch (10.46 KB, patch)
2015-11-20 09:00 PST, Carlos Garcia Campos
mcatanzaro: review+
Rebased patch for landing (10.46 KB, patch)
2016-04-15 01:13 PDT, Carlos Garcia Campos
no flags
Carlos Garcia Campos
Comment 1 2015-11-19 04:22:36 PST
Build Bot
Comment 2 2015-11-19 05:14:56 PST
Comment on attachment 265857 [details] Patch Attachment 265857 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/449673 New failing tests: imported/blink/editing/selection/deleteFromDocument-undo-crash.html
Build Bot
Comment 3 2015-11-19 05:14:59 PST
Created attachment 265861 [details] Archive of layout-test-results from ews115 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-yosemite Platform: Mac OS X 10.10.5
Darin Adler
Comment 4 2015-11-19 08:46:38 PST
Comment on attachment 265857 [details] Patch EWS shows the test deleteFromDocument-undo-crash.html is hitting an assertion on Mac debug build. We’ll need to find out what that assertion is to fix it.
Carlos Garcia Campos
Comment 5 2015-11-19 10:11:34 PST
Yes, I'll check what assert we are hitting.
Carlos Garcia Campos
Comment 6 2015-11-20 03:05:58 PST
It looks like a different issue revealed by the new test. I can reproduce it without the patch. See https://code.google.com/p/chromium/issues/detail?id=504932
Carlos Garcia Campos
Comment 7 2015-11-20 09:00:11 PST
Created attachment 265957 [details] Updated patch It skips the new test for Debug.
Darin Adler
Comment 8 2015-11-30 09:52:02 PST
Comment on attachment 265957 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=265957&action=review > LayoutTests/TestExpectations:455 > +webkit.org/b/151488 [ Debug ] imported/blink/editing/selection/deleteFromDocument-undo-crash.html [ Skip ] I’d prefer that we investigate this first, and fix this before making the rest of this change. I don’t want to rush to get this change in and knowingly introduce a crash.
Carlos Garcia Campos
Comment 9 2015-11-30 10:47:55 PST
(In reply to comment #8) > Comment on attachment 265957 [details] > Updated patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265957&action=review > > > LayoutTests/TestExpectations:455 > > +webkit.org/b/151488 [ Debug ] imported/blink/editing/selection/deleteFromDocument-undo-crash.html [ Skip ] > > I’d prefer that we investigate this first, and fix this before making the > rest of this change. I don’t want to rush to get this change in and > knowingly introduce a crash. Note that this doesn't introduce a crash, but a test that reveals an existing crash. The new test crashes in debug build even without the changes introduced in this patch.
Darin Adler
Comment 10 2015-11-30 10:59:28 PST
(In reply to comment #9) > Note that this doesn't introduce a crash, but a test that reveals an > existing crash. The new test crashes in debug build even without the changes > introduced in this patch. Still seems that we should fix that bug before making this behavior change, though. Should not be a challenging project and there is no hurry to change this behavior since we have had it for a long time.
Carlos Garcia Campos
Comment 11 2015-11-30 23:59:54 PST
(In reply to comment #10) > (In reply to comment #9) > > Note that this doesn't introduce a crash, but a test that reveals an > > existing crash. The new test crashes in debug build even without the changes > > introduced in this patch. > > Still seems that we should fix that bug before making this behavior change, > though. Should not be a challenging project and there is no hurry to change > this behavior since we have had it for a long time. This behavior has always been there, but we didn't know it caused a crash (a real one, not an assert, so it happens in release as well) until editing/selection/deleteFromDocument-crash.html was imported from blink. That test crashes for all ports not using the mac editing behavior. This patch also adds editing/selection/deleteFromDocument-undo-crash.html, but because it's a blink merge and the test was part of the commit. So, what I can do, is fixing this real crash for the existing test, and add the new test as part of the bug #151488 with the patch to fix it.
Carlos Garcia Campos
Comment 12 2015-12-01 03:09:42 PST
(In reply to comment #11) > (In reply to comment #10) > > (In reply to comment #9) > > > Note that this doesn't introduce a crash, but a test that reveals an > > > existing crash. The new test crashes in debug build even without the changes > > > introduced in this patch. > > > > Still seems that we should fix that bug before making this behavior change, > > though. Should not be a challenging project and there is no hurry to change > > this behavior since we have had it for a long time. > > This behavior has always been there, but we didn't know it caused a crash (a > real one, not an assert, so it happens in release as well) until > editing/selection/deleteFromDocument-crash.html was imported from blink. > That test crashes for all ports not using the mac editing behavior. This > patch also adds editing/selection/deleteFromDocument-undo-crash.html, but > because it's a blink merge and the test was part of the commit. So, what I > can do, is fixing this real crash for the existing test, and add the new > test as part of the bug #151488 with the patch to fix it. I'm wrong, I think I was confusing this with other test, this is just a failure, not a crash.
Michael Catanzaro
Comment 13 2016-02-15 13:00:10 PST
Comment on attachment 265957 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=265957&action=review I see you've opened bug #151488 to address Darin's concerns about the new test crashing in debug builds, so I think this is fine for now, since it fixes a crash in release builds, adds a new test, cleans up an existing test, and matches the behavior of IE/FF/Blink. > LayoutTests/editing/selection/deleteFromDocument.html:36 > +r.setEnd(span2.firstChild, 3); Can you explain why you changed this?
Carlos Garcia Campos
Comment 14 2016-04-15 01:13:02 PDT
Created attachment 276467 [details] Rebased patch for landing
Carlos Garcia Campos
Comment 15 2016-04-15 01:52:04 PDT
(In reply to comment #13) > Comment on attachment 265957 [details] > Updated patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265957&action=review > > I see you've opened bug #151488 to address Darin's concerns about the new > test crashing in debug builds, so I think this is fine for now, since it > fixes a crash in release builds, adds a new test, cleans up an existing > test, and matches the behavior of IE/FF/Blink. > > > LayoutTests/editing/selection/deleteFromDocument.html:36 > > +r.setEnd(span2.firstChild, 3); > > Can you explain why you changed this? No, because I'm not the author of the patch, as the ChangeLog says, this is a merge of Blink r172511
Carlos Garcia Campos
Comment 16 2016-04-15 01:53:39 PDT
Note You need to log in before you can comment on or make changes to this bug.