Bug 13153 - REGRESSION: Visual highlighting of pre-populated blank line in textarea is broken
Summary: REGRESSION: Visual highlighting of pre-populated blank line in textarea is br...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 523.x (Safari 3)
Hardware: Macintosh OS X 10.4
: P1 Normal
Assignee: mitz
Keywords: HasReduction, InRadar, Regression
Depends on:
Reported: 2007-03-21 21:20 PDT by David Kilzer (:ddkilzer)
Modified: 2007-03-23 21:55 PDT (History)
1 user (show)

See Also:

Test case (26 bytes, text/html)
2007-03-21 21:20 PDT, David Kilzer (:ddkilzer)
no flags Details
Highlight hard line breaks when their beginning is selected (58.61 KB, patch)
2007-03-23 07:45 PDT, mitz
adele: review+
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) 2007-03-21 21:20:01 PDT

When a <textarea> element is pre-populated with content, and that content includes blank lines, it's not possible to see the entire blank highlighted until the next character is selected.

Steps to reproduce:

1. Open Safari/WebKit.
2. Open test case (to be posted soon).
3. Tab into the textarea after the page loads.  (Not required; you may click the mouse to get an insertion pointer on the first line.)
4. Hold down the shift key, then hit the down arrow once.

Expected results:

The entire first line of the textarea should be highlighted because it's blank.

Actual results:

Nothing on the first line is highlighted.


This is a regression from shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.9 (8P135).

Tested with a local debug build of WebKit r20375 with the above software.


- The content is actually selected, but the highlight doesn't paint correctly.
- Deleting the pre-populated content and retyping it will make the blank line highlightable.
Comment 1 David Kilzer (:ddkilzer) 2007-03-21 21:20:56 PDT
Created attachment 13757 [details]
Test case
Comment 2 Mark Rowe (bdash) 2007-03-21 22:31:17 PDT
Comment 3 mitz 2007-03-23 02:56:33 PDT
The root cause is the way pre-wrapped text behaves in WebCore. If you take something like


and double- or triple-click the first (empty) line, nothing will be highlighted. Similarly if you triple-click "foo" only "foo" will be highlighted, not the entire line.

When you enter the text manually, <br> elements are generated for the empty lines. Those highlight correctly.
Comment 4 mitz 2007-03-23 02:58:00 PDT
Another place where this behavior constitutes a regression is plain-text documents :-)
Comment 5 mitz 2007-03-23 07:45:05 PDT
Created attachment 13779 [details]
Highlight hard line breaks when their beginning is selected

Includes a pixel test, updated pixel results and change log entries.

Fixes this bug and another bug (also covered by the test) where the highlight did not extend to the end of the line if there were skipped spaces.
Comment 6 Adele Peterson 2007-03-23 21:55:32 PDT
Committed revision 20459