Bug 52103

Summary: Video with object-fit: cover can spill outside the box
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, divya, eric.carlson, esprehn+autocc, glenn, jer.noble, kondapallykalyan, simon.fraser, zcorpan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch dino: review+

Description Simon Fraser (smfr) 2011-01-07 22:07:07 PST
Follow-on from bug 52040 :
With object-fit: cover, <video> may spill outside the box, and we don't have a layer we can set masksToBounds on to clip it.
Comment 1 Simon Pieters (:zcorpan) 2011-01-12 10:22:48 PST
object-fit:cover is supposed to spill outside the box when overflow:visible. No?
Comment 2 Simon Fraser (smfr) 2011-01-12 10:39:32 PST
So says the spec (not that I agree with it). But with overflow:hidden we'll have to fix this anyway.
Comment 3 Simon Pieters (:zcorpan) 2011-01-12 11:08:07 PST
We have the opposite problem in Opera, <video> is always clipped. However we could always change the spec to say that the content is always clipped regardless of 'overflow' if people think overflowing is useless/annoying.
Comment 4 Simon Pieters (:zcorpan) 2011-01-12 11:55:16 PST
...though maybe that ship has sailed for SVG content anyway.
Comment 5 Simon Fraser (smfr) 2011-01-12 12:36:06 PST
I think authors would not expect overflow for elements like <img> and <video>.
Comment 6 Simon Pieters (:zcorpan) 2011-01-13 00:08:15 PST
We could add overflow:hidden to the UA style sheet for those elements, maybe?
Comment 7 Simon Pieters (:zcorpan) 2011-01-13 06:42:12 PST
(spec bug http://www.w3.org/Bugs/Public/show_bug.cgi?id=11746 )
Comment 8 Simon Fraser (smfr) 2013-08-30 16:20:43 PDT
Created attachment 210173 [details]
Patch
Comment 9 WebKit Commit Bot 2013-08-30 16:22:37 PDT
Attachment 210173 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/compositing/images/direct-image-object-fit-expected.txt', u'LayoutTests/compositing/images/direct-image-object-fit.html', u'LayoutTests/compositing/reflections/direct-image-object-fit-reflected-expected.txt', u'LayoutTests/compositing/reflections/direct-image-object-fit-reflected.html', u'LayoutTests/compositing/video/video-object-fit-expected.txt', u'LayoutTests/compositing/video/video-object-fit.html', u'LayoutTests/platform/mac/compositing/images/direct-image-object-fit-expected.txt', u'LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt', u'LayoutTests/platform/mac/compositing/video/video-object-fit-expected.txt', u'Source/WebCore/ChangeLog', u'Source/WebCore/page/Frame.h', u'Source/WebCore/platform/graphics/GraphicsLayer.h', u'Source/WebCore/platform/graphics/MediaPlayer.cpp', u'Source/WebCore/platform/graphics/MediaPlayer.h', u'Source/WebCore/platform/graphics/MediaPlayerPrivate.h', u'Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp', u'Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h', u'Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp', u'Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h', u'Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h', u'Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm', u'Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp', u'Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h', u'Source/WebCore/rendering/RenderLayerBacking.cpp', u'Source/WebCore/rendering/RenderLayerCompositor.cpp', u'Source/WebCore/rendering/RenderVideo.cpp', u'Source/WebCore/testing/Internals.cpp', u'Source/WebCore/testing/Internals.h', u'Source/WebCore/testing/Internals.idl']" exit_code: 1
Source/WebCore/testing/Internals.h:228:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Source/WebCore/testing/Internals.h:229:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 30 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Simon Fraser (smfr) 2013-08-30 16:35:51 PDT
Created attachment 210175 [details]
Patch
Comment 11 WebKit Commit Bot 2013-08-30 16:43:35 PDT
Attachment 210175 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/compositing/images/direct-image-object-fit-expected.txt', u'LayoutTests/compositing/images/direct-image-object-fit.html', u'LayoutTests/compositing/reflections/direct-image-object-fit-reflected-expected.txt', u'LayoutTests/compositing/reflections/direct-image-object-fit-reflected.html', u'LayoutTests/compositing/video/video-object-fit-expected.txt', u'LayoutTests/compositing/video/video-object-fit.html', u'LayoutTests/media/video-object-fit-change.html', u'LayoutTests/platform/mac/TestExpectations', u'LayoutTests/platform/mac/compositing/images/direct-image-object-fit-expected.txt', u'LayoutTests/platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt', u'LayoutTests/platform/mac/compositing/video/video-object-fit-expected.txt', u'Source/WebCore/ChangeLog', u'Source/WebCore/page/Frame.h', u'Source/WebCore/platform/graphics/GraphicsLayer.h', u'Source/WebCore/platform/graphics/MediaPlayer.cpp', u'Source/WebCore/platform/graphics/MediaPlayer.h', u'Source/WebCore/platform/graphics/MediaPlayerPrivate.h', u'Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp', u'Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h', u'Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp', u'Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h', u'Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h', u'Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm', u'Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp', u'Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h', u'Source/WebCore/rendering/RenderLayerBacking.cpp', u'Source/WebCore/rendering/RenderLayerCompositor.cpp', u'Source/WebCore/rendering/RenderVideo.cpp', u'Source/WebCore/testing/Internals.cpp', u'Source/WebCore/testing/Internals.h', u'Source/WebCore/testing/Internals.idl']" exit_code: 1
Source/WebCore/testing/Internals.h:228:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Source/WebCore/testing/Internals.h:229:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 31 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Dean Jackson 2013-08-30 16:46:28 PDT
Comment on attachment 210175 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=210175&action=review

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1797
> +    bool needContentsClippingLayer = !m_contentsClippingRect.contains(m_contentsRect);
> +    bool gainedOrLostClippingLayer = false;
> +    if (needContentsClippingLayer) {

You don't need needContentsClippingLayer.

> LayoutTests/compositing/video/video-object-fit.html:52
> +            }, 1500);

1.5s :(
Comment 13 Simon Fraser (smfr) 2013-08-30 17:13:56 PDT
https://trac.webkit.org/r154921