[CSS Shapes] Image valued shape size and position should conform to the spec
authorhmuller@adobe.com <hmuller@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 00:06:45 +0000 (00:06 +0000)
committerhmuller@adobe.com <hmuller@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 00:06:45 +0000 (00:06 +0000)
commit5335d9caed379bbaae2b28d970924ea77c4e1ea2
treeae36eec0a523aa669295be3ca3be4fc9641d43c0
parentb02c9493f8cbfc60ebc843318430f277a9122ed7
[CSS Shapes] Image valued shape size and position should conform to the spec
https://bugs.webkit.org/show_bug.cgi?id=123295

Reviewed by Andreas Kling.

Source/WebCore:

Implement image valued shape-outside scaling and translation per the spec,
http://dev.w3.org/csswg/css-shapes/#shapes-from-image:

"The image is sized and positioned as if it were a replaced element whose
specified width and height are the same as the element’s used content box size."

This change doesn't completely fulfill the spec, it's limited to image elements
and shape-outside.

Tests: fast/shapes/shape-outside-floats/shape-outside-image-fit-001.html
       fast/shapes/shape-outside-floats/shape-outside-image-fit-002.html
       fast/shapes/shape-outside-floats/shape-outside-image-fit-003.html
       fast/shapes/shape-outside-floats/shape-outside-image-fit-004.html

* rendering/shapes/Shape.h:
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
Added an imageRect parameter which specifies where the shape image is to
appear relative to the content box. The imageRect implies both scaling and
translation of the shape image.

* rendering/shapes/ShapeInfo.cpp:
(WebCore::ShapeInfo<RenderType>::computedShape):
(WebCore::getShapeImageRect):
For replaced elements, compute the shape's imageRect with
RenderReplaced::replacedContentRect().

LayoutTests:

* fast/shapes/shape-outside-floats/shape-outside-image-fit-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-003-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-003.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-004-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-fit-004.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-003-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-003.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-004-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-fit-004.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/shapes/Shape.cpp
Source/WebCore/rendering/shapes/Shape.h
Source/WebCore/rendering/shapes/ShapeInfo.cpp