Bug 210677 - REGRESSION (r249160): Deleting newline after pasting text ending in a newline results in a discontinuity
Summary: REGRESSION (r249160): Deleting newline after pasting text ending in a newline...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: data:text/html,%3ctextarea%3e%3c/text...
Keywords: InRadar
Depends on: 201181
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-17 15:55 PDT by David Kilzer (:ddkilzer)
Modified: 2020-06-18 09:15 PDT (History)
12 users (show)

See Also:


Attachments
patch (3.17 KB, patch)
2020-04-22 08:11 PDT, Antti Koivisto
zalan: review+
Details | Formatted Diff | Diff
patch (3.51 KB, patch)
2020-04-22 09:34 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (3.47 KB, patch)
2020-04-22 10:01 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-04-17 15:55:02 PDT
Summary:
Pasting text that ends with a newline, then immediately deleting that newline, results in a discontinuity in a <textarea> element.

Steps to Reproduce
1. Load URL:  <data:text/html,%3ctextarea%3e%3c/textarea%3e>
2. Resize.
3. Type in "lorem\n\n\n\nipsum\n" (hit the Enter key for each newline).
4. Select "lorem" plus its ending newline and copy to pasteboard.
5. Position insertion bar on line 3 (blank line between "lorem and ipsum").
6. Paste text.
7. Immediately hit Delete key.

Expected Results:
Blank line should be deleted after pasting "lorem\n".

Actual Results:
Blank is deleted, but the text is not redrawn with the line removed.  Moving the insertion bar with left/right arrow keys will show it jump over the deleted newline.  (Using up/down arrow keys will actually not move the insertion bar past the deleted newline.)

Regression:
Via bisection, this regressed in r249160 which was the fix for Bug 201181:

Bug 201181: InlineTextBox::end() should return first-past-end offset
​<https://bugs.webkit.org/show_bug.cgi?id=201181>
<rdar://problem/54758922>
<https://trac.webkit.org/changeset/249160/webkit>
Comment 1 Radar WebKit Bug Importer 2020-04-17 15:55:21 PDT
<rdar://problem/61954169>
Comment 2 David Kilzer (:ddkilzer) 2020-04-17 16:06:31 PDT
Forcing a repaint in Safari does not “fix” the discontinuity.

You can fix it by deleting the next blank line after the discontinuity (which makes the deletion jump up two lines), then hit Enter again to make it appear the way it should have originally.
Comment 3 Jon Lee 2020-04-17 16:50:05 PDT
At the end of the second "lorem" line, I can't press the down key to go to the next line.
Comment 4 David Kilzer (:ddkilzer) 2020-04-18 13:35:11 PDT
(In reply to Jon Lee from comment #3)
> At the end of the second "lorem" line, I can't press the down key to go to
> the next line.

As noted in Comment #0:

> (Using up/down arrow keys will actually not move the insertion bar past the deleted newline.)

Part of the behavior of this bug.
Comment 5 Antti Koivisto 2020-04-22 08:11:01 PDT
Created attachment 397191 [details]
patch
Comment 6 Antti Koivisto 2020-04-22 09:34:48 PDT
Created attachment 397208 [details]
patch
Comment 7 Antti Koivisto 2020-04-22 10:01:03 PDT
Created attachment 397213 [details]
patch
Comment 8 EWS 2020-04-22 12:24:59 PDT
Committed r260528: <https://trac.webkit.org/changeset/260528>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397213 [details].