[webkit-dev] Can someone explain tx/ty?

Simon Fraser simon.fraser at apple.com
Mon Aug 23 07:42:35 PDT 2010


On Aug 23, 2010, at 12:51 AM, Eric Seidel wrote:

> I believe int tx, int ty -- which we see sprinkled around the
> rendering tree -- are the offset from the top left corner of the
> current renderer's parent to the containing block.  Is that correct?
> 
> In SVG we use IntSize containingBlockOffset in the rare places we have
> to deal with this RenderBoxModelObject-only concept.
> 
> I've long considered fixing renders to use IntPoint and IntSize
> instead of x, y, tx, ty, but to do that, I need to make sure I
> understand what tx, ty are, and what name they should have as an
> IntSize.

tx, ty are a painting offset which starts as 0,0 at the current painting root,
and are then accumulated as you go down. The painting root may be
the root renderer, or it may be a compositing layer, or something painting
with a 2D transform.

It would be possible to have block renderers change the coordinate system to
their local coordinates when painting to eliminate tx, ty for blocks, but you'd
still have to do something for inlines, and there may be other non-simple cases too.

Simon




More information about the webkit-dev mailing list