Bug 7301

Summary: Text shadow does not repaint correctly
Product: WebKit Reporter: mitz
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: VERIFIED FIXED    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Testcase
none
Patch w/o test and change log
none
Patch w/o test and change log
none
Incomplete patch
none
Separate vertical overflow from vertical selection bounds and handle horizontal shadow overflow
none
Patch including tests and change log darin: review+

Description mitz 2006-02-16 07:29:22 PST
Text shadow is not accounted for in repaint. In the attached testcase, press Test to move the gray div and note how the part of the (blue) shadow that overflows the div is not erased from the old position nor painted in the new position.
Comment 1 mitz 2006-02-16 07:30:54 PST
Created attachment 6541 [details]
Testcase
Comment 2 mitz 2006-03-20 12:43:28 PST
Created attachment 7193 [details]
Patch w/o test and change log

This patch fixes the repaint issues by treating the shadows as overflow. This has the side effect that the selection highlight also grows to cover the shadow, but on the other hand, it eats into the next line's highlighting.
Comment 3 mitz 2006-03-20 22:51:12 PST
The patch breaks the appearance of the "segmented control" in the Web Inspector: the selected segment's label is scrolled up.
Comment 4 mitz 2006-03-21 09:57:24 PST
Created attachment 7215 [details]
Patch w/o test and change log
Comment 5 mitz 2006-03-22 08:22:34 PST
Created attachment 7231 [details]
Incomplete patch

This patch takes care of vertical overflow (with the side-effect on selection highlighting) and of horizontal overflow for InlineFlowBox (and blocks), but not for InlineTextBox itself. This means that if only the shadow is in the damage rect, it still won't be painted (e.g. if you highlight only "bar" in "<span style="text-shadow: green 10px 5px;">foo</span>bar").

A possible solution that won't involve adding data to InlineTextBox is to cache the max horizontal overflow per InlineFlowBox.
Comment 6 mitz 2006-03-25 11:38:17 PST
Created attachment 7295 [details]
Separate vertical overflow from vertical selection bounds and handle horizontal shadow overflow

This version addresses horizontal overflow and also separates vertical painting overflow from vertical selection bounds, so the selection highlight is not affected by shadows. As a bonus, it makes inline blocks with overflow repaint correctly.

I removed parts of the previous patch that are now part of bug 7916, so this patch alone doesn't even fix this bug's test case. I also didn't make a test because I want to make an automated one once DumpRenderTree supports repaint tests.
Comment 7 mitz 2006-03-25 11:40:50 PST
Forgot to add that I think this mechanism could be used to fix bug 6274 once you figure out how to tell how far a given font can really paint.
Comment 8 mitz 2006-03-27 08:50:24 PST
Created attachment 7334 [details]
Patch including tests and change log
Comment 9 Darin Adler 2006-03-30 08:42:41 PST
Comment on attachment 7334 [details]
Patch including tests and change log

It's sad that we have to add all these fields, but I think it's justified.

r=me
Comment 10 mitz 2006-04-04 01:48:45 PDT
Verified in r13675 nightly.