[css shapes] Parse new ellipse shape syntax

https://bugs.webkit.org/show_bug.cgi?id=124620

Patch by Rob Buis <rob.buis@samsung.com> on 2013-12-02
Reviewed by Dirk Schulze.

Source/WebCore:

Implement parsing of the new ellipse shape syntax. This closely follows the patch
for the new circle syntax (https://bugs.webkit.org/show_bug.cgi?id=124618), with
some refactoring of functionality shared by both.

Updated existing parsing tests to cover this.

* css/BasicShapeFunctions.cpp:
(WebCore::BasicShapeRadiusToCSSValue):
(WebCore::valueForBasicShape):
(WebCore::CSSValueToBasicShapeRadius):
(WebCore::basicShapeForValue):
* css/CSSBasicShapes.cpp:
(WebCore::buildEllipseString):
(WebCore::CSSBasicShapeEllipse::cssText):
(WebCore::CSSBasicShapeEllipse::equals):
(WebCore::buildDeprecatedEllipseString):
(WebCore::CSSDeprecatedBasicShapeEllipse::cssText):
(WebCore::CSSDeprecatedBasicShapeEllipse::equals):
* css/CSSBasicShapes.h:
(WebCore::CSSDeprecatedBasicShapeEllipse::create):
(WebCore::CSSDeprecatedBasicShapeEllipse::centerX):
(WebCore::CSSDeprecatedBasicShapeEllipse::centerY):
(WebCore::CSSDeprecatedBasicShapeEllipse::radiusX):
(WebCore::CSSDeprecatedBasicShapeEllipse::radiusY):
(WebCore::CSSDeprecatedBasicShapeEllipse::setCenterX):
(WebCore::CSSDeprecatedBasicShapeEllipse::setCenterY):
(WebCore::CSSDeprecatedBasicShapeEllipse::setRadiusX):
(WebCore::CSSDeprecatedBasicShapeEllipse::setRadiusY):
(WebCore::CSSDeprecatedBasicShapeEllipse::CSSDeprecatedBasicShapeEllipse):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseBasicShapeEllipse):
(WebCore::CSSParser::parseDeprecatedBasicShapeEllipse):
(WebCore::CSSParser::parseBasicShape):
* css/CSSParser.h:
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape):
* rendering/style/BasicShapes.cpp:
(WebCore::DeprecatedBasicShapeEllipse::path):
(WebCore::DeprecatedBasicShapeEllipse::blend):
(WebCore::BasicShapeEllipse::path):
(WebCore::BasicShapeEllipse::blend):
* rendering/style/BasicShapes.h:
(WebCore::BasicShapeEllipse::centerX):
(WebCore::BasicShapeEllipse::centerY):
(WebCore::BasicShapeEllipse::radiusX):
(WebCore::BasicShapeEllipse::radiusY):
(WebCore::BasicShapeEllipse::setCenterX):
(WebCore::BasicShapeEllipse::setCenterY):
(WebCore::BasicShapeEllipse::setRadiusX):
(WebCore::BasicShapeEllipse::setRadiusY):
(WebCore::BasicShapeEllipse::BasicShapeEllipse):
(WebCore::DeprecatedBasicShapeEllipse::create):
(WebCore::DeprecatedBasicShapeEllipse::DeprecatedBasicShapeEllipse):

LayoutTests:

Test that the new ellipse syntax is properly parsed.

* fast/shapes/parsing/parsing-shape-inside-expected.txt:
* fast/shapes/parsing/parsing-shape-outside-expected.txt:
* fast/shapes/parsing/parsing-test-utils.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 88f07961
2013-12-02 Rob Buis <rob.buis@samsung.com>
[css shapes] Parse new ellipse shape syntax
https://bugs.webkit.org/show_bug.cgi?id=124620
Reviewed by Dirk Schulze.
Test that the new ellipse syntax is properly parsed.
* fast/shapes/parsing/parsing-shape-inside-expected.txt:
* fast/shapes/parsing/parsing-shape-outside-expected.txt:
* fast/shapes/parsing/parsing-test-utils.js:
2013-12-02 Brendan Long <b.long@cablelabs.com>
Use GenericEventQueue in TrackListBase and reduce code duplication with scheduleTrackEvent()
......
......@@ -29,8 +29,6 @@ PASS getCSSText("-webkit-shape-inside", "circle(10px at 10px 10px)") is "circle(
PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at 10px 10px)") is "circle(10px at 10px 10px)"
PASS getCSSText("-webkit-shape-inside", "circle(at 10px)") is "circle(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-inside", "circle(at 10px)") is "circle(closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-inside", "circle(at 10px)") is "circle(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-inside", "circle(at 10px)") is "circle(closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-inside", "circle(at 10px 10px)") is "circle(at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "circle(at 10px 10px)") is "circle(closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-inside", "circle(at top left)") is "circle(at 0% 0%)"
......@@ -45,6 +43,38 @@ PASS getCSSText("-webkit-shape-inside", "circle(10px at right 10px bottom 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
PASS getCSSText("-webkit-shape-inside", "ellipse()") is "ellipse()"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse()") is "ellipse(closest-side closest-side at 50% 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px)") is "ellipse(10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px)") is "ellipse(10px closest-side at 50% 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px)") is "ellipse(10px 20px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at 10px)") is "ellipse(10px at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at 10px)") is "ellipse(10px closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at 10px)") is "ellipse(10px 20px at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at 10px)") is "ellipse(10px 20px at 10px 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at 10px 10px)") is "ellipse(10px at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at 10px 10px)") is "ellipse(10px closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(at 10px)") is "ellipse(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at 10px)") is "ellipse(closest-side closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(at 10px 10px)") is "ellipse(at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at 10px 10px)") is "ellipse(closest-side closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(at top left)") is "ellipse(at 0% 0%)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at top left)") is "ellipse(closest-side closest-side at 0% 0%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(at right bottom)") is "ellipse(at 100% 100%)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at left 0% top 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at left 10px top 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-inside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
PASS getComputedStyleValue("-webkit-shape-inside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
PASS getCSSText("-webkit-shape-inside", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)") is "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"
......@@ -127,16 +157,28 @@ PASS getCSSText("-webkit-shape-inside", "circle(at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "circle(at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-inside", "circle(at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "circle(at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse()") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse()") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px, 20px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px, 20px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px, 20px, 30px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px, 20px, 30px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px 30px 40px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px 30px 40px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px 30px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px 30px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at 10px 10px 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at 10px 10px 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px 30px at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px 30px at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(at 10px 10px 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at 10px 10px 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-inside", "ellipse(at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-inside", "polygon()") is ""
PASS getComputedStyleValue("-webkit-shape-inside", "polygon()") is "auto"
PASS getCSSText("-webkit-shape-inside", "polygon(evenodd 10px 20px, 30px 40px, 40px 50px)") is ""
......
......@@ -29,8 +29,6 @@ PASS getCSSText("-webkit-shape-outside", "circle(10px at 10px 10px)") is "circle
PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at 10px 10px)") is "circle(10px at 10px 10px)"
PASS getCSSText("-webkit-shape-outside", "circle(at 10px)") is "circle(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-outside", "circle(at 10px)") is "circle(closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-outside", "circle(at 10px)") is "circle(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-outside", "circle(at 10px)") is "circle(closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-outside", "circle(at 10px 10px)") is "circle(at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "circle(at 10px 10px)") is "circle(closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-outside", "circle(at top left)") is "circle(at 0% 0%)"
......@@ -45,6 +43,38 @@ PASS getCSSText("-webkit-shape-outside", "circle(10px at right 10px bottom 10px)
PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
PASS getCSSText("-webkit-shape-outside", "ellipse()") is "ellipse()"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse()") is "ellipse(closest-side closest-side at 50% 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px)") is "ellipse(10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px)") is "ellipse(10px closest-side at 50% 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px)") is "ellipse(10px 20px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at 10px)") is "ellipse(10px at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at 10px)") is "ellipse(10px closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at 10px)") is "ellipse(10px 20px at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at 10px)") is "ellipse(10px 20px at 10px 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at 10px 10px)") is "ellipse(10px at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at 10px 10px)") is "ellipse(10px closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(at 10px)") is "ellipse(at 10px 50%)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at 10px)") is "ellipse(closest-side closest-side at 10px 50%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(at 10px 10px)") is "ellipse(at 10px 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at 10px 10px)") is "ellipse(closest-side closest-side at 10px 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(at top left)") is "ellipse(at 0% 0%)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at top left)") is "ellipse(closest-side closest-side at 0% 0%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(at right bottom)") is "ellipse(at 100% 100%)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at left 0% top 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at left 10px top 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
PASS getCSSText("-webkit-shape-outside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
PASS getComputedStyleValue("-webkit-shape-outside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
PASS getCSSText("-webkit-shape-outside", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)") is "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"
......@@ -125,16 +155,28 @@ PASS getCSSText("-webkit-shape-outside", "circle(at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "circle(at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-outside", "circle(at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "circle(at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse()") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse()") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px, 20px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px, 20px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px, 20px, 30px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px, 20px, 30px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px 30px 40px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px 30px 40px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px 30px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px 30px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at 10px 10px 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at 10px 10px 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px 30px at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px 30px at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(at 10px 10px 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at 10px 10px 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(at 10px 10px at center)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at 10px 10px at center)") is "auto"
PASS getCSSText("-webkit-shape-outside", "ellipse(at center center 10px)") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at center center 10px)") is "auto"
PASS getCSSText("-webkit-shape-outside", "polygon()") is ""
PASS getComputedStyleValue("-webkit-shape-outside", "polygon()") is "auto"
PASS getCSSText("-webkit-shape-outside", "polygon(evenodd 10px 20px, 30px 40px, 40px 50px)") is ""
......
......@@ -14,14 +14,13 @@ var validShapeValues = [
["inset-rectangle(10px, 20px, 30px, 40px, 5px)", "inset-rectangle(10px, 20px, 30px, 40px, 5px)", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 5px)"],
"inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)",
"circle(10px, 20px, 30px)", // FIXME remove with deprecated circle
"circle(10px, 20px, 30px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
["circle()", "circle()", "circle(closest-side at 50% 50%)"],
["circle(10px)", "circle(10px)", "circle(10px at 50% 50%)"],
["circle(10px at 10px)", "circle(10px at 10px 50%)"],
"circle(10px at 10px 10px)",
["circle(at 10px)", "circle(at 10px 50%)", "circle(closest-side at 10px 50%)"],
["circle(at 10px)", "circle(at 10px 50%)", "circle(closest-side at 10px 50%)"],
["circle(at 10px 10px)", "circle(at 10px 10px)", "circle(closest-side at 10px 10px)"],
["circle(at top left)", "circle(at 0% 0%)", "circle(closest-side at 0% 0%)"],
["circle(at right bottom)", "circle(at 100% 100%)", "circle(closest-side at 100% 100%)"],
......@@ -29,7 +28,24 @@ var validShapeValues = [
["circle(10px at top 10px left 10px)", "circle(10px at left 10px top 10px)"],
["circle(10px at right 10px bottom 10px)", "circle(10px at right 10px bottom 10px)"],
"ellipse(10px, 20px, 30px, 40px)",
"ellipse(10px, 20px, 30px, 40px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
["ellipse()", "ellipse()", "ellipse(closest-side closest-side at 50% 50%)"],
["ellipse(10px)", "ellipse(10px)", "ellipse(10px closest-side at 50% 50%)"],
["ellipse(10px 20px)", "ellipse(10px 20px)", "ellipse(10px 20px at 50% 50%)"],
["ellipse(10px at 10px)", "ellipse(10px at 10px 50%)", "ellipse(10px closest-side at 10px 50%)"],
["ellipse(10px 20px at 10px)", "ellipse(10px 20px at 10px 50%)"],
["ellipse(10px at 10px 10px)", "ellipse(10px at 10px 10px)", "ellipse(10px closest-side at 10px 10px)"],
["ellipse(at 10px)", "ellipse(at 10px 50%)", "ellipse(closest-side closest-side at 10px 50%)"],
["ellipse(at 10px 10px)", "ellipse(at 10px 10px)", "ellipse(closest-side closest-side at 10px 10px)"],
["ellipse(at top left)", "ellipse(at 0% 0%)", "ellipse(closest-side closest-side at 0% 0%)"],
["ellipse(at right bottom)", "ellipse(at 100% 100%)", "ellipse(closest-side closest-side at 100% 100%)"],
["ellipse(10px at left top 10px)", "ellipse(10px at left 0% top 10px)", "ellipse(10px closest-side at left 0% top 10px)"],
["ellipse(10px at top 10px left 10px)", "ellipse(10px at left 10px top 10px)", "ellipse(10px closest-side at left 10px top 10px)"],
["ellipse(10px at right 10px bottom 10px)", "ellipse(10px at right 10px bottom 10px)", "ellipse(10px closest-side at right 10px bottom 10px)"],
["ellipse(10px 20px at left top 10px)", "ellipse(10px 20px at left 0% top 10px)"],
["ellipse(10px 20px at top 10px left 10px)", "ellipse(10px 20px at left 10px top 10px)"],
["ellipse(10px 20px at right 10px bottom 10px)", "ellipse(10px 20px at right 10px bottom 10px)"],
["polygon(10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"],
["polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"],
......@@ -71,9 +87,9 @@ var invalidShapeValues = [
"inset-rectangle(10px 20px 30px 40px)",
"inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)",
"circle(10px, 20px)", // FIXME remove with deprecated circle
"circle(10px 20px 30px)", // FIXME remove with deprecated circle
"circle(10px, 20px, 30px, 40px)", // FIXME remove with deprecated circle
"circle(10px, 20px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"circle(10px 20px 30px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"circle(10px, 20px, 30px, 40px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"circle(10px 20px)",
"circle(10px at 10px 10px 10px)",
......@@ -83,11 +99,18 @@ var invalidShapeValues = [
"circle(at 10px 10px at center)",
"circle(at center center 10px)",
"ellipse()",
"ellipse(10px)",
"ellipse(10px, 20px)",
"ellipse(10px, 20px, 30px)",
"ellipse(10px 20px 30px 40px)",
"ellipse(10px, 20px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"ellipse(10px, 20px, 30px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"ellipse(10px 20px 30px 40px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
"ellipse(10px 20px 30px)",
"ellipse(10px at 10px 10px 10px)",
"ellipse(10px at 10px 10px at center)",
"ellipse(10px at center center 10px)",
"ellipse(10px 20px 30px at center center 10px)",
"ellipse(at 10px 10px 10px)",
"ellipse(at 10px 10px at center)",
"ellipse(at center center 10px)",
"polygon()",
"polygon(evenodd 10px 20px, 30px 40px, 40px 50px)",
......
2013-12-02 Rob Buis <rob.buis@samsung.com>
[css shapes] Parse new ellipse shape syntax
https://bugs.webkit.org/show_bug.cgi?id=124620
Reviewed by Dirk Schulze.
Implement parsing of the new ellipse shape syntax. This closely follows the patch
for the new circle syntax (https://bugs.webkit.org/show_bug.cgi?id=124618), with
some refactoring of functionality shared by both.
Updated existing parsing tests to cover this.
* css/BasicShapeFunctions.cpp:
(WebCore::BasicShapeRadiusToCSSValue):
(WebCore::valueForBasicShape):
(WebCore::CSSValueToBasicShapeRadius):
(WebCore::basicShapeForValue):
* css/CSSBasicShapes.cpp:
(WebCore::buildEllipseString):
(WebCore::CSSBasicShapeEllipse::cssText):
(WebCore::CSSBasicShapeEllipse::equals):
(WebCore::buildDeprecatedEllipseString):
(WebCore::CSSDeprecatedBasicShapeEllipse::cssText):
(WebCore::CSSDeprecatedBasicShapeEllipse::equals):
* css/CSSBasicShapes.h:
(WebCore::CSSDeprecatedBasicShapeEllipse::create):
(WebCore::CSSDeprecatedBasicShapeEllipse::centerX):
(WebCore::CSSDeprecatedBasicShapeEllipse::centerY):
(WebCore::CSSDeprecatedBasicShapeEllipse::radiusX):
(WebCore::CSSDeprecatedBasicShapeEllipse::radiusY):
(WebCore::CSSDeprecatedBasicShapeEllipse::setCenterX):
(WebCore::CSSDeprecatedBasicShapeEllipse::setCenterY):
(WebCore::CSSDeprecatedBasicShapeEllipse::setRadiusX):
(WebCore::CSSDeprecatedBasicShapeEllipse::setRadiusY):
(WebCore::CSSDeprecatedBasicShapeEllipse::CSSDeprecatedBasicShapeEllipse):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseBasicShapeEllipse):
(WebCore::CSSParser::parseDeprecatedBasicShapeEllipse):
(WebCore::CSSParser::parseBasicShape):
* css/CSSParser.h:
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape):
* rendering/style/BasicShapes.cpp:
(WebCore::DeprecatedBasicShapeEllipse::path):
(WebCore::DeprecatedBasicShapeEllipse::blend):
(WebCore::BasicShapeEllipse::path):
(WebCore::BasicShapeEllipse::blend):
* rendering/style/BasicShapes.h:
(WebCore::BasicShapeEllipse::centerX):
(WebCore::BasicShapeEllipse::centerY):
(WebCore::BasicShapeEllipse::radiusX):
(WebCore::BasicShapeEllipse::radiusY):
(WebCore::BasicShapeEllipse::setCenterX):
(WebCore::BasicShapeEllipse::setCenterY):
(WebCore::BasicShapeEllipse::setRadiusX):
(WebCore::BasicShapeEllipse::setRadiusY):
(WebCore::BasicShapeEllipse::BasicShapeEllipse):
(WebCore::DeprecatedBasicShapeEllipse::create):
(WebCore::DeprecatedBasicShapeEllipse::DeprecatedBasicShapeEllipse):
2013-12-02 Alexey Proskuryakov <ap@apple.com>
Add support for WebCrypto RSA-OAEP
......@@ -100,6 +100,21 @@ static PassRefPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool
return pool.createValue(Pair::create(pool.createIdentifierValue(keyword), pool.createValue(center.length(), style)));
}
static PassRefPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(const RenderStyle* style, CSSValuePool& pool, const BasicShapeRadius& radius)
{
switch (radius.type()) {
case BasicShapeRadius::Value:
return pool.createValue(radius.value(), style);
case BasicShapeRadius::ClosestSide:
return pool.createIdentifierValue(CSSValueClosestSide);
case BasicShapeRadius::FarthestSide:
return pool.createIdentifierValue(CSSValueFarthestSide);
}
ASSERT_NOT_REACHED();
return 0;
}
PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicShape* basicShape)
{
CSSValuePool& pool = cssValuePool();
......@@ -137,23 +152,13 @@ PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicSha
circleValue->setCenterX(valueForCenterCoordinate(pool, style, circle->centerX()));
circleValue->setCenterY(valueForCenterCoordinate(pool, style, circle->centerY()));
switch (circle->radius().type()) {
case BasicShapeRadius::Value:
circleValue->setRadius(pool.createValue(circle->radius().value(), style));
break;
case BasicShapeRadius::ClosestSide:
circleValue->setRadius(pool.createIdentifierValue(CSSValueClosestSide));
break;
case BasicShapeRadius::FarthestSide:
circleValue->setRadius(pool.createIdentifierValue(CSSValueFarthestSide));
break;
}
circleValue->setRadius(basicShapeRadiusToCSSValue(style, pool, circle->radius()));
basicShapeValue = circleValue.release();
break;
}
case BasicShape::BasicShapeEllipseType: {
const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
RefPtr<CSSBasicShapeEllipse> ellipseValue = CSSBasicShapeEllipse::create();
case BasicShape::DeprecatedBasicShapeEllipseType: {
const DeprecatedBasicShapeEllipse* ellipse = static_cast<const DeprecatedBasicShapeEllipse*>(basicShape);
RefPtr<CSSDeprecatedBasicShapeEllipse> ellipseValue = CSSDeprecatedBasicShapeEllipse::create();
ellipseValue->setCenterX(pool.createValue(ellipse->centerX(), style));
ellipseValue->setCenterY(pool.createValue(ellipse->centerY(), style));
......@@ -163,6 +168,17 @@ PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicSha
basicShapeValue = ellipseValue.release();
break;
}
case BasicShape::BasicShapeEllipseType: {
const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
RefPtr<CSSBasicShapeEllipse> ellipseValue = CSSBasicShapeEllipse::create();
ellipseValue->setCenterX(valueForCenterCoordinate(pool, style, ellipse->centerX()));
ellipseValue->setCenterY(valueForCenterCoordinate(pool, style, ellipse->centerY()));
ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, pool, ellipse->radiusX()));
ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, pool, ellipse->radiusY()));
basicShapeValue = ellipseValue.release();
break;
}
case BasicShape::BasicShapePolygonType: {
const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*>(basicShape);
RefPtr<CSSBasicShapePolygon> polygonValue = CSSBasicShapePolygon::create();
......@@ -230,6 +246,26 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const RenderStyle* s
return BasicShapeCenterCoordinate(convertToLength(style, rootStyle, value));
}
static BasicShapeRadius cssValueToBasicShapeRadius(const RenderStyle* style, const RenderStyle* rootStyle, PassRefPtr<CSSPrimitiveValue> radius)
{
if (!radius)
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
if (radius->isValueID()) {
switch (radius->getValueID()) {
case CSSValueClosestSide:
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
case CSSValueFarthestSide:
return BasicShapeRadius(BasicShapeRadius::FarthestSide);
default:
ASSERT_NOT_REACHED();
break;
}
}
return BasicShapeRadius(convertToLength(style, rootStyle, radius.get()));
}
PassRefPtr<BasicShape> basicShapeForValue(const RenderStyle* style, const RenderStyle* rootStyle, const CSSBasicShape* basicShapeValue)
{
RefPtr<BasicShape> basicShape;
......@@ -279,30 +315,14 @@ PassRefPtr<BasicShape> basicShapeForValue(const RenderStyle* style, const Render
circle->setCenterX(BasicShapeCenterCoordinate(Length(50, Percent)));
circle->setCenterY(BasicShapeCenterCoordinate(Length(50, Percent)));
}
if (RefPtr<CSSPrimitiveValue> radius = circleValue->radius()) {
if (radius->isValueID()) {
switch (radius->getValueID()) {
case CSSValueClosestSide:
circle->setRadius(BasicShapeRadius(BasicShapeRadius::ClosestSide));
break;
case CSSValueFarthestSide:
circle->setRadius(BasicShapeRadius(BasicShapeRadius::FarthestSide));
break;
default:
ASSERT_NOT_REACHED();
break;
}
} else
circle->setRadius(BasicShapeRadius(convertToLength(style, rootStyle, radius.get())));
} else
circle->setRadius(BasicShapeRadius(BasicShapeRadius::ClosestSide));
circle->setRadius(cssValueToBasicShapeRadius(style, rootStyle, circleValue->radius()));
basicShape = circle.release();
break;
}
case CSSBasicShape::CSSBasicShapeEllipseType: {
const CSSBasicShapeEllipse* ellipseValue = static_cast<const CSSBasicShapeEllipse *>(basicShapeValue);
RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
case CSSBasicShape::CSSDeprecatedBasicShapeEllipseType: {
const CSSDeprecatedBasicShapeEllipse* ellipseValue = static_cast<const CSSDeprecatedBasicShapeEllipse *>(basicShapeValue);
RefPtr<DeprecatedBasicShapeEllipse> ellipse = DeprecatedBasicShapeEllipse::create();
ellipse->setCenterX(convertToLength(style, rootStyle, ellipseValue->centerX()));
ellipse->setCenterY(convertToLength(style, rootStyle, ellipseValue->centerY()));
......@@ -312,6 +332,23 @@ PassRefPtr<BasicShape> basicShapeForValue(const RenderStyle* style, const Render
basicShape = ellipse.release();
break;
}
case CSSBasicShape::CSSBasicShapeEllipseType: {
const CSSBasicShapeEllipse* ellipseValue = static_cast<const CSSBasicShapeEllipse *>(basicShapeValue);
RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
if (ellipseValue->centerX() && ellipseValue->centerY()) {
ellipse->setCenterX(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerX()));
ellipse->setCenterY(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerY()));
} else {
ellipse->setCenterX(BasicShapeCenterCoordinate(Length(50, Percent)));
ellipse->setCenterY(BasicShapeCenterCoordinate(Length(50, Percent)));
}
ellipse->setRadiusX(cssValueToBasicShapeRadius(style, rootStyle, ellipseValue->radiusX()));
ellipse->setRadiusY(cssValueToBasicShapeRadius(style, rootStyle, ellipseValue->radiusY()));
basicShape = ellipse.release();
break;
}
case CSSBasicShape::CSSBasicShapePolygonType: {
const CSSBasicShapePolygon* polygonValue = static_cast<const CSSBasicShapePolygon *>(basicShapeValue);
RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create();
......
......@@ -181,7 +181,65 @@ bool CSSDeprecatedBasicShapeCircle::equals(const CSSBasicShape& shape) const
&& compareCSSValuePtr(m_box, other.m_box);
}
static String buildEllipseString(const String& x, const String& y, const String& radiusX, const String& radiusY, const String& box)
static String buildEllipseString(const String& radiusX, const String& radiusY, const String& centerX, const String& centerY, const String& box)
{
char opening[] = "ellipse(";
char at[] = "at";
char separator[] = " ";
StringBuilder result;
result.appendLiteral(opening);
bool needsSeparator = false;
if (!radiusX.isNull()) {
result.append(radiusX);
needsSeparator = true;
}
if (!radiusY.isNull()) {
if (needsSeparator)
result.appendLiteral(separator);
result.append(radiusY);
needsSeparator = true;
}
if (!centerX.isNull() || !centerY.isNull()) {
if (needsSeparator)
result.appendLiteral(separator);
result.appendLiteral(at);
result.appendLiteral(separator);
result.append(centerX);
result.appendLiteral(separator);
result.append(centerY);
}
result.appendLiteral(")");
if (box.length()) {
result.appendLiteral(separator);
result.append(box);
}
return result.toString();
}
String CSSBasicShapeEllipse::cssText() const
{
return buildEllipseString(m_radiusX ? m_radiusX->cssText() : String(),
m_radiusY ? m_radiusY->cssText() : String(),
m_centerX ? m_centerX->cssText() : String(),
m_centerY ? m_centerY->cssText() : String(),
m_box ? m_box->cssText() : String());
}
bool CSSBasicShapeEllipse::equals(const CSSBasicShape& shape) const
{
if (shape.type() != CSSBasicShapeEllipseType)
return false;
const CSSBasicShapeEllipse& other = static_cast<const CSSBasicShapeEllipse&>(shape);
return compareCSSValuePtr(m_centerX, other.m_centerX)
&& compareCSSValuePtr(m_centerY, other.m_centerY)
&& compareCSSValuePtr(m_radiusX, other.m_radiusX)
&& compareCSSValuePtr(m_radiusY, other.m_radiusY)
&& compareCSSValuePtr(m_box, other.m_box);
}
static String buildDeprecatedEllipseString(const String& x, const String& y, const String& radiusX, const String& radiusY, const String& box)
{
StringBuilder result;
char opening[] = "ellipse(";
......@@ -202,17 +260,17 @@ static String buildEllipseString(const String& x, const String& y, const String&
return result.toString();
}
String CSSBasicShapeEllipse::cssText() const
String CSSDeprecatedBasicShapeEllipse::cssText() const
{
return buildEllipseString(m_centerX->cssText(), m_centerY->cssText(), m_radiusX->cssText(), m_radiusY->cssText(), m_box ? m_box->cssText() : String());
return buildDeprecatedEllipseString(m_centerX->cssText(), m_centerY->cssText(), m_radiusX->cssText(), m_radiusY->cssText(), m_box ? m_box->cssText() : String());
}
bool CSSBasicShapeEllipse::equals(const CSSBasicShape& shape) const
bool CSSDeprecatedBasicShapeEllipse::equals(const CSSBasicShape& shape) const
{
if (shape.type() != CSSBasicShapeEllipseType)
if (shape.type() != CSSDeprecatedBasicShapeEllipseType)
return false;
const CSSBasicShapeEllipse& other = static_cast<const CSSBasicShapeEllipse&>(shape);
const CSSDeprecatedBasicShapeEllipse& other = static_cast<const CSSDeprecatedBasicShapeEllipse&>(shape);
return compareCSSValuePtr(m_centerX, other.m_centerX)
&& compareCSSValuePtr(m_centerY, other.m_centerY)
&& compareCSSValuePtr(m_radiusX, other.m_radiusX)
......
......@@ -43,10 +43,11 @@ public:
enum Type {
CSSBasicShapeRectangleType = 1,
CSSDeprecatedBasicShapeCircleType = 2,
CSSBasicShapeEllipseType = 3,
CSSDeprecatedBasicShapeEllipseType = 3,
CSSBasicShapePolygonType = 4,
CSSBasicShapeInsetRectangleType = 5,
CSSBasicShapeCircleType = 6
CSSBasicShapeCircleType = 6,
CSSBasicShapeEllipseType = 7
};
virtual Type type() const = 0;
......@@ -178,6 +179,33 @@ private:
RefPtr<CSSPrimitiveValue> m_radius;
};
class CSSDeprecatedBasicShapeEllipse : public CSSBasicShape {
public:
static PassRefPtr<CSSDeprecatedBasicShapeEllipse> create() { return adoptRef(new CSSDeprecatedBasicShapeEllipse); }
CSSPrimitiveValue* centerX() const { return m_centerX.get(); }
CSSPrimitiveValue* centerY() const { return m_centerY.get(); }
CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); }
CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); }
void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX; }
void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY; }
void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX; }
void setRadiusY(PassRefPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY; }
virtual Type type() const OVERRIDE { return CSSDeprecatedBasicShapeEllipseType; }
virtual String cssText() const OVERRIDE;
virtual bool equals(const CSSBasicShape&) const OVERRIDE;
private:
CSSDeprecatedBasicShapeEllipse() { }
RefPtr<CSSPrimitiveValue> m_centerX;
RefPtr<CSSPrimitiveValue> m_centerY;
RefPtr<CSSPrimitiveValue> m_radiusX;
RefPtr<CSSPrimitiveValue> m_radiusY;
};
class CSSBasicShapeEllipse : public CSSBasicShape {
public: