Bug 5361 - Pattern element coordinate problems
Summary: Pattern element coordinate problems
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Normal
Assignee: Eric Seidel (no email)
URL: http://www.pandimaniacs.com/index.php...
Depends on:
Reported: 2005-10-13 01:35 PDT by Nicholas Shanks
Modified: 2005-12-26 14:08 PST (History)
0 users

See Also:

reduced test‐case (16.40 KB, image/svg+xml)
2005-10-13 02:09 PDT, Nicholas Shanks
no flags Details
Reduced test case (334 bytes, image/svg+xml)
2005-10-13 08:28 PDT, Julien Palmas
no flags Details
Wrong result (37.17 KB, image/png)
2005-10-13 08:29 PDT, Julien Palmas
no flags Details
Good result (37.96 KB, image/png)
2005-10-13 08:29 PDT, Julien Palmas
no flags Details
Proposed patch (1.14 KB, patch)
2005-10-21 10:36 PDT, Julien Palmas
eric: review-
Details | Formatted Diff | Diff
Better patch (2.00 KB, patch)
2005-10-21 11:38 PDT, Julien Palmas
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicholas Shanks 2005-10-13 01:35:58 PDT
At the URL given, in Opera 8.5, the character talking in the first frame has a beard, which isn't drawn in 
Comment 1 Nicholas Shanks 2005-10-13 01:38:43 PDT
Actually, both of them have missing stubble. It might be that it's supposed to have an alpha value, but 
Opera is rendering it as 1.0 (black) instead of grey, and Safari is rendering it as 0.0 (white).
Comment 2 Nicholas Shanks 2005-10-13 02:09:33 PDT
Created attachment 4336 [details]
reduced test‐case

The bug is when a fill attribute refers to a <pattern> element by fragment ID
using "url(#fragment)"
Comment 3 Eric Seidel (no email) 2005-10-13 02:25:39 PDT
Adding NeedsReduction keyword, the test case ideally should only be a couple lines.
Comment 4 Julien Palmas 2005-10-13 08:28:26 PDT
Created attachment 4343 [details]
Reduced test case

There are 2 know bugs in

The first one is related with the use of viewBox. We really have to fix the
coordinates calculation when using this attribute as many SVGs use this.

The second bug (see the atteched reduced test case) is a coordinate generation
problem as well, but when using the pattern element. In this example, the first
(top-left) red <rect> should be rendered at (10.10) but it is rendered at

NOTE : the patternUnits="userSpaceOnUse" is important in this example. It means
that the coordinate system used for the pattern element (ie: for its x, y,
width and height values) is the same as the coordinate system of the black
Comment 5 Julien Palmas 2005-10-13 08:29:29 PDT
Created attachment 4344 [details]
Wrong result
Comment 6 Julien Palmas 2005-10-13 08:29:49 PDT
Created attachment 4345 [details]
Good result
Comment 7 Julien Palmas 2005-10-13 08:33:16 PDT
MacDome, could you set the keyword to "HasReduction"
and the summary to something like "Pattern element coordinate problem" ?

Comment 8 Julien Palmas 2005-10-21 10:36:16 PDT
Created attachment 4438 [details]
Proposed patch

KRenderingPaintServerPatternQuartz was checking boundingBoxMode() of
KRenderingPaintServerPattern to shift the coordinates of the <pattern>.

That's not necessary as the x() and y() coordinates are already shifted thanks
to the baseVal() method.

By the way, the same code was already commented out  a line 135
Comment 9 Julien Palmas 2005-10-21 11:38:58 PDT
Created attachment 4439 [details]
Better patch

Removes unnecessary comments
Comment 10 Eric Seidel (no email) 2005-10-21 15:25:09 PDT
Comment on attachment 4438 [details]
Proposed patch

We don't generally commit commented out code.
Comment 11 Eric Seidel (no email) 2005-10-21 15:26:19 PDT
Comment on attachment 4439 [details]
Better patch

Looks fine, I'll test again before committing.
Comment 12 Eric Seidel (no email) 2005-10-23 23:54:52 PDT