W3C home > Mailing lists > Public > www-style@w3.org > May 2011

Re: [CSSOM] Revisiting transforms and getBoundingClientRect()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 17 May 2011 10:57:39 -0700
Message-ID: <BANLkTimf3HF=weha0jahEqzVheoTu3yuCA@mail.gmail.com>
To: Andrew Dupont <w3@andrewdupont.net>
Cc: www-style@w3.org
On Mon, May 16, 2011 at 3:10 AM, Andrew Dupont <w3@andrewdupont.net> wrote:
> While investigating some odd test results I was getting in my experiments with CSS transforms, I found this thread [1] asking how transforms and getBoundingClientRect() are meant to interact. The thread seems to resolve (though without any sort of consensus) on the idea that ClientRect shouldn't be aware of transforms — i.e., when I apply a CSS transform to an element, the ClientRect returned by getBoundingClientRect() would be the same both before and after.
> I'm digging this up only because the inconsistency described there is still present: WebKit's ClientRects are transform-aware, whereas Gecko's are not. I can't find any other thread in the archives which discusses this. Are there plans to specify one behavior or the other? And if the specified behavior is that ClientRects aren't transform-aware, will there be a future API that _is_ transform-aware?

So, I've been meaning to restart the recent discussions I had a few
weeks ago on this topic.  The discussion didn't come to any clear
agreement, and that's fine, because this is a complex topic with many
potential directions to explore.

I think it's clear that there are several axises* that we can ask a question on:

1. Which box to measure - content, padding, border, or margin?
2. What concept of 'box' to use - partitions (generated boxes,
possibly multiple due to lines/columns/etc), bounding box (always only
one, may be surprisingly large), or positioning box (single box in
local coordinates, ignoring partition splitting).
3. What are the coordinates relative to - window origin, or origin of
another element (potentially letting you measure "within" a transform)
4. Whether to care about transforms, and how much - ignore the
transform (values are in box-local space, may not interact well with
some types of #3 relative coords), respect the transform (returning
quads rather than rectangles), or give a bounding box for the
transform (respecting transform, but returning a circumscribing rect).

I'm not sure which of these axises* are useful for authors, and which
we should expose directly (some can be easily computed from other
types of data).  In particular, being transform-aware is potentially
confusing, as you have to pay attention to both the transform of the
targeted box and the relative-to box.

Let's discuss use-cases.  You say you've done experiments with
transforms, Andrew.  Do some of these correspond to actual actions
you've tried to perform in client's sites?  If so, what actions, and
what information would have made it easier to do if it were exposed?

Received on Tuesday, 17 May 2011 17:58:26 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:46 UTC