Bug 25403 - Gradient Fill of text not positioned properly
: Gradient Fill of text not positioned properly
Product: WebKit
Classification: Unclassified
Component: SVG
: 528+ (Nightly build)
: Macintosh Mac OS X 10.5
: P2 Normal
Assigned To: Nobody
Depends on: 23881 25431
  Show dependency treegraph
Reported: 2009-04-25 20:01 PDT by Jeff Schiller
Modified: 2009-04-28 16:10 PDT (History)
2 users (show)

See Also:

Test Case showing the problem (805 bytes, image/svg+xml)
2009-04-25 20:01 PDT, Jeff Schiller
no flags Details
Add text gradient test to cover (3.90 KB, patch)
2009-04-28 15:10 PDT, Eric Seidel
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Schiller 2009-04-25 20:01:27 PDT
The attached test case shows a bug in WebKit:  The green text should almost completely obscure the red text.  However, the red text is visible in Safari 4 at a different size and position than the green text.

Note that the red text is actually a gradient.  If the gradient was replaced with a solid color (fill="red"), then this problem is no longer present.

This may be related to Bug 25402.
Comment 1 Jeff Schiller 2009-04-25 20:01:59 PDT
Created attachment 29795 [details]
Test Case showing the problem
Comment 2 Gavin Sherlock 2009-04-26 12:44:44 PDT
I don't see a problem with the test case in r42858
Comment 3 Dirk Schulze 2009-04-26 23:05:13 PDT
*** Bug 25402 has been marked as a duplicate of this bug. ***
Comment 4 Dirk Schulze 2009-04-26 23:08:55 PDT
The wrong behavior is caused by wrong values of the drawing rect. eseidel improved boundingBox's in the last days. It should work now. Can you test it again with the latest nightly please?
Comment 5 Eric Seidel 2009-04-28 15:03:02 PDT
Wow.  This is much better after http://trac.webkit.org/changeset/42950.

Would you consider this fixed, Jeff?  Or do we have more work to do here?

Our rendering looks as good (or better) than FF and Opera.
Comment 6 Eric Seidel 2009-04-28 15:10:12 PDT
Created attachment 29866 [details]
Add text gradient test to cover

 5 files changed, 43 insertions(+), 0 deletions(-)
Comment 7 Eric Seidel 2009-04-28 15:14:06 PDT
Thanks for the awesome test case.

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	LayoutTests/ChangeLog
	A	LayoutTests/platform/mac/svg/text/text-gradient-positioning-expected.checksum
	A	LayoutTests/platform/mac/svg/text/text-gradient-positioning-expected.png
	A	LayoutTests/platform/mac/svg/text/text-gradient-positioning-expected.txt
	A	LayoutTests/svg/text/text-gradient-positioning.svg
Committed r42966

We might still be using repaintRectInLocalCoordinates() in a few places where we should be using objectBoundingBox(), so related test cases could fail.  But this nice test case you provided "passes" now, as far as I can tell.

Thanks for the great test case!  (You'll see that I changed the text a little to make it more self-documenting, but otherwise landed it as-is.)
Comment 8 Jeff Schiller 2009-04-28 16:10:06 PDT
Looks great to me in nightly from 4/25.  Thanks!