Skip to content
  • betravis@adobe.com's avatar
    [CSS Shapes] Accept the new <box> value for shape-outside · edfb6516
    betravis@adobe.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@159307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    edfb6516