Changeset 151517 in webkit


Ignore:
Timestamp:
Jun 12, 2013 11:59:58 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Shapes] rectangle and inset-rectangle do not properly handle rx and ry
https://bugs.webkit.org/show_bug.cgi?id=116745

Patch by Bem Jones-Bey <Bem Jones-Bey> on 2013-06-12
Reviewed by Dirk Schulze.

Source/WebCore:

If ry is not supplied, it now defaults to the rx value. Also, if rx
and ry are not supplied, they default to 0px. This also has the effect
that the computed style for any rectangle or inset-rectangle now
contains all six parameters.

If rx > width/2 then it is clamped to width/2, and if ry > height/2,
then it is clamped to height/2. This happens at layout time because
given mixed units and relative units, that is the only time this
determination can be made.

Tests: fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius.html

fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius.html

  • css/BasicShapeFunctions.cpp:

(WebCore::valueForBasicShape): Remove checks for undefined, since rx

and ry cannot be undefined in BasicShapes anymore.

(WebCore::basicShapeForValue): If radii are undefined in CSS, set

default values in the BasicShape, per the spec.

  • rendering/ExclusionShape.cpp:

(WebCore::ensureRadiiDoNotOverlap): Utility method to ensure radii

don't overlap.

(WebCore::ExclusionShape::createExclusionShape): Remove defaulting to

zero, clamp radii per the spec.

  • rendering/style/BasicShapes.cpp:

(WebCore::BasicShapeRectangle::path): Remove defaulting.
(WebCore::BasicShapeRectangle::blend): Ditto.
(WebCore::BasicShapeInsetRectangle::path): Ditto.
(WebCore::BasicShapeInsetRectangle::blend): Ditto.

  • rendering/style/BasicShapes.h:

(WebCore::BasicShapeRectangle::BasicShapeRectangle): Remove defaulting

to undefined for radii.

(WebCore::BasicShapeRectangle::setCornerRadiusX): Add assert to

prevent undefined.

(WebCore::BasicShapeRectangle::setCornerRadiusY): Add assert to

prevent undefined.

(WebCore::BasicShapeInsetRectangle::BasicShapeInsetRectangle): Ditto.
(WebCore::BasicShapeInsetRectangle::setCornerRadiusX): Add assert to

prevent undefined.

(WebCore::BasicShapeInsetRectangle::setCornerRadiusY): Add assert to

prevent undefined.

LayoutTests:

Update tests to check for the rx and ry conditions.

  • fast/exclusions/parsing/parsing-shape-inside-expected.txt: New results.
  • fast/exclusions/parsing/parsing-shape-outside-expected.txt: New results.
  • fast/exclusions/parsing/script-tests/parsing-shape-inside.js: Update

to reflect that the computed value now always has rx and ry.

  • fast/exclusions/parsing/script-tests/parsing-shape-outside.js: Ditto.
  • fast/exclusions/parsing/script-tests/parsing-test-utils.js: Ditto.
  • fast/exclusions/resources/rounded-rectangle.js:

(genLeftRightRoundedRectFloatShapeOutsideRefTest): Factor out left and

right into separate methods so that they can be used in tests that
only have left floats or only right floats.

(genLeftRoundedRectFloatShapeOutsideRefTest): Ditto.
(genRightRoundedRectFloatShapeOutsideRefTest): Ditto.

  • fast/exclusions/shape-inside/shape-inside-animation-expected.txt: New results.
  • fast/exclusions/shape-inside/shape-inside-animation.html: Change to

reflect new computed style value.

  • fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius.html: Added.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius-expected.html: Added.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius.html: Added.

Note that the expected test here uses shape-inside, because we
really are just testing that the behavior is the same as a
shape-inside with rx and ry set to 50%, and it turned out to be
very hard to construct an expected result that didn't use
shape-inside and wasn't off by a pixel.

  • css3/masking/clip-path-animation.html: Update expected value.
  • css3/masking/clip-path-animation-expected.txt: New results.
Location:
trunk
Files:
4 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r151511 r151517  
     12013-06-12  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] rectangle and inset-rectangle do not properly handle rx and ry
     4        https://bugs.webkit.org/show_bug.cgi?id=116745
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Update tests to check for the rx and ry conditions.
     9
     10        * fast/exclusions/parsing/parsing-shape-inside-expected.txt: New results.
     11        * fast/exclusions/parsing/parsing-shape-outside-expected.txt: New results.
     12        * fast/exclusions/parsing/script-tests/parsing-shape-inside.js: Update
     13            to reflect that the computed value now always has rx and ry.
     14        * fast/exclusions/parsing/script-tests/parsing-shape-outside.js: Ditto.
     15        * fast/exclusions/parsing/script-tests/parsing-test-utils.js: Ditto.
     16        * fast/exclusions/resources/rounded-rectangle.js:
     17        (genLeftRightRoundedRectFloatShapeOutsideRefTest): Factor out left and
     18            right into separate methods so that they can be used in tests that
     19            only have left floats or only right floats.
     20        (genLeftRoundedRectFloatShapeOutsideRefTest): Ditto.
     21        (genRightRoundedRectFloatShapeOutsideRefTest): Ditto.
     22        * fast/exclusions/shape-inside/shape-inside-animation-expected.txt: New results.
     23        * fast/exclusions/shape-inside/shape-inside-animation.html: Change to
     24            reflect new computed style value.
     25        * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius-expected.html: Added.
     26        * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius.html: Added.
     27        * fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius-expected.html: Added.
     28        * fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius.html: Added.
     29            Note that the expected test here uses shape-inside, because we
     30            really are just testing that the behavior is the same as a
     31            shape-inside with rx and ry set to 50%, and it turned out to be
     32            very hard to construct an expected result that didn't use
     33            shape-inside and wasn't off by a pixel.
     34        * css3/masking/clip-path-animation.html: Update expected value.
     35        * css3/masking/clip-path-animation-expected.txt: New results.
     36
    1372013-06-12  Csaba Osztrogonác  <ossy@webkit.org>
    238
  • trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt

    r134736 r151517  
    11   
    2 PASS - "webkitClipPath" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%)
     2PASS - "webkitClipPath" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px)
    33PASS - "webkitClipPath" property for "circle-box" element at 1s saw something close to: circle(35%, 35%, 35%)
    44PASS - "webkitClipPath" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%)
  • trunk/LayoutTests/css3/masking/clip-path-animation.html

    r134736 r151517  
    5454    const expectedValues = [
    5555      // [animation-name, time, element-id, property, expected-value, tolerance]
    56       ["rectangle-anim",  1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%)", 0.05],
     56      ["rectangle-anim",  1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05],
    5757      ["circle-anim",  1, "circle-box", "webkitClipPath", "circle(35%, 35%, 35%)", 0.05],
    5858      ["ellipse-anim",  1, "ellipse-box", "webkitClipPath", "ellipse(35%, 35%, 35%, 30%)", 0.05],
  • trunk/LayoutTests/fast/exclusions/parsing/parsing-shape-inside-expected.txt

    r150904 r151517  
    77PASS getComputedStyleValue("-webkit-shape-inside", "auto") is "auto"
    88PASS getCSSText("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
    9 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
     9PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    1010PASS getCSSText("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px)"
    11 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px)"
     11PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 5px)"
    1212PASS getCSSText("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1313PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1414PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)"
    15 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)"
     15PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    1616PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)"
    17 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)"
     17PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 5px)"
    1818PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1919PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
     
    9898PASS getCSSText("-webkit-shape-inside", "polygon(10px, 20px, 30px, 40px, 40px, 50px)") is ""
    9999PASS getComputedStyleValue("-webkit-shape-inside", "polygon(10px, 20px, 30px, 40px, 40px, 50px)") is "outside-shape"
    100 PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "auto", "rectangle(10px, 20px, 30px, 40px)") is "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"
    101 PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "outside-shape", "rectangle(10px, 20px, 30px, 40px)") is "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px)"
    102 PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "initial") is "parent: rectangle(10px, 20px, 30px, 40px), child: outside-shape"
    103 PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "") is "parent: rectangle(10px, 20px, 30px, 40px), child: outside-shape"
    104 PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "inherit") is "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)"
     100PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "auto", "rectangle(10px, 20px, 30px, 40px)") is "parent: auto, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
     101PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "outside-shape", "rectangle(10px, 20px, 30px, 40px)") is "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
     102PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "initial") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: outside-shape"
     103PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: outside-shape"
     104PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "inherit") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    105105PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "", "inherit") is "parent: outside-shape, child: outside-shape"
    106106PASS getParentAndChildComputedStylesString("-webkit-shape-inside", "auto", "inherit") is "parent: auto, child: auto"
  • trunk/LayoutTests/fast/exclusions/parsing/parsing-shape-outside-expected.txt

    r150904 r151517  
    77PASS getComputedStyleValue("-webkit-shape-outside", "auto") is "auto"
    88PASS getCSSText("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
    9 PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
     9PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    1010PASS getCSSText("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px)"
    11 PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px)"
     11PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 5px)"
    1212PASS getCSSText("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1313PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1414PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)"
    15 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)"
     15PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    1616PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)"
    17 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)"
     17PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 5px)"
    1818PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
    1919PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)"
     
    9898PASS getCSSText("-webkit-shape-outside", "outside-shape") is ""
    9999PASS getComputedStyleValue("-webkit-shape-outside", "outside-shape") is "auto"
    100 PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "auto", "rectangle(10px, 20px, 30px, 40px)") is "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"
    101 PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "initial") is "parent: rectangle(10px, 20px, 30px, 40px), child: auto"
    102 PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "") is "parent: rectangle(10px, 20px, 30px, 40px), child: auto"
    103 PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "inherit") is "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)"
     100PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "auto", "rectangle(10px, 20px, 30px, 40px)") is "parent: auto, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
     101PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "initial") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: auto"
     102PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: auto"
     103PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "inherit") is "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"
    104104PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "", "inherit") is "parent: auto, child: auto"
    105105PASS getParentAndChildComputedStylesString("-webkit-shape-outside", "auto", "inherit") is "parent: auto, child: auto"
  • trunk/LayoutTests/fast/exclusions/parsing/script-tests/parsing-shape-inside.js

    r151247 r151517  
    99    var value = (elt instanceof Array) ? elt[0] : elt;
    1010    var expectedValue = (elt instanceof Array) ? elt[1] : elt;
     11    var computedValue = (elt instanceof Array && elt.length > 2) ? elt[2] : expectedValue;
    1112    testShapeSpecifiedProperty("-webkit-shape-inside", value, expectedValue);
    12     testShapeComputedProperty("-webkit-shape-inside", value, expectedValue);
     13    testShapeComputedProperty("-webkit-shape-inside", value, computedValue);
    1314});
    1415
     
    2223    testNotInheritedShapeProperty,
    2324    [// [property, parentValue, childValue, expectedValue]
    24      ["-webkit-shape-inside", "auto", "rectangle(10px, 20px, 30px, 40px)", "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"],
    25      ["-webkit-shape-inside", "outside-shape", "rectangle(10px, 20px, 30px, 40px)", "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px)"],
    26      ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "initial", "parent: rectangle(10px, 20px, 30px, 40px), child: outside-shape"],
    27      ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "", "parent: rectangle(10px, 20px, 30px, 40px), child: outside-shape"],
    28      ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "inherit", "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)"],
     25     ["-webkit-shape-inside", "auto", "rectangle(10px, 20px, 30px, 40px)", "parent: auto, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
     26     ["-webkit-shape-inside", "outside-shape", "rectangle(10px, 20px, 30px, 40px)", "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
     27     ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "initial", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: outside-shape"],
     28     ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: outside-shape"],
     29     ["-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px)", "inherit", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
    2930     ["-webkit-shape-inside", "", "inherit", "parent: outside-shape, child: outside-shape"],
    3031     ["-webkit-shape-inside", "auto", "inherit", "parent: auto, child: auto"]]
  • trunk/LayoutTests/fast/exclusions/parsing/script-tests/parsing-shape-outside.js

    r151247 r151517  
    99    var value = (elt instanceof Array) ? elt[0] : elt;
    1010    var expectedValue = (elt instanceof Array) ? elt[1] : elt;
     11    var computedValue = (elt instanceof Array && elt.length > 2) ? elt[2] : expectedValue;
    1112    testShapeSpecifiedProperty("-webkit-shape-outside", value, expectedValue);
    12     testShapeComputedProperty("-webkit-shape-outside", value, expectedValue);
     13    testShapeComputedProperty("-webkit-shape-outside", value, computedValue);
    1314});
    1415
     
    2425    testNotInheritedShapeProperty,
    2526    [// [property, parentValue, childValue, expectedValue]
    26      ["-webkit-shape-outside", "auto", "rectangle(10px, 20px, 30px, 40px)", "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"],
    27      ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "initial", "parent: rectangle(10px, 20px, 30px, 40px), child: auto"],
    28      ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "", "parent: rectangle(10px, 20px, 30px, 40px), child: auto"],
    29      ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "inherit", "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)"],
     27     ["-webkit-shape-outside", "auto", "rectangle(10px, 20px, 30px, 40px)", "parent: auto, child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
     28     ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "initial", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: auto"],
     29     ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: auto"],
     30     ["-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px)", "inherit", "parent: rectangle(10px, 20px, 30px, 40px, 0px, 0px), child: rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
    3031     ["-webkit-shape-outside", "", "inherit", "parent: auto, child: auto"],
    3132     ["-webkit-shape-outside", "auto", "inherit", "parent: auto, child: auto"]]
  • trunk/LayoutTests/fast/exclusions/parsing/script-tests/parsing-test-utils.js

    r150904 r151517  
    11// Valid values for both shape-inside and shape-outside. Two values are specified when the shape property value
    2 // differs from the specified value.
     2// differs from the specified value. Three values are specified when the computed shape property value differs
     3// from the specified value.
     4// eg: "specified value/CSS Text value/computed style value"
     5// or: ["specified value", "CSS Text value/computed style value"]
     6// or: ["specified value", "CSS Text value", "Computed style value"]
    37var validShapeValues = [
    48    "auto",
    5     "rectangle(10px, 20px, 30px, 40px)",
    6     "rectangle(10px, 20px, 30px, 40px, 5px)",
     9    ["rectangle(10px, 20px, 30px, 40px)", "rectangle(10px, 20px, 30px, 40px)", "rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
     10    ["rectangle(10px, 20px, 30px, 40px, 5px)", "rectangle(10px, 20px, 30px, 40px, 5px)", "rectangle(10px, 20px, 30px, 40px, 5px, 5px)"],
    711    "rectangle(10px, 20px, 30px, 40px, 5px, 10px)",
    812
    9     "inset-rectangle(10px, 20px, 30px, 40px)",
    10     "inset-rectangle(10px, 20px, 30px, 40px, 5px)",
     13    ["inset-rectangle(10px, 20px, 30px, 40px)", "inset-rectangle(10px, 20px, 30px, 40px)", "inset-rectangle(10px, 20px, 30px, 40px, 0px, 0px)"],
     14    ["inset-rectangle(10px, 20px, 30px, 40px, 5px)", "inset-rectangle(10px, 20px, 30px, 40px, 5px)", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 5px)"],
    1115    "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)",
    1216
  • trunk/LayoutTests/fast/exclusions/resources/rounded-rectangle.js

    r150032 r151517  
    3131function genLeftRightRoundedRectFloatShapeOutsideRefTest(args)
    3232{
     33    genLeftRoundedRectFloatShapeOutsideRefTest(args);
     34    genRightRoundedRectFloatShapeOutsideRefTest(args);
     35}
     36
     37function genLeftRoundedRectFloatShapeOutsideRefTest(args)
     38{
    3339    var leftRoundedRect = args.roundedRect;
    3440    var leftRoundedRectIntervals = scanConvertRoundedRectangleOutside(leftRoundedRect, args.containerHeight, args.lineHeight);
     
    3945    });
    4046    document.getElementById("left-" + args.insertElementIdSuffix).insertAdjacentHTML('afterend', leftFloatDivs.join("\n"));
     47}
    4148
     49function genRightRoundedRectFloatShapeOutsideRefTest(args)
     50{
    4251    var rightRoundedRect = Object.create(args.roundedRect);
    4352    rightRoundedRect.x = args.containerWidth - args.roundedRect.width;
  • trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation-expected.txt

    r134736 r151517  
    11Moving Text Moving Text Moving Text Moving Text
    2 PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%)
     2PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px)
    33PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35%, 35%, 35%)
    44PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%)
  • trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-animation.html

    r151247 r151517  
    5757    const expectedValues = [
    5858      // [animation-name, time, element-id, property, expected-value, tolerance]
    59       ["rectangle-anim",  1, "rectangle-box", "webkitShapeInside", "rectangle(10%, 10%, 80%, 80%)", 0.05],
     59      ["rectangle-anim",  1, "rectangle-box", "webkitShapeInside", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05],
    6060      ["circle-anim",  1, "circle-box", "webkitShapeInside", "circle(35%, 35%, 35%)", 0.05],
    6161      ["ellipse-anim",  1, "ellipse-box", "webkitShapeInside", "ellipse(35%, 35%, 35%, 30%)", 0.05],
  • trunk/Source/WebCore/ChangeLog

    r151516 r151517  
     12013-06-12  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] rectangle and inset-rectangle do not properly handle rx and ry
     4        https://bugs.webkit.org/show_bug.cgi?id=116745
     5
     6        Reviewed by Dirk Schulze.
     7
     8        If ry is not supplied, it now defaults to the rx value. Also, if rx
     9        and ry are not supplied, they default to 0px. This also has the effect
     10        that the computed style for any rectangle or inset-rectangle now
     11        contains all six parameters.
     12
     13        If rx > width/2 then it is clamped to width/2, and if ry > height/2,
     14        then it is clamped to height/2. This happens at layout time because
     15        given mixed units and relative units, that is the only time this
     16        determination can be made.
     17
     18        Tests: fast/exclusions/shape-inside/shape-inside-rounded-rectangle-large-radius.html
     19               fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius.html
     20
     21        * css/BasicShapeFunctions.cpp:
     22        (WebCore::valueForBasicShape): Remove checks for undefined, since rx
     23            and ry cannot be undefined in BasicShapes anymore.
     24        (WebCore::basicShapeForValue): If radii are undefined in CSS, set
     25            default values in the BasicShape, per the spec.
     26        * rendering/ExclusionShape.cpp:
     27        (WebCore::ensureRadiiDoNotOverlap): Utility method to ensure radii
     28            don't overlap.
     29        (WebCore::ExclusionShape::createExclusionShape): Remove defaulting to
     30            zero, clamp radii per the spec.
     31        * rendering/style/BasicShapes.cpp:
     32        (WebCore::BasicShapeRectangle::path): Remove defaulting.
     33        (WebCore::BasicShapeRectangle::blend): Ditto.
     34        (WebCore::BasicShapeInsetRectangle::path): Ditto.
     35        (WebCore::BasicShapeInsetRectangle::blend): Ditto.
     36        * rendering/style/BasicShapes.h:
     37        (WebCore::BasicShapeRectangle::BasicShapeRectangle): Remove defaulting
     38            to undefined for radii.
     39        (WebCore::BasicShapeRectangle::setCornerRadiusX): Add assert to
     40            prevent undefined.
     41       (WebCore::BasicShapeRectangle::setCornerRadiusY): Add assert to
     42            prevent undefined.
     43        (WebCore::BasicShapeInsetRectangle::BasicShapeInsetRectangle): Ditto.
     44        (WebCore::BasicShapeInsetRectangle::setCornerRadiusX): Add assert to
     45            prevent undefined.
     46       (WebCore::BasicShapeInsetRectangle::setCornerRadiusY): Add assert to
     47            prevent undefined.
     48
    1492013-06-11  Brent Fulgham  <bfulgham@apple.com>
    250
  • trunk/Source/WebCore/css/BasicShapeFunctions.cpp

    r150917 r151517  
    5151        rectangleValue->setWidth(cssValuePool().createValue(rectangle->width()));
    5252        rectangleValue->setHeight(cssValuePool().createValue(rectangle->height()));
    53         if (!rectangle->cornerRadiusX().isUndefined()) {
    54             rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
    55             if (!rectangle->cornerRadiusY().isUndefined())
    56                 rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
    57         }
     53        rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
     54        rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
    5855
    5956        basicShapeValue = rectangleValue.release();
     
    103100        rectangleValue->setBottom(cssValuePool().createValue(rectangle->bottom()));
    104101        rectangleValue->setLeft(cssValuePool().createValue(rectangle->left()));
    105         if (!rectangle->cornerRadiusX().isUndefined()) {
    106             rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
    107             if (!rectangle->cornerRadiusY().isUndefined())
    108                 rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
    109         }
     102        rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
     103        rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
    110104
    111105        basicShapeValue = rectangleValue.release();
     
    137131        rect->setHeight(convertToLength(style, rootStyle, rectValue->height()));
    138132        if (rectValue->radiusX()) {
    139             rect->setCornerRadiusX(convertToLength(style, rootStyle, rectValue->radiusX()));
     133            Length radiusX = convertToLength(style, rootStyle, rectValue->radiusX());
     134            rect->setCornerRadiusX(radiusX);
    140135            if (rectValue->radiusY())
    141136                rect->setCornerRadiusY(convertToLength(style, rootStyle, rectValue->radiusY()));
     137            else
     138                rect->setCornerRadiusY(radiusX);
     139        } else {
     140            rect->setCornerRadiusX(Length(0, Fixed));
     141            rect->setCornerRadiusY(Length(0, Fixed));
    142142        }
    143143        basicShape = rect.release();
     
    188188        rect->setLeft(convertToLength(style, rootStyle, rectValue->left()));
    189189        if (rectValue->radiusX()) {
    190             rect->setCornerRadiusX(convertToLength(style, rootStyle, rectValue->radiusX()));
     190            Length radiusX = convertToLength(style, rootStyle, rectValue->radiusX());
     191            rect->setCornerRadiusX(radiusX);
    191192            if (rectValue->radiusY())
    192193                rect->setCornerRadiusY(convertToLength(style, rootStyle, rectValue->radiusY()));
     194            else
     195                rect->setCornerRadiusY(radiusX);
     196        } else {
     197            rect->setCornerRadiusX(Length(0, Fixed));
     198            rect->setCornerRadiusY(Length(0, Fixed));
    193199        }
    194200        basicShape = rect.release();
  • trunk/Source/WebCore/rendering/shapes/Shape.cpp

    r151402 r151517  
    9191}
    9292
     93static inline void ensureRadiiDoNotOverlap(FloatRect &bounds, FloatSize &radii)
     94{
     95    float widthRatio = bounds.width() / (2 * radii.width());
     96    float heightRatio = bounds.height() / (2 * radii.height());
     97    float reductionRatio = std::min<float>(widthRatio, heightRatio);
     98    if (reductionRatio < 1) {
     99        radii.setWidth(reductionRatio * radii.width());
     100        radii.setHeight(reductionRatio * radii.height());
     101    }
     102}
     103
    93104PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, Length margin, Length padding)
    94105{
     
    109120            floatValueForLength(rectangle->width(), boxWidth),
    110121            floatValueForLength(rectangle->height(), boxHeight));
    111         Length radiusXLength = rectangle->cornerRadiusX();
    112         Length radiusYLength = rectangle->cornerRadiusY();
    113122        FloatSize cornerRadii(
    114             radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth),
    115             radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight));
     123            floatValueForLength(rectangle->cornerRadiusX(), boxWidth),
     124            floatValueForLength(rectangle->cornerRadiusY(), boxHeight));
     125        ensureRadiiDoNotOverlap(bounds, cornerRadii);
    116126        FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.height(), writingMode);
    117127
     
    170180            boxWidth - left - floatValueForLength(rectangle->right(), boxWidth),
    171181            boxHeight - top - floatValueForLength(rectangle->bottom(), boxHeight));
    172         Length radiusXLength = rectangle->cornerRadiusX();
    173         Length radiusYLength = rectangle->cornerRadiusY();
    174182        FloatSize cornerRadii(
    175             radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth),
    176             radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight));
     183            floatValueForLength(rectangle->cornerRadiusX(), boxWidth),
     184            floatValueForLength(rectangle->cornerRadiusY(), boxHeight));
     185        ensureRadiiDoNotOverlap(bounds, cornerRadii);
    177186        FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.height(), writingMode);
    178187
  • trunk/Source/WebCore/rendering/style/BasicShapes.cpp

    r151286 r151517  
    6363        ),
    6464        FloatSize(
    65             m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()),
    66             m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height())
     65            floatValueForLength(m_cornerRadiusX, boundingBox.width()),
     66            floatValueForLength(m_cornerRadiusY, boundingBox.height())
    6767        )
    6868    );
     
    7979    result->setWidth(m_width.blend(o->width(), progress));
    8080    result->setHeight(m_height.blend(o->height(), progress));
    81     if (!m_cornerRadiusX.isUndefined() && !o->cornerRadiusX().isUndefined())
    82         result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
    83     if (!m_cornerRadiusY.isUndefined() && !o->cornerRadiusY().isUndefined())
    84         result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
     81    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
     82    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
    8583    return result.release();
    8684}
     
    195193        ),
    196194        FloatSize(
    197             m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()),
    198             m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height())
     195            floatValueForLength(m_cornerRadiusX, boundingBox.width()),
     196            floatValueForLength(m_cornerRadiusY, boundingBox.height())
    199197        )
    200198    );
     
    211209    result->setBottom(m_bottom.blend(o->bottom(), progress));
    212210    result->setLeft(m_left.blend(o->left(), progress));
    213     if (!m_cornerRadiusX.isUndefined() && !o->cornerRadiusX().isUndefined())
    214         result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
    215     if (!m_cornerRadiusY.isUndefined() && !o->cornerRadiusY().isUndefined())
    216         result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
    217     return result.release();
    218 }
    219 }
     211    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
     212    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
     213    return result.release();
     214}
     215}
  • trunk/Source/WebCore/rendering/style/BasicShapes.h

    r150917 r151517  
    8080    void setWidth(Length width) { m_width = width; }
    8181    void setHeight(Length height) { m_height = height; }
    82     void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
    83     void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
     82    void setCornerRadiusX(Length radiusX)
     83    {
     84        ASSERT(!radiusX.isUndefined());
     85        m_cornerRadiusX = radiusX;
     86    }
     87    void setCornerRadiusY(Length radiusY)
     88    {
     89        ASSERT(!radiusY.isUndefined());
     90        m_cornerRadiusY = radiusY;
     91    }
    8492
    8593    virtual void path(Path&, const FloatRect&) OVERRIDE;
     
    8896    virtual Type type() const { return BasicShapeRectangleType; }
    8997private:
    90     BasicShapeRectangle()
    91         : m_cornerRadiusX(Undefined)
    92         , m_cornerRadiusY(Undefined)
    93     { }
     98    BasicShapeRectangle() { }
    9499
    95100    Length m_y;
     
    193198    void setBottom(Length bottom) { m_bottom = bottom; }
    194199    void setLeft(Length left) { m_left = left; }
    195     void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
    196     void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
     200    void setCornerRadiusX(Length radiusX)
     201    {
     202        ASSERT(!radiusX.isUndefined());
     203        m_cornerRadiusX = radiusX;
     204    }
     205    void setCornerRadiusY(Length radiusY)
     206    {
     207        ASSERT(!radiusY.isUndefined());
     208        m_cornerRadiusY = radiusY;
     209    }
    197210
    198211    virtual void path(Path&, const FloatRect&) OVERRIDE;
     
    201214    virtual Type type() const { return BasicShapeInsetRectangleType; }
    202215private:
    203     BasicShapeInsetRectangle()
    204         : m_cornerRadiusX(Undefined)
    205         , m_cornerRadiusY(Undefined)
    206     { }
     216    BasicShapeInsetRectangle() { }
    207217
    208218    Length m_right;
Note: See TracChangeset for help on using the changeset viewer.