Closed Bug 479936 Opened 15 years ago Closed 15 years ago

video with width= or height= does not scale container (although it scales the video itself)

Categories

(Core :: Audio/Video, defect, P2)

1.9.1 Branch
x86
macOS
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: blizzard, Assigned: roc)

Details

(Keywords: fixed1.9.1)

Attachments

(3 files, 1 obsolete file)

This is easy to reproduce.  Do something like:

<video src="http://people.mozilla.org/~blizzard/screencasts/screencast-video-2009-02-23.ogv" width="300" controls="true">

in your HTML.  Note that it will scale the video down from its original size but the height and width of the box that contains the video will be the full height of the video.  Seems like some maths are missing somewhere.
Flags: blocking1.9.1?
Flags: blocking1.9.1? → blocking1.9.1+
Priority: -- → P2
Assignee: nobody → roc
Attached file testcase (not)
I don't see this bug on trunk as you describe it.

I think this testcase covers what you're describing. It seems to work fine; the green border-box is the intrinsic height of the video and 300px wide.
I caught it on both the 1.9.1 branch and trunk - screenshot attached.  I was able to reproduce on trunk by clearing the cache and reloading.  It doesn't happen every time but it does happen.  (And when I was using it on my blog it _did_ happen every time which is why I noticed it.)
Adding bz + dbaron for some reflow/resizing love.
So nsVideoFrame::GetIntrinsicSize uses the video size but overrides the width or height based on the attributes set, if any.  This gives the behavior roc describes in comment 1 and shown in the screenshots in comment 2.  Neither matches the description in comment 0; in particular the width used is the one specified by the attribute, not the height of the video as comment 0 says.

The HTML5 spec doesn't actually say what the width and height attributes on <video> do, so I have no idea what the right behavior here is.  The current behavior _does_ seem a bit odd to me.

If we want them to act more like equivalent attributes on <img>, then we need to map the width and height attributes into style and not have them affect the intrinsic size.  But again, that's a spec question.
Ah, sorry.  The spec has this "The video element supports dimension attributes." thing very well hidden in the text.  Of course the spec doesn't define what those do.
Hmm, interesting.  The principal-of-least-surprise would expect it to do exactly what an <img> does when you specify only a width or only a height.  It's the easy way to fit-to-width for a lot of pages.   Who are the right spec people?  (I can't imagine that anyone would want anything else, frankly.)
I've posted to public-html and whatwg requesting clarification, but it seems to me that the intent of the spec is in fact that these attributes behave on <video> as they do on <img>.
And to be more precise, it just happens to not define what they do on <img> either.
An extra fun question.  Should hspace/vspace/border be supported on <video>? They're not in the HTML5 spec at all, for anything...

I'd guess "no".
Attached patch Like so, perhaps (obsolete) — Splinter Review
This still needs tests; I'd appreciate it if someone more familiar with when it's ok to take a snapshot would put those together...
Attachment #364144 - Flags: superreview?(roc)
Attachment #364144 - Flags: review?(roc)
Attachment #364144 - Flags: superreview?(roc)
Attachment #364144 - Flags: superreview+
Attachment #364144 - Flags: review?(roc)
Attachment #364144 - Flags: review-
Comment on attachment 364144 [details] [diff] [review]
Like so, perhaps

oops
Attachment #364144 - Flags: review- → review+
Attached patch with testsSplinter Review
Attachment #364144 - Attachment is obsolete: true
Attachment #364164 - Flags: superreview+
Attachment #364164 - Flags: review+
Whiteboard: [needs landing]
Pushed 98f8aef2dce4.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing] → [needs 191 landing]
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: