New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 604195 link

Starred by 6 users

Issue metadata

Status: Duplicate
Merged: issue 400829
Owner: ----
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

CSS-tag “object-fit:cover” does not crop/clip videos in Chrome

Reported by batoma...@googlemail.com, Apr 17 2016

Issue description

Chrome Version       : 50.0.2661.75 (Offizieller Build) (64-Bit)
URLs (if applicable) : https://jsfiddle.net/xt0xcxzu/5/
Other browsers tested: Firefox 45.0.2, Safari 9.1, both on Mac
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari: OK (Mac: Safari 9.1)
    Firefox: OK (Mac: Firefox 45.0.2)
         IE: (not tested)

What steps will reproduce the problem?

CSS-tag "object-fit:cover" does not clip/crop videos in Chrome as expected.

I have created a demo that shows the wrong behavior: 
https://jsfiddle.net/xt0xcxzu/5/
You see the effect when you change the browser window size. With large height and small width (as well as with small height and large width) the videos start to overlap which is wrong. The images don't overlap and are therefore correct.

What is the expected result?
The behavior should be as shown in this image (top right): 
https://www.w3.org/TR/2011/WD-css3-images-20110217/img_scale.png
=> Videos should be cropped.

This happens only for videos and only in Chrome. Images are OK in Chrome. In all other tested browsers, images and videos are both working fine.

What happens instead?
Videos overlap the surrounding div.

Please provide any additional information below. Attach a screenshot if
possible

Screenshot attached.

Code from the demo:
HTML:
<div class="main">
	<div class="container" style="top:0; left:0">
	  <video autoplay loop>
	  	<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
	  </video>
	</div>
	<div class="container" style="top:0%; left:50%">
	  <video autoplay loop>
	  	<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
	  </video>
	</div>
	<div class="container" style="top:25%; left:0;">
	  <video autoplay loop>
	  	<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
	  </video>
	</div>
	<div class="container" style="top:25%; left:50%">
	  <video autoplay loop>
	  	<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
	  </video>
	</div>
	<div class="container" style="top:50%; left:0">
	  <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png"/>
	</div>
	<div class="container" style="top:50%; left:50%">
	  <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png"/>
	</div>
	<div class="container" style="top:75%; left:0">
	  <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png"/>
	</div>
	<div class="container" style="top:75%; left:50%">
	  <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png"/>
	</div>
</div>

CSS:
html, body{
	margin:0;
	padding:0;
	height:100%;
	width:100%;
	overflow:hidden;
}
.main{
  position:relative;
  width: 100%;
	height: 100%;
}
.container{
  position:absolute;
  width:50%;
  height:25%;
}
img, video{
  position: relative;
  object-fit:cover;
  overflow:hidden;
  width:100%;
  height:100%;
}


 
Bildschirmfoto 2016-04-17 um 18.13.19.png
249 KB View Download
Cc: msrchandra@chromium.org
Components: Blink
Labels: M-52
Status: Untriaged (was: Unconfirmed)
@batomaeus -- Thank You for the report.
Able to reproduce the issue on Latest Stable# 51.0.2661.75 on Windows, Mac and Linux.
This is a Non-Regression Issue existing from M32 builds# 32.0.1679.0 (Official Build 230262).
Thank You.
Components: -Blink Blink>Layout
yup, confirmed.

Comment 3 by e...@chromium.org, Apr 19 2016

Components: -Blink>Layout Blink>Media>Video
This also affects webRTC.
Created this bug in parallel here:
https://bugs.chromium.org/p/webrtc/issues/detail?id=5807

Comment 6 by braveyao@webrtc.org, Apr 26 2016

Blocking: webrtc:5807
Project Member

Comment 7 by sheriffbot@chromium.org, Jun 1 2016

Labels: -M-52 M-53 MovedFrom-52
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 8 by sheriffbot@chromium.org, Jul 13 2016

Labels: -M-53 MovedFrom-53
This issue has been moved once and is lower than Pri-1. Removing the milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: -Blink>Media>Video Blink>CSS
Doesn't seem to be an issue with the video element, rather the CSS issue.

Comment 10 by shans@chromium.org, Jul 19 2016

Components: -Blink>CSS Blink>Layout
This isn't CSS, I'm redirecting to Layout.

Comment 11 by e...@chromium.org, Jul 22 2016

Components: -Blink>Layout Blink>Media
Works fine for all non-video content, including images as demonstrated in the test case. Back to media team.
Cc: foolip@chromium.org mlamouri@chromium.org
Components: Blink>Layout
Labels: OS-Linux
Status: Available (was: Untriaged)
Emil, any guesses on why the video element would be different from the layout point of view?
 Issue 633375  has been merged into this issue.
Mergedinto: 400829
Status: Duplicate (was: Available)
Just found another version of this bug:  bug 400829 .
Blocking: -webrtc:5807

Sign in to add a comment