[CSS Shapes] Accept the new <box> value for shape-outside
authorbetravis@adobe.com <betravis@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Nov 2013 21:26:53 +0000 (21:26 +0000)
committerbetravis@adobe.com <betravis@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Nov 2013 21:26:53 +0000 (21:26 +0000)
commit31ac308409fe94384f19cc03b2977c5f79926bcc
treec93b4e04a806260d1e49167fcf969184f97f9801
parentbe608e1b85cb5e0cd1f3660d872e3f171d5f90e2
[CSS Shapes] Accept the new <box> value for shape-outside
https://bugs.webkit.org/show_bug.cgi?id=124227

Reviewed by David Hyatt.

Source/WebCore:

The shape-outside property can now be set to the box values [margin/border/padding/content]-box.
This patch adds the parsing code required to accept the new values, and the layout code
to create a rectangle shape that has the size and position of the appropriate box.

Tests: fast/shapes/shape-outside-floats/shape-outside-boxes-001.html
       fast/shapes/shape-outside-floats/shape-outside-boxes-002.html
       fast/shapes/shape-outside-floats/shape-outside-boxes-003.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): Output the new box values.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Accept the new box values.
* css/CSSValueKeywords.in: Add margin-box value.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyShape::applyValue): Accept the new box values.
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::borderLogicalWidth): Added new utility methods to help
with box sizing.
(WebCore::RenderBoxModelObject::borderLogicalHeight): Ditto.
(WebCore::RenderBoxModelObject::paddingLogicalWidth): Ditto.
(WebCore::RenderBoxModelObject::paddingLogicalHeight): Ditto.
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape): You can create a shape from a box's dimensions, rather
than always using a BasicShape or RasterShape value.
* rendering/shapes/Shape.h:
* rendering/shapes/ShapeInfo.cpp:
(WebCore::::computedShape): Create the appropriate shape based on the box values.
* rendering/shapes/ShapeInfo.h:
(WebCore::ShapeInfo::setShapeSize): Adjust for the box size when using a box value.
(WebCore::ShapeInfo::logicalTopOffset): Ditto.
(WebCore::ShapeInfo::logicalLeftOffset): Ditto.
* rendering/shapes/ShapeInsideInfo.cpp:
(WebCore::ShapeInsideInfo::isEnabledFor): Enable for the box values.
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::isEnabledFor): Disable for shape-inside.
* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::createBoxValue): Create the appropriate shape value for a box.
(WebCore::ShapeValue::box): Return the box value for this ShapeValue.
(WebCore::ShapeValue::ShapeValue): Create a ShapeValue from a box value.

LayoutTests:

Test the different box values with different writing modes.

* fast/shapes/parsing/parsing-shape-inside-expected.html: Adding box values as invalid.
* fast/shapes/parsing/parsing-shape-inside.html: Ditto.
* fast/shapes/parsing/parsing-shape-outside-expected.html: Adding box values as valid.
* fast/shapes/parsing/parsing-shape-outside.html: Ditto.
* fast/shapes/shape-outside-floats/shape-outside-boxes-001-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-boxes-001.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-boxes-002-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-boxes-002.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-boxes-003-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-boxes-003.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt
LayoutTests/fast/shapes/parsing/parsing-shape-inside.html
LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt
LayoutTests/fast/shapes/parsing/parsing-shape-outside.html
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-001-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-001.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-002-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-002.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-003-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-boxes-003.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/shapes/Shape.cpp
Source/WebCore/rendering/shapes/Shape.h
Source/WebCore/rendering/shapes/ShapeInfo.cpp
Source/WebCore/rendering/shapes/ShapeInfo.h
Source/WebCore/rendering/shapes/ShapeInsideInfo.cpp
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
Source/WebCore/rendering/style/ShapeValue.h