Re: Correct behavior of "visibility" tag

From SVG spec ( http://www.w3.org/TR/SVG11/painting.html#VisibilityControl ) 
 
"Setting 'visibility' to hidden on a 'g' will make its children invisible as long as the children do not specify their own 'visibility' properties as visible. 
Note that 'visibility' is not an inheritable property. "
 
According to the first line --- if on a "g" element we specify "hidden" it makes its children invisible, if children don't specify any visiblity property. Adobe player behaves that way, is that the correct behavior according to spec?
 
According to the second line -- Visibiliby does not get inherited down the children from parent, unless children set the visibility to "inherit". See Chris Lilley's response below. 
 
Second line does seem to contradict the first line.
 
For example, in the following cases, 
case 1: rectangle is visible eventhough the parent group is invisible because the rectangle sets the visiblity flag to "visible". 
case 2: Adobe svg player does not show the rectangle at all, that means the rectangle does inherit the visibility from parent "g" element(in adobe player). But according to Chris Lilley's explanation and the second sentence of the above SVG spec quotation, rectangle shouldn't inherit visibility from the parent "g" element. 
            However the frist sentence of the above SVG spec quotation, if we specify visibility flag "hidden" in the group element then it's children would be invisible unless children overrides the visibility flag with "visible"
 
Could anybody explain? What should be the standard behavior?
 
1) 
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="tiny" xml:space="preserve" width="176" height="208" viewBox="-88 -104 176 208">
 
 <g visibility="hidden">
 
  <rect x="-80" y="-20" width="160" height="40" fill="#666699" visibility="visible">
        <animateTransform attributeName="transform" type="rotate" values="0;180" dur="6s" repeatDur="indefinite"/>
    
  </rect>
  
 </g>
</svg>
 
 
2)
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="tiny" xml:space="preserve" width="176" height="208" viewBox="-88 -104 176 208">
 
 <g visibility="hidden">
 
  <rect x="-80" y="-20" width="160" height="40" fill="#666699">
        <animateTransform attributeName="transform" type="rotate" values="0;180" dur="6s" repeatDur="indefinite"/>
    
  </rect>
  
 </g>
 
</svg>
 
 
Thanks for your time.
ruben
 


Chris Lilley <chris@w3.org> wrote:
On Monday, March 1, 2004, 5:56:43 PM, ruben wrote:

rT> Hi 

rT>  

rT> I am in the process of developing a SVGTiny player. I am
rT> having little trouble in understanding the correct behavior of
rT> "visibility" tag. From SVG specification (
rT> http://www.w3.org/TR/SVG11/painting.html#VisibilityControl ) "Note
rT> that 'visibility' is not an inheritable".

Correct. Setting the value of visibility does not inherit the value
down to its children.

http://www.w3.org/TR/REC-CSS2/visufx.html#propdef-visibility

Value: visible | hidden | collapse | inherit
Initial: inherit
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual

rT> But in the next
rT> paragraph spec indicates that "inherit" is one of the possible
rT> value of visibility.

Correct. An element can set the value to 'inherit' to force the value
to be copied from its parent.
 

rT> The following example behaves in Adobe SVG player -- "for
rT> first 2 seconds you cann't see the polygon(star shape) and then
rT> from 2 second until 18th second you will see the polygon on the
rT> screen"

Yes.

rT> But my understanding is that, since the polygon inherits from
rT> the group element, (group element is specified as hidden) it will
rT> remain hidden all the time.

Note however that the initial value of the visibility property is
'inherit' so the computed value of visibility on the polygon at the
start of the timeline is 'hidden'.

Note also that visibility can be set to visible on a child of a parent
that is not visible, and it will show. This is a crucial difference
between the visibility and display properties.

So the animation is correct and the polygon will show at the times
specified.

Yes, there should be a test for this in the test suite.


rT> Our SVGTiny player does not show the polygon at all.

It should.
 

rT> Could anyone explain what should be the right behavior of
rT> visibility tag? What would be the behavior of the following
rT> example? 


rT> rT> baseProfile="tiny" xml:space="preserve" width="176" height="208"
rT> viewBox="-88 -104 400 400">

rT> 
rT> 
rT> 
rT>  
rT>  
rT>               points="130,75  159,161 249,161 177,215
rT>                     203,301 130,250 57,301 83,215
rT>                     11,161 101,161" >
rT>   rT> values="0 130 200;360 130 200" begin="2s" dur="5s"
rT> repeatDur="indefinite"/>
rT>         rT> dur="3s" fill="freeze" from="rgb(0%,0%,255%)"
rT> to="rgb(255%,0%,255%)"/>
rT>  rT> fill="freeze" from="rgb(255%,0%,255%)" to="rgb(0%,255%,255%)"/>
rT>  
rT>     
rT>  

rT> 


(two closing g elements should be added here to make it well formed)

rT> 
 


-- 
Chris Lilley mailto:chris@w3.org
Chair, W3C SVG Working Group
Member, W3C Technical Architecture Group


---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.

Received on Tuesday, 2 March 2004 13:51:15 UTC