Closed Bug 648875 Opened 13 years ago Closed 13 years ago

SVG use width/height = 0 should disable rendering

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla7

People

(Reporter: dr.o.hoffmann, Assigned: longsonr)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0

The attributes width and height of the use element do not animate.

The example given above tests only the simplest case of 0 width or height
to disable the rendering of the use completely (available for SVG tiny 1.1 too).
Even for SVG full 1.1 with non trivial values and the use referencing an element
svg or symbol, width and height do not animate (If required, I can provide URIs with samples as well).

About this example:
A defs element contains a g element with a rectangle and
a circle. It is referenced by an use-element.
After 2 seconds for a duration of 2s the width of the use is set to 0.
The shown circle and the rectangle vanish for 2s.
After 6 seconds for a duration of 2s the height of the use is set to 0.
The shown circle and the rectangle vanish for 2s.

The fill of a small circle top left has an animation with the same timing for comparison.

Reproducible: Always

Steps to Reproduce:
1. Try the sample given in the URI above
2. Compare with specification (use element)
3. Compare with Opera (any version 9 to 11)
Actual Results:  
Large rectangle and circle do not vanish, no animation of width and height of use.

Expected Results:  
width and height of use should be animatable.


Note, that for non trivial examples (no zero values as here) the effect depends
on the referenced element (effectively no effect for 'normal' elements like g,
typically visible effect for symbol and svg).

See http://www.w3.org/TR/SVG11/struct.html#UseElement
This doesn't appear to be an animation bug, but rather that we don't honour the description of the use width/height attributes:

  A value of zero disables rendering of this element.
  (http://dev.w3.org/SVG/profiles/1.1F2/publish/struct.html#UseElementWidthAttribute)

It may be that even after fixing this bug, the test case still fails due to bug 608161.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: x86 → All
Summary: SVG no animation for use width and height → SVG use width/height = 0 should disable rendering
Version: unspecified → Trunk
Attached image Minimal test case
A minimal test case. The rendering of the circle should be disabled but it is not.
As you can see in this SVG 1.1 full test
http://hoffmann.bplaced.net/svgtest/usesvg01.svg
it does not animate for non zero values as well
(blue: test case referenced svg; red: comparison).
Ok for example in Opera, Adobe plugin, Squiggle/Batik, WebKit.
Attachment #528245 - Attachment is patch: false
Attachment #528245 - Attachment mime type: text/plain → image/svg+xml
(In reply to comment #3)
> As you can see in this SVG 1.1 full test
> http://hoffmann.bplaced.net/svgtest/usesvg01.svg
> it does not animate for non zero values as well
> (blue: test case referenced svg; red: comparison).
> Ok for example in Opera, Adobe plugin, Squiggle/Batik, WebKit.

Thanks Olaf. If you don't mind, could you make a minimal test case and file another bug for that issue? If you don't have time though. I'll do it tomorrow.
Brian changed the summary, before it was in general about the animation problem -
but if you think it helps, we can spend a new number with the old summary and
a test case with non trivial values for width and height ;o)
(In reply to comment #5)
> Brian changed the summary, before it was in general about the animation problem

It looks to me like there are two separate underlying issues.
 - The testcase that this bug was originally filed for fails because we don't disable rendering when the <use> element itself is zero-sized. (regardless of animation)
 - The new testcase you linked to is different - it animates the *target pointed to* by <use>, and it looks like when that target is inside of a new <svg> fragment, we don't handle that right.

These two issues deserve separate bugs, and Brian's summary-tweak was correct, given the original testcase.
Well, no problem - just one number or one for the svg and one for symbol - and
maybe another for g, to ensure, that it is NOT changed, that for g it should have
no effect (I assume, that if it works for g, it will work for typical other
elements as well...)? I have reduced examples already finished - maybe I can put
them together in one new bug number? Then we have this special case with 0 and
another with non zero values, maybe including a mix 0 and non 0 in a values list?
(In reply to comment #6)
>  - The new testcase you linked to is different - it animates the *target
> pointed to* by <use>

(Sorry, I just now noticed that the <use> element gets its height/width animated in your comment 3 testcase, too -- I missed that initially since the <animate> node isn't near the <use> elements (using xlink:href targeting).)

Anyway - thanks for filing the followup bug!
(that followup bug being Bug 652832, for the record)
Assignee: nobody → longsonr
Fixed by check-in for bug 652832
Depends on: 652832
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
I have followed the steps from the description on
Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0
and the rectangle disappears after two seconds.
Is this the intended behavior?

In Google Chrome this is not happening.
(In reply to Vlad from comment #11)
> I have followed the steps from the description on
> Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0
> and the rectangle disappears after two seconds.
> Is this the intended behavior?
> 

It is as described in comment 0. 

> In Google Chrome this is not happening.

I guess Chrome is broken then.
Setting resolution to Verified fixed on Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0 beta 2
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: