Closed Bug 424586 Opened 16 years ago Closed 16 years ago

Gradients and Patterns on transformed text do not display correctly

Categories

(Core :: SVG, defect, P2)

x86
Windows XP
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: codedread, Assigned: longsonr)

References

()

Details

(Keywords: regression, testcase)

Attachments

(4 files, 1 obsolete file)

This was working on the trunk no more than a week ago, but it's busted now.  See the 'codedread' logo on this page: http://www.codedread.com/about.php

The top one should have a darkblue-lightblue-darkblue gradient on it.  The 'reflection' should fade away in typical Web2.0 logo style.  To see how it's supposed to render, please see Opera 9.5 or Safari 3.1
Testsuite gradients work for me so I wonder what's special about codedread?

A regression range would be useful as would a testcase that is as simple as possible.
I don't have a regression range other than "about a week", sorry.

I am attaching a test case that illustrates the problem.  It is being caused by the viewBox attribute, ultimately.  The lower portion of the document should not be showing any red.  This makes me suspect it's related to the recent changes that jwatt mentioned on the svg-developer list for overriding SVG sizes.  Is this possibly Bug 321531 or 294086 ?

I don't understand why the viewBox of "0 0 100 100" causes the SVG 'frame' to be sized the way it is.  The div has a width of 100%.

Note that if you shrink the width of the browser window, the text does eventually show a little of the gradient on the left side of the text just as it is pushed off the edge of the window.
Attached image simpler testcase
The text does have a gradient on it but the gradient is in the wrong place somehow. If you move the text or make the example font much bigger you can sometimes see the gradient. Removing the viewBox attribute on the outer SVG also fixes the gradient although the text and rect are no longer in the same place then.
Keywords: testcase
Robert, do you think my test case shows two bugs?  One problem is with the gradient, but the other problem is with the sizing of the SVG frame.
If you think there are two bugs then it's probably best to create another one to track your frame sizing issues. Perhaps you could create a testcase for that without gradients to avoid confusion.
Robert do you have time to take this?
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
Erm, did you mean me or Roc?

I can kind of see what's happening. We're scaling and translating the glyphs into place which works OK if they have neither patterns nor gradients.

Not quite so sure how to fix it. I tried messing about with the pattern scaling but so far I'm either barking up the wrong tree or not doing it right.
(In reply to comment #10)
> Erm, did you mean me or Roc?

You :-)
Assignee: nobody → longsonr
Attached patch patch (obsolete) — Splinter Review
We need to set the global transform prior to calling SetupCairoFill or SetupCairoStroke in order to get patterns and gradients drawn correctly.
Attachment #312547 - Flags: superreview?(roc)
Attachment #312547 - Flags: review?(roc)
I just noticed that I also need to change nsSVGGlyphFrame::GetGlobalTransform so that it always gives the correct output even for singular matrices so that the test in SetInitialMatrix works.

nsSVGGlyphFrame::GetGlobalTransform(gfxMatrix *aMatrix)
{
...
  *aMatrix = nsSVGUtils::ConvertSVGMatrixToThebes(ctm);
  return !aMatrix->IsSingular();
}

Comment on attachment 312547 [details] [diff] [review]
patch

needs work for fill and stroke on same text.
Attachment #312547 - Attachment is obsolete: true
Attachment #312547 - Flags: superreview?(roc)
Attachment #312547 - Flags: review?(roc)
Attachment #312622 - Flags: superreview?(roc)
Attachment #312622 - Flags: review?(roc)
Comment on attachment 312622 [details] [diff] [review]
stroke in correct place

reftest please?
Attachment #312622 - Flags: superreview?(roc)
Attachment #312622 - Flags: superreview+
Attachment #312622 - Flags: review?(roc)
Attachment #312622 - Flags: review+
Attached patch reftestSplinter Review
Summary: Fx3 Regression: SVG Gradients → Gradients and Patterns on transformed text do not display correctly
Checked in.

Checked in reftest:
http://lxr.mozilla.org/seamonkey/source/layout/reftests/svg/text-gradient-01.svg

Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
verified fixed using the testcase from comment #5 and Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9pre) Gecko/2008041217 Minefield/3.0pre ID:2008041217 

-> Verified fixed
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: