Re: Layout Information for SVG Elements

Steven Roussey <[email protected]> Tue, 24 Nov 2009 20:53:36 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.svg
Organization http://groups.google.com
Message-ID <0a1288c1-43ee-4fb9-8fd8-55ab9ba38f3e@u16g2000pru.googlegroups.com>
> What does that even mean?  Note that this is NOT what offset* do.  They
> give the offset to the offsetParent, period.  That need not be
> positioned (e.g. it could have a transform instead, or be a table cell
> or be a table)), and not all positioned things are offsetParent,
> depending on the child (e.g. the offsetParent of a fixed-pos node is the
> <body> no matter what the ancestors of that node look like).
>
> Then there's the question of what the offsets are relative to.  They're
> sort of relative to the padding box except when border-box sizing is
> used except when we ended up using the <body> as the offsetParent,
> unless we only used it because we found nothing better.
>
> Yes, that sounds ridiculous.  Yes, that's what needs to happen for web
> compat.  No, the numbers this produces are not generally useful in any
> way other than adding up while walking up the offsetParent chain to find
> a document offset... which getBoundingClientRect just gives you.
>
> We've had this discussion with John before, on one of the other
> newgroups.  Check the archives?

Oh God. I put in a change today to switch to getBoundingClientRect for
all svg/mathml/etc elements. I wonder if anyone would miss it for
HTML. I'm going to see if we can't switch to the bounding box view as
the default...

The reason I thought about positioned elements was that in Firebug, if
you change the top offset in the layout view to 50, for example, it
set the element's style to "top:50px". Which is yet another thing
altogether.

> > MathML has a similar issue with its top most element and
> > getBoundingClientRect. All the ones inside look fine.
>
> Can you describe the mathml issue in sufficient detail that I can reproduce?

http://math.chapman.edu/~jipsen/mathml/asciimathandmathmlsvg.xhtml

Both fractions have the getBoundingClientRect values off, though the
second one in blue is more obvious (says 19x20 yet the mstyle inside
is 19x45). The first one has is math element with height/width of 8x20
and the inside mfrac is 8x26.

-steve--