Bug 82324 - Should not draw selection for empty spaces.
Summary: Should not draw selection for empty spaces.
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://www.webkit.org/
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-27 04:58 PDT by Parag Radke
Modified: 2012-03-28 12:38 PDT (History)
4 users (show)

See Also:


Attachments
snapshot for select all on webkit.org (216.35 KB, image/png)
2012-03-27 04:58 PDT, Parag Radke
no flags Details
Proposed Patch (26.06 KB, patch)
2012-03-27 05:36 PDT, Parag Radke
tony: review-
tony: commit-queue-
Details | Formatted Diff | Diff
text selection in TextEdit (37.98 KB, image/png)
2012-03-27 10:18 PDT, Tony Chang
no flags Details
comparison of Firefox and Webkit selection (with this change). (302.12 KB, image/jpeg)
2012-03-28 02:09 PDT, Parag Radke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.