Summary: 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. Regression: 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. Notes: - 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.
Created attachment 13757 [details] Test case
<rdar://problem/5080341>
The root cause is the way pre-wrapped text behaves in WebCore. If you take something like <pre> foo </pre> 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.
Another place where this behavior constitutes a regression is plain-text documents :-)
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.
Committed revision 20459