Open Bug 1211717 Opened 9 years ago Updated 2 years ago

need way to get concrete object size of a letterboxed or pillarboxed video.

Categories

(Core :: Layout, defect)

defect

Tracking

()

People

(Reporter: dmosedale, Unassigned)

References

Details

Right now, as far as I can tell, the only way to get this is by doing math that's isomorphic to reimplementing the HTML5 object-fit: cover algorithm. (If I'm wrong about this, and there's some straightforward way to do it, I'll be thrilled to learn that). Given that the layout engine already has all this information, it'd be notably less painful if there were a DOM interface that simply exposed it. One use case for it is described in the user story of <https://bugzilla.mozilla.org/show_bug.cgi?id=1211711>: As a developer, I can get the concrete object size (in css pixels) occupied by a video inside of a <video> element by calling a function, so that I can compute whether the point is over the concrete object, and, if so, the relative coordinates (expressed as a percentage of the concrete object) of the pointer. Acceptance criteria: var {width, height} = getConcreteObjectSize(someHTMLVideoElement); Another use case is when one needs to render objects on top of the letter or pillarbox area so that they abut the concrete video object without occluding it.
Sounds like we really want the rect occupied by the video, not just its size, right? (If we just returned the {width, height}, you'd still have to do some reverse-engineering to figure out where the video actually is sitting, since its upper-left corner is probably not at the upper-left corner of the <video> element, and it really could be positioned somewhere arbitrary if "object-position" is set.)
Yeah, that sounds better. I hadn't thought about non-default object-position values.
Component: Audio/Video: Playback → Layout
roc and Tab replied to my post, suggesting that we extend the GeometryUtils API... http://mxr.mozilla.org/mozilla-central/source/dom/webidl/GeometryUtils.webidl?rev=16411120d562 http://www.w3.org/TR/cssom-view/#the-geometryutils-interface ...with a new CSSBoxType, e.g. "object" (on top of the existing enums for requesting margin-, border-, padding-, & content-boxes) This seems like a good plan, though (after some testing) we should be sure to actually get the spec changed before we ship it.
Depends on: 624647
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.