Add support for the object-position CSS property
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 00:01:17 +0000 (00:01 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 00:01:17 +0000 (00:01 +0000)
commitbf37e4181ef324e76fa5b5903ec5e2faffd5184b
tree43832b7fb312cfc15bb324f293dbf5a0cb59015f
parent3ed038d2ea2ab306f1b83d3c7bd5312b1376dbcf
Add support for the object-position CSS property
https://bugs.webkit.org/show_bug.cgi?id=122811
rdar://problem/15836338

Reviewed by Sam Weinig.

Source/WebCore:

Take object-position into account when rendering replaced elements.
RenderReplaced::replacedContentRect() is the one place where we compute
the content rect for replaced elements.

Also return false from foregroundIsKnownToBeOpaqueInRect() if we have
any non-default object-position, as the foreground may no longer fill the box.

Tests: compositing/video/video-object-position.html
       fast/css/object-position/object-position-canvas.html
       fast/css/object-position/object-position-embed.html
       fast/css/object-position/object-position-img-svg.html
       fast/css/object-position/object-position-img.html
       fast/css/object-position/object-position-input-image.html
       fast/css/object-position/object-position-object.html
       fast/css/object-position/object-position-video-poster.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::replacedContentRect):

LayoutTests:

Various object-position tests.

* compositing/video/video-object-position-expected.txt: Added.
* compositing/video/video-object-position.html: Added.
* fast/css/object-position/object-position-embed-expected.html: Added.
* fast/css/object-position/object-position-embed.html: Added.
* fast/css/object-position/object-position-img-expected.html: Added.
* fast/css/object-position/object-position-img-svg-expected.html: Added.
* fast/css/object-position/object-position-img-svg.html: Added.
* fast/css/object-position/object-position-img.html: Added.
* fast/css/object-position/object-position-input-image-expected.html: Added.
* fast/css/object-position/object-position-input-image.html: Added.
* fast/css/object-position/object-position-object-expected.html: Added.
* fast/css/object-position/object-position-object.html: Added.
* fast/css/object-position/object-position-video-poster-expected.html: Added.
* fast/css/object-position/object-position-video-poster.html: Added.
* fast/css/object-position/resources/expected.css: Added.
* fast/css/object-position/resources/test.css: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/video/video-object-position-expected.txt [new file with mode: 0644]
LayoutTests/compositing/video/video-object-position.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-embed-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-embed.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-img-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-img-svg-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-img-svg.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-img.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-input-image-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-input-image.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-object-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-object.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-video-poster-expected.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/object-position-video-poster.html [new file with mode: 0644]
LayoutTests/fast/css/object-position/resources/expected.css [new file with mode: 0644]
LayoutTests/fast/css/object-position/resources/test.css [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderReplaced.cpp