Closed Bug 577850 Opened 14 years ago Closed 14 years ago

A gradient applied to SVG Text element should render as if the objectBoundingBox spans the entire Text content

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b4

People

(Reporter: sebastian, Assigned: longsonr)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1 (.NET CLR 3.5.30729)

Mozilla doesn't comply with this quote from SVG 1.1 specification (Second Edition): "It is possible to apply a gradient, pattern, clipping path, mask or filter to text. When one of these facilities is applied to text and keyword 'objectBoundingBox' is used (see Object bounding box units) to specify a graphical effect relative to the "object bounding box", then the object bounding box units are computed relative to the entire ‘text’ element in all cases, even when different effects are applied to different ‘tspan’ elements within the same ‘text’ element."

Reproducible: Always

Steps to Reproduce:
Create a text-element with a fill attribute referring an gradient. The referred gradient should have the attribute gradientUnits="objectBoundingBox" (default).

The text-element should have several textPath or tspan children with some offset.
Actual Results:  
The gradient is now treated as if each child (textPath/tspan) have it's own bounding box. It's reapplied for each child.

Expected Results:  
The gradient should be applied as if it's a single bounding box covers all children within entire text-element.
Can you use the attachment link above to attach a testcase please?
Attached image Test case
Here's a test case that shows the gradient repeating for each text segment. Comparing it with WebKit browsers should make the issue apparent.
Would you mind attaching a screenshot from a WebKit browser?
The comment 0 quote is from here: http://www.w3.org/TR/SVG/text.html, this text is also present in the 1st edition.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → longsonr
Attachment #461779 - Flags: review?(roc)
OS: Windows XP → All
Hardware: x86 → All
Comment on attachment 461779 [details] [diff] [review]
patch with reftest

The patch isn't quite right. While it works for text, tspan and textPath it won't work for glyphs as nsSVGGlyphFrame isn't an nsSVGTextContainerFrame.
Attachment #461779 - Flags: review?(roc)
Comment on attachment 461779 [details] [diff] [review]
patch with reftest

comment 7 is wrong, it does work for glyphs as the aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT) line moves us to the nsSVGGlyphFrame parent which is a nsSVGTextContainerFrame.
Attachment #461779 - Flags: review?(roc)
Comment on attachment 461779 [details] [diff] [review]
patch with reftest

Nice
Attachment #461779 - Flags: review?(roc) → review+
Comment on attachment 461779 [details] [diff] [review]
patch with reftest

Simple patch with test. Should be low risk.
Attachment #461779 - Flags: approval2.0?
pushed http://hg.mozilla.org/mozilla-central/rev/81c119fb86c7
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b4
In Beta 4, the original test case still fails on the lower textPath samples.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Please raise a new bug if there are still issues with this functionality.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: