Bug 5415 - Left border of selection highlight leaves behind a trail
Summary: Left border of selection highlight leaves behind a trail
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
Depends on:
Reported: 2005-10-18 11:49 PDT by mitz
Modified: 2005-10-25 01:45 PDT (History)
1 user (show)

See Also:

testcase (325 bytes, text/html)
2005-10-18 11:50 PDT, mitz
no flags Details
extended testcase (635 bytes, text/html)
2005-10-23 09:13 PDT, mitz
no flags Details
proposed patch (4.17 KB, patch)
2005-10-23 09:25 PDT, mitz
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-10-18 11:49:26 PDT
Summary: with certain fonts, contracting the selection by moving its start rightwards leaves trails of the 
highlight behind.

To reproduce: open the testcase in Safari. Click and drag in one motion from the end of the line to its 
beginning (extending the selection leftwards) and all the way back to the end (contracting the 

Expected result: no trails left behind.

Actual result: when the left border of the highlight is moving to the right, it leaves behind 1px-wide 

I think this happens because the clipping rect for the redraw is determined by WebCore using integral 
coordinates and drawing the highlight is done in WebTextRenderer using non-integral coordinates (or 
perhaps applying a different rounding rule).
Comment 1 mitz 2005-10-18 11:50:49 PDT
Created attachment 4402 [details]
Comment 2 mitz 2005-10-23 09:13:41 PDT
Created attachment 4448 [details]
extended testcase

Added RTL case.
Comment 3 mitz 2005-10-23 09:25:31 PDT
Created attachment 4449 [details]
proposed patch

This patch fixes the trails bug in the CoreGraphics code path for LTR and RTL
text (highlighting for RTL text was entirely broken very recently) and in the
ATSUI code path for LTR text (highlighting and hit-testing RTL text in the
ATSUI path is broken and I'll open a separate bug for it. I already have a

This patch eliminates the single-character-range special case in the rounding
hack. One layout test is affected:
fast/text/international/bidi-explicit-embedding . The new results should
replace the current expected results.
Comment 4 Darin Adler 2005-10-23 15:25:44 PDT
Comment on attachment 4449 [details]
proposed patch

Looks good. r=me
Comment 5 David Harrison 2005-10-24 12:40:10 PDT
Committed.  Test case added as WebCore/manual-tests/drag_select_highlighting.html