Re: Raising the issue of multi-threading

On Sun, 29 Mar 2009 09:34:16 +0200, Alexander Adam <alexander.adam@examotion.com> wrote:

> Hi!
>
> I'd like to raise the issue of multi-threading and the SVG-Spec. I really
> think that the spec should take multi-threaded environments into strong
> consideration. For example, let's take this:
>
> var rect = document.createElementNS(.., "rect");
> rect.setAttributeNS(..)
> ..
> document.rootElement.appendChild(rect);
> var theBBox = rect.getBbox();

So in this example the only cases that could possibly be difficult to determine would be:

1) use of units on the rect AND the rect hasn't been inserted into the document (since that can affect the computed CSS)

Otherwise the bbox can be easily determined from the information on the element itself, in place, even if it hasn't yet rendered (because presumably it will be rendered very soon).

It may be that if the implementation has multiple (possibly inconsistent) copies of the DOM tree then you might get something you didn't expect.

I wouldn't mind if the spec was a bit explicit, say to require that getBBox must return the actual bbox at the time it was called even if the element hadn't rendered yet (this is highly useful information for e.g text measurements, placement of shapes etc). However, even with the current spec wording my understanding is that getBBox should return the actual bbox for that element at that point in time, not something that perhaps was the bbox or some other made up value.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Monday, 30 March 2009 08:00:55 UTC