Bug 19279 - REGRESSION (r32660): Text not redrawn correctly when selection changes
Summary: REGRESSION (r32660): Text not redrawn correctly when selection changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P1 Normal
Assignee: Pierre-Luc Beaudoin
URL:
Keywords: Regression
Depends on:
Blocks:
 
Reported: 2008-05-27 15:10 PDT by Jonathon Jongsma (jonner)
Modified: 2008-06-07 15:38 PDT (History)
4 users (show)

See Also:


Attachments
Patch that fixes the text disappearance on selection changes (1.18 KB, patch)
2008-06-06 13:49 PDT, Jonathon Jongsma (jonner)
no flags Details | Formatted Diff | Diff
Test case (1.15 KB, text/html)
2008-06-06 15:14 PDT, Pierre-Luc Beaudoin
no flags Details
Fix (1.39 KB, patch)
2008-06-06 16:51 PDT, Pierre-Luc Beaudoin
no flags Details | Formatted Diff | Diff
Fix (1.36 KB, patch)
2008-06-06 17:04 PDT, Pierre-Luc Beaudoin
no flags Details | Formatted Diff | Diff
Pixel test for Mac OS X (433 bytes, text/html)
2008-06-07 00:16 PDT, mitz@webkit.org
sam: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathon Jongsma (jonner) 2008-05-27 15:10:58 PDT
I've noticed that often when you drag down to select a block of text and then move back up to de-select some of it, sometimes the newly-deselected text disappears.  It only seems to happen on multi-line text and usually only if the start of the text selection is above (or on the boundary of) the affected element.
Comment 1 Jonathon Jongsma (jonner) 2008-05-27 15:12:19 PDT
Created attachment 21371
Comment 2 Jonathon Jongsma (jonner) 2008-05-27 15:15:59 PDT
I should also note that I don't know for certain whether this is only a QtWebKit issue, but that's the only one that I had available to test.
Comment 3 Jonathon Jongsma (jonner) 2008-05-27 18:56:09 PDT
OK, so I compiled GtkWebKit and the issue also shows up there, so it doesn't appear to be specific to the Qt port.  Changing component.  If 'Text' is not correct, feel free to re-assign to the correct component.
Comment 4 Pierre-Luc Beaudoin 2008-05-28 07:13:38 PDT
Confirmed with Alexey Proskuryakov, this does not affect the Mac port.
Comment 5 Dirk Schulze 2008-05-30 23:07:38 PDT
Got the problems with GtkLauncher but NOT with midori on the same webkitgtk-code.
Comment 6 Alp Toker 2008-05-31 17:18:00 PDT
(In reply to comment #5)
> Got the problems with GtkLauncher but NOT with midori on the same
> webkitgtk-code.
> 

I get the problem with Midori too. Maybe your experience was a fluke?
Comment 7 Dirk Schulze 2008-05-31 22:19:09 PDT
(In reply to comment #6)
> I get the problem with Midori too. Maybe your experience was a fluke?

No, I tested it several times on different pages. I don't run in to problems using midori the latest trunk and wbkit with soup,freetype.
I made it like in the movie. I got the problems on GtkLauncher but not with midori.
Could be because on midori the selection/marking of objects and texts don't work correctly at the moment.
Comment 8 Dirk Schulze 2008-06-03 11:18:57 PDT
Midori solved the problems with selection, but the described bug does still not apear on Midori.
I tried it with epiphany/webkit with out any problems. Seems only a problem with GtkLauncher on WebKitGtk.
Comment 9 Pierre-Luc Beaudoin 2008-06-06 10:11:12 PDT
The bug does not appear on WebKit shipped with Qt 4.4 but does appear on QtWebKit from webkit.org.  

I ran a git bisect on code.staikos.net and it pointed to this changeset: http://trac.webkit.org/changeset/32660

Investigation continues.
Comment 10 Jonathon Jongsma (jonner) 2008-06-06 13:49:05 PDT
Created attachment 21528 [details]
Patch that fixes the text disappearance on selection changes

Here's a patch that fixes the disappearing text issue on both Qt and Gtk.  I don't necessarily think that it's the *correct* solution since I think what it is doing is 
a) drawing all text in the run as unselected
b) later any selected text is drawn overtop of it

There's at least a couple problems with this simplistic fix:
- we're doing unnecessary work by drawing text and then drawing over it
- In many cases, text has a different style when selected and unselected.  For example, links often have underlines when they're not selected, but are not supposed to be underlined when they're selected. So if you apply this patch you'll see that when you select a link, it will improperly have an underline in the unselected color.
Comment 11 Pierre-Luc Beaudoin 2008-06-06 15:14:58 PDT
Created attachment 21533 [details]
Test case

Sample html file with 2 paragraph where the issue can be reproduced.
Comment 12 mitz@webkit.org 2008-06-06 16:20:34 PDT
You can reproduce the bug on Mac, too, if you make it take the "paint selection separately" code path, for example by adding this to the test case:
<style>
    ::selection { background-color: red; color: white; }
</style>
Comment 13 Pierre-Luc Beaudoin 2008-06-06 16:51:42 PDT
Created attachment 21538 [details]
Fix 

Fix discussed with Mitz Pettel.
Comment 14 Pierre-Luc Beaudoin 2008-06-06 17:04:06 PDT
Created attachment 21539 [details]
Fix

Fixed bad paste and improved ChangeLog
Comment 15 mitz@webkit.org 2008-06-06 17:07:59 PDT
Comment on attachment 21539 [details]
Fix

r=me. It would be nice to have a pixel test for this, but that would have to be made on Mac OS X.
Comment 16 mitz@webkit.org 2008-06-07 00:16:55 PDT
Created attachment 21547 [details]
Pixel test for Mac OS X
Comment 17 mitz@webkit.org 2008-06-07 01:22:55 PDT
Comment on attachment 21539 [details]
Fix

Landed in <http://trac.webkit.org/changeset/34414>, so clearing the review flag. Leaving the bug open pending review of the regression test.
Comment 18 mitz@webkit.org 2008-06-07 15:38:33 PDT
Test landed in <http://trac.webkit.org/changeset/34430>.