[Webkit-unassigned] [Bug 103725] getBBox() return wrong bounding box in <use> tag

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 3 16:25:23 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=103725


Philip Rogers <pdr at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |




--- Comment #3 from Philip Rogers <pdr at google.com>  2012-12-03 16:27:48 PST ---
(In reply to comment #2)
> Shouldn't it print 
> {height: 100, width: 100, y: 50, x: 50}
> instead?
> 
> Since we are getting the bbox on <use>.
> It can also link to an external file, which from a usage point of view, is a encapsulated container?
> I also notice that <use> width and height attribute does not force a resize on the child content.
> Am I using <use> wrongly?

Re-opening because there seems to be some confusion about this.

For the record, here's how the major browsers are currently working:
Chrome Canary - {height: 100, width: 100, y: 100, x: 100}
Firefox Nightly - {height: 100, width: 100, y: 100, x: 100}
IE10 - {height: 100, width: 100, y: 100, x: 100}
Opera next: {height: 100, width: 100, y: 150, x: 150}

It looks like Cr/FF/IE are returning the bbox of the referenced element whereas Opera is returning the bbox of the the rendered content. I think Opera might be the most intuitive. I do not think {height: 100, width: 100, y: 50, x: 50} makes sense.

In particular, we (Chrome, IE) seem inconsistent in the multiple-use case:
<html>
<body>
<svg width="500" height="500">
  <rect id="rect" x="0" y="0" width="100" height="100" opacity="0.5" fill="green"/>
  <use id="use" xlink:href="#rect" x="50" y="50" />
  <use id="use2" xlink:href="#use" x="200" y="200" />
</svg>
<script>
  console.log(document.getElementById('rect').getBBox());
  console.log(document.getElementById('use').getBBox());
  console.log(document.getElementById('use2').getBBox());
</script>
</body>
</html>

@Dirk, should we be adding the x,y offset from the <use> attributes in returning the bbox?
Relevant spec: http://www.w3.org/TR/SVG/single-page.html#types-__svg__SVGLocatable__getBBox

-- 
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