[CSS Shapes] Properly handle negative reference box widths and center coordinates
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 19:40:43 +0000 (19:40 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 19:40:43 +0000 (19:40 +0000)
commit299b7a602e86d33f95daa798937588776b521570
treeb32abc88581abce46944e6d5b93b788c2b8ceacb
parenta334e3745b2fd1200ede25f270a4e942849cab8c
[CSS Shapes] Properly handle negative reference box widths and center coordinates
https://bugs.webkit.org/show_bug.cgi?id=142610

Reviewed by Rob Buis.
Source/WebCore:

Fix a few cases where values that should not be negative end up that
way.

This patch is based on a couple of Blink patches by Rob Buis.

Tests: fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash.html
       fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash.html

* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine): A
    negative margin box width means that the shape has no extent, so
    clamp to zero.
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCircle::floatValueForRadiusInBox): When computing
    the radii, take the absolute value, since the radii is based on
    the distance, which is always positive.
(WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.

LayoutTests:

Tests for the cases that trigger asserts.

* fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash-expected.txt: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash-expected.txt: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
Source/WebCore/rendering/style/BasicShapes.cpp