Bug 82324

Summary: Should not draw selection for empty spaces.
Product: WebKit Reporter: Parag Radke <parag>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: ap, parag, rniwa, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.webkit.org/
Attachments:
Description Flags
snapshot for select all on webkit.org
none
Proposed Patch
tony: review-, tony: commit-queue-
text selection in TextEdit
none
comparison of Firefox and Webkit selection (with this change). none

Description Parag Radke 2012-03-27 04:58:58 PDT
Created attachment 134029 [details]
snapshot for select all on webkit.org

See the attached images.

go to http://www.webkit.org/
do select all

Webkit selects the empty spaces along with the selectable content.
webkit should instead draw selection background only for selectable content.
Comment 1 Parag Radke 2012-03-27 05:36:55 PDT
Created attachment 134037 [details]
Proposed Patch

Patch to avoid selection draw for empty spaces.
Comment 2 Tony Chang 2012-03-27 10:18:40 PDT
Created attachment 134093 [details]
text selection in TextEdit
Comment 3 Tony Chang 2012-03-27 10:20:20 PDT
Comment on attachment 134037 [details]
Proposed Patch

This is incorrect on Mac.  On Mac, the selection is always a rectangle and lines extend to the edge of the page.

We may want different behavior on Linux/Win which has the jagged selection you describe.
Comment 4 Ryosuke Niwa 2012-03-27 10:24:04 PDT
If we're doing this, we probably also want to set the height of selection to the height of actual text instead of the entire line height to follow the Windows convention.
Comment 5 Ryosuke Niwa 2012-03-27 10:26:03 PDT
Of course, that could be done in a follow up patch.
Comment 6 Tony Chang 2012-03-27 11:02:07 PDT
I also just tried this in gedit, and it produced a Mac like selection.  notepad.exe on Windows had a selection similar to the one in "Proposed Patch".
Comment 7 Parag Radke 2012-03-28 02:00:05 PDT
(In reply to comment #6)
> I also just tried this in gedit, and it produced a Mac like selection.  notepad.exe on Windows had a selection similar to the one in "Proposed Patch".

Yes tony you are correct the gedit selection behavior is similar to the chrome behavior on Linux. But what i was trying to match is not platform but firefox. But if webkit want to go with the default platform behavior i'll restrict this change to windows
Comment 8 Parag Radke 2012-03-28 02:09:07 PDT
Created attachment 134240 [details]
comparison of Firefox and Webkit selection (with this change).
Comment 9 Ryosuke Niwa 2012-03-28 02:13:23 PDT
(In reply to comment #7)
> Yes tony you are correct the gedit selection behavior is similar to the chrome behavior on Linux. But what i was trying to match is not platform but firefox. But if webkit want to go with the default platform behavior i'll restrict this change to windows

We normally match platform convention.
Comment 10 Alexey Proskuryakov 2012-03-28 09:22:22 PDT
Rectangular selections are a must on Mac, and perhaps for Apple Windows products too. I'm not sure who'd be willing to make the call about the latter.
Comment 11 Parag Radke 2012-03-28 12:32:22 PDT
(In reply to comment #10)
> Rectangular selections are a must on Mac, and perhaps for Apple Windows products too. I'm not sure who'd be willing to make the call about the latter.

So this change should exclude Apple windows products? And is there any way to achieve this ?
Comment 12 Ryosuke Niwa 2012-03-28 12:38:49 PDT
This bug belongs to layout and rendering.