[Webkit-unassigned] [Bug 72796] New: [SVG] getBBox on a <g> within symbol returns 0 but with defs it works correctly
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Nov 19 03:32:47 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=72796
Summary: [SVG] getBBox on a <g> within symbol returns 0 but
with defs it works correctly
Product: WebKit
Version: 528+ (Nightly build)
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: SVG
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: rakssvg at gmail.com
CC: zimmermann at kde.org
When we do a getBBox on the <g> element inside a symbol, the value returned is 0,0
But if the <g> element is inside a <defs>, correct value is returned.
Following is the SVG code, If we replace symbol with defs we get the values correctly
Getting the BBox on a symbol is very important because we are making a library of graphical units using symbol and want to know the dimensions of elements in the symbol so that appropriate transformations can be done when the symbol is actually used with the <use> tag.
Moreover as per standards since we are doing a getBBox on a <g> which is SVGLocatable, getBBox should work correctly
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg baseProfile="tiny" display="inherit" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
<script><![CDATA[
window.onload = function(){
var l2 = document.getElementById('g0') ;
alert(l2.getBBox().width) ;
//alert(l2);
}
]]></script>
<symbol>
<g id="g0">
<circle id="g1" cx="200" cy="200" r="20" fill="red"/>
<circle cx="200" cy="100" r="20"/>
<animateTransform repeatCount="indefinite" attributeName="transform" begin="0" type="translate" additive="sum" fill="freeze" dur="2" keyTimes="0;0.5;1" values="200 150; 20 150;200 150"/>
<animateTransform repeatCount="indefinite" attributeName="transform" begin="0" additive="sum" type="scale" fill="freeze" dur="2" keyTimes="0;0.5;1" values="2 2;1 1;2 2"/>
<animateTransform repeatCount="indefinite" attributeName="transform" begin="0" additive="sum" type="translate" fill="freeze" dur="2" keyTimes="0;0.5;1" values="-200 -150; -20 -150;-200 -150"/>
</g>
</symbol>
<use xlink:href="#symbol0" fill="green">
<animate calcMode="linear" attributeName="display" begin="0" dur="2" keyTimes="0;0.2;0.5;0.8;1" values="inherit;none;inherit;none;inherit"/>
</use>
<use x="200" xlink:href="#symbol0" fill="blue"/>
</svg>
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list