[CSS Shapes][css clip-path] rounded corner calculation for box shapes is wrong
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Mar 2014 23:40:04 +0000 (23:40 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Mar 2014 23:40:04 +0000 (23:40 +0000)
commit96a895efe1455cf13325b205d70e2d74159ce95e
tree33cd62b3291bfe9004fc9171c6c406ebac335275
parent5a596d6d630369fd48fb0c72b7b1995c17e98b94
[CSS Shapes][css clip-path] rounded corner calculation for box shapes is wrong
https://bugs.webkit.org/show_bug.cgi?id=127982

Reviewed by Simon Fraser.

Source/WebCore:

Calculate rounded corners for box shapes as defined in the CSS Shapes
spec.

Tests: css3/masking/clip-path-border-radius-border-box-000.html
       css3/masking/clip-path-border-radius-content-box-000.html
       css3/masking/clip-path-border-radius-content-box-001.html
       css3/masking/clip-path-border-radius-padding-box-000.html
       css3/masking/clip-path-border-radius-padding-box-001.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-000.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-001.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-002.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-000.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-001.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-002.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-003.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-000.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-001.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-002.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-003.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-004.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-000.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-001.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-002.html
       fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-003.html

* platform/graphics/RoundedRect.h:
(WebCore::RoundedRect::Radii::transposedRadii): Transpose radii for
    vertical writing modes.
(WebCore::RoundedRect::moveBy): Add method for use with clip path.
(WebCore::RoundedRect::transposedRect): Transpose rect for vertical
    writing modes.
* rendering/RenderBox.h:
(WebCore::RenderBox::marginBoxRect): Return the margin box rect for
    the RenderBox.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupClipPath): Call the new function for the
    rounded corner calculation.
* rendering/shapes/ShapeInfo.cpp:
(WebCore::ShapeInfo<RenderType>::computedShape): Call the new function
    for the rounded corner calculation.
* rendering/shapes/BoxShape.cpp:
(WebCore::adjustRadiusForMarginBoxShape): Helper function for
    computeRoundedRectForLayoutBoxShape.
(WebCore::computeMarginBoxShapeRadius): Ditto.
(WebCore::computeMarginBoxShapeRadii): Ditto.
(WebCore::computeRoundedRectForBoxShape): Utility function to do the
    rounded corner calculation.
* rendering/shapes/BoxShape.h: Add new function.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::getRoundedInnerBorderFor): Add default argument
    values.

LayoutTests:

* css3/masking/clip-path-border-radius-border-box-000-expected.html: Added.
* css3/masking/clip-path-border-radius-border-box-000.html: Added.
* css3/masking/clip-path-border-radius-content-box-000-expected.html: Added.
* css3/masking/clip-path-border-radius-content-box-000.html: Added.
* css3/masking/clip-path-border-radius-content-box-001-expected.html: Added.
* css3/masking/clip-path-border-radius-content-box-001.html: Added.
* css3/masking/clip-path-border-radius-padding-box-000-expected.html: Added.
* css3/masking/clip-path-border-radius-padding-box-000.html: Added.
* css3/masking/clip-path-border-radius-padding-box-001-expected.html: Added.
* css3/masking/clip-path-border-radius-padding-box-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-000-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-000.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-000-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-000.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-003-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-003.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-000-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-000.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-003-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-003.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-004-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-004.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-000-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-000.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-003-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-003.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
51 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/masking/clip-path-border-radius-border-box-000-expected.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-border-box-000.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-content-box-000-expected.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-content-box-000.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-content-box-001-expected.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-content-box-001.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-padding-box-000-expected.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-padding-box-000.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-padding-box-001-expected.html [new file with mode: 0644]
LayoutTests/css3/masking/clip-path-border-radius-padding-box-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-000-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-000.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-border-box-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-000-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-000.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-003-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-content-box-003.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-000-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-000.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-003-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-003.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-004-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-margin-box-004.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-000-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-000.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-003-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-border-radius-padding-box-003.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/RoundedRect.h
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/shapes/BoxShape.cpp
Source/WebCore/rendering/shapes/BoxShape.h
Source/WebCore/rendering/shapes/ShapeInfo.cpp
Source/WebCore/rendering/style/RenderStyle.h