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

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

From: Daniel Holbert <dholbert@mozilla.com>
Date: Tue, 6 Oct 2015 21:18:16 -0700
To: www-style@w3.org
Message-ID: <56149D08.3050401@mozilla.com>
Hi www-style,

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:

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.)

(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.)

(3) Any reasons we shouldn't expose an API like this?

Received on Wednesday, 7 October 2015 04:18:47 UTC

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