Re: [css-images] API for authors to request concrete object size & position, for replaced element w/ "object-fit"/"object-position"

On Wed, Oct 7, 2015 at 5:18 PM, Daniel Holbert <dholbert@mozilla.com> wrote:

> When an image or a video has "object-fit" and/or "object-position" set,
> it would be quite convenient for web developers if they had a way to
> determine the exact on-screen rect that the media is rendering into. We
> (Mozilla) received a request for such a feature here:
>  https://bugzilla.mozilla.org/show_bug.cgi?id=1211711
>  https://bugzilla.mozilla.org/show_bug.cgi?id=1211717
>
> Briefly, the use case is a web author wanting to know where a user's
> cursor is, relative to a <video>'s rendered content.
>
> 3 QUESTIONS:
> ==========
> (1) Is this positioning information already easily-exposed somewhere? (I
> don't think it is, but I might've missed it.)
>

Not as far as I know.


> (2) What should an API to query this information look like? Maybe a new
> getter "DOMRect getConcreteObjectRect()" on all replaced elements?
> (This may really be a question for the WHATWG -- not sure -- but since
> object-fit & object-position are defined in CSS, I figured I'd start
> with the CSSWG.)
>

I would add a new box type to CSSBoxType in GeometryUtils, e.g. "object",
representing the object rectangle. This would let you use getBoxQuads and
coordinate conversion methods without any additoinal API surface.

Rob
-- 
lbir ye,ea yer.tnietoehr  rdn rdsme,anea lurpr  edna e hnysnenh hhe uresyf
toD
selthor  stor  edna  siewaoeodm  or v sstvr  esBa  kbvted,t
rdsme,aoreseoouoto
o l euetiuruewFa  kbn e hnystoivateweh uresyf tulsa rehr  rdm  or rnea
lurpr
.a war hsrer holsa rodvted,t  nenh hneireseoouot.tniesiewaoeivatewt sstvr
esn

Received on Wednesday, 7 October 2015 10:56:09 UTC