W3C home > Mailing lists > Public > www-style@w3.org > October 2015

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

From: Robert O'Callahan <robert@ocallahan.org>
Date: Wed, 7 Oct 2015 23:55:40 +1300
Message-ID: <CAOp6jLaKFF4nrgMT=dFevKeCmLGRSnYus=8dJRYhfwUs17scXQ@mail.gmail.com>
To: Daniel Holbert <dholbert@mozilla.com>
Cc: www-style <www-style@w3.org>
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.
> ==========
> (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.

lbir ye,ea yer.tnietoehr  rdn rdsme,anea lurpr  edna e hnysnenh hhe uresyf
selthor  stor  edna  siewaoeodm  or v sstvr  esBa  kbvted,t
o l euetiuruewFa  kbn e hnystoivateweh uresyf tulsa rehr  rdm  or rnea
.a war hsrer holsa rodvted,t  nenh hneireseoouot.tniesiewaoeivatewt sstvr
Received on Wednesday, 7 October 2015 10:56:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:57 UTC