2011-02-25 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Feb 2011 13:08:26 +0000 (13:08 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Feb 2011 13:08:26 +0000 (13:08 +0000)
commit4081a0b59118b5741442dd8f9c0a3c712f3be2a5
treec414215c1f4f25b7ff04b451ce55f63c371aceac
parenta1d7c15cd2f474ab7ba5c020b5a3cc681d7486d1
2011-02-25  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Dirk Schulze.

        Implement SVGColor/SVGPaint API
        https://bugs.webkit.org/show_bug.cgi?id=55119

        SVGColor::cssText() shouldn't return #RRGGBBAA colors
        https://bugs.webkit.org/show_bug.cgi?id=48120

        Rewrite SVGColor/SVGPaint to actually implement their desired setPaint/setColor/setURI APIs.
        SVGPaint is a CSSValue, and its setPaint() function allows to switch to an arbitary paint type.
        That means, unlike all other CSSValues, SVGColor/SVGPaint are mutable. That means changes to
        their CSSValues should be reflected in the elements style as well as in the computed style.
        This patch doesn't yet implement that, the stubbed-out method valueChanged() is what
        needs to be implemented. For now you can grab a SVGColor/SVGPaint object through getCSSPropertyValue
        and manipulate it, in every possible way (SVPaint.uri/paintType/colorType/color attributes are all sync'ed).
        Switch to strict JS bindings (RequiresAllArguments=Raise, StrictTypeChecking) for both objects.

        Enable proper serialization of colors through Color::serialized(), affects some testcases (#FF.. -> #ff..)
        Add extensive tests of all SVGColor/SVGPaint API, currently shows some FAIL messages, as element style
        <-> computed style is not live, after mutating SVGColor/SVGPaint. That will be implemented in a follow-up patch.

        Tests: svg/dom/SVGColor.html
               svg/dom/SVGPaint.html

        * bindings/scripts/CodeGenerator.pm: Remove obsolete handling of "SVGPaintType", take ushort for paintType, as specified in the SVG 1.1 IDLs.
        * bindings/scripts/CodeGeneratorJS.pm: Ditto.
        * bindings/scripts/CodeGeneratorObjC.pm: Ditto.
        * bindings/scripts/CodeGeneratorV8.pm: Ditto.
        * css/SVGCSSParser.cpp: Adapt to SVGPaint/SVGColor create() naming convention changes.
        (WebCore::CSSParser::parseSVGValue):
        (WebCore::CSSParser::parseSVGPaint):
        (WebCore::CSSParser::parseSVGColor):
        * svg/SVGColor.cpp: Rewrite to fully implement the SVGColor API, merge all constructors into one, use more descriptable create() naming convention.
        (WebCore::valueChanged): Stub implementation, will land in a follow-up patch.
        (WebCore::SVGColor::SVGColor):
        (WebCore::SVGColor::setRGBColor):
        (WebCore::SVGColor::colorFromRGBColorString):
        (WebCore::SVGColor::setRGBColorICCColor):
        (WebCore::SVGColor::setColor):
        (WebCore::SVGColor::cssText):
        * svg/SVGColor.h:
        (WebCore::SVGColor::createFromString):
        (WebCore::SVGColor::createFromColor):
        (WebCore::SVGColor::color):
        (WebCore::SVGColor::colorType):
        (WebCore::SVGColor::~SVGColor):
        (WebCore::SVGColor::setColor):
        (WebCore::SVGColor::setColorType):
        * svg/SVGColor.idl: Enable strict type checking.
        * svg/SVGPaint.cpp: Rewrite to fully implement the SVGPaint API, merge all constructors into one, use more descriptable create() naming convention.
        (WebCore::valueChanged): Stub implementation, will land in a follow-up patch.
        (WebCore::colorTypeForPaintType):
        (WebCore::SVGPaint::SVGPaint):
        (WebCore::SVGPaint::setUri):
        (WebCore::SVGPaint::defaultFill):
        (WebCore::SVGPaint::defaultStroke):
        (WebCore::SVGPaint::setPaint):
        (WebCore::SVGPaint::cssText):
        (WebCore::SVGPaint::matchesTargetURI):
        * svg/SVGPaint.h:
        (WebCore::SVGPaint::createUnknown):
        (WebCore::SVGPaint::createNone):
        (WebCore::SVGPaint::createCurrentColor):
        (WebCore::SVGPaint::createColor):
        (WebCore::SVGPaint::createURI):
        (WebCore::SVGPaint::createURIAndColor):
        (WebCore::SVGPaint::paintType):
        (WebCore::SVGPaint::uri):
        (WebCore::SVGPaint::create):
        (WebCore::SVGPaint::isSVGPaint):
        * svg/SVGPaint.idl: Enable strict type checking.

2011-02-25  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Dirk Schulze.

        Implement SVGColor/SVGPaint API
        https://bugs.webkit.org/show_bug.cgi?id=55119

        SVGColor::cssText() shouldn't return #RRGGBBAA colors
        https://bugs.webkit.org/show_bug.cgi?id=48120

        Add two new tests covering the SVGColor/SVGPaint APIs.
        Adapt to SVGColor::cssText() changes, color is properly serialized now.

        * svg/animations/animate-color-transparent-expected.txt:
        * svg/animations/animate-currentColor-expected.txt:
        * svg/animations/animate-dynamic-update-attributeName-expected.txt:
        * svg/animations/animate-inherit-css-property-expected.txt:
        * svg/animations/script-tests/animate-color-transparent.js:
        (expectTransparent):
        (expectOtherColor):
        * svg/animations/script-tests/animate-currentColor.js:
        (sample1):
        * svg/animations/script-tests/animate-inherit-css-property.js:
        (sample1):
        * svg/css/getComputedStyle-basic-expected.txt:
        * svg/custom/getPresentationAttribute-modify.svg:
        * svg/custom/rgbcolor-syntax.svg:
        * svg/dom/SVGColor-expected.txt: Added.
        * svg/dom/SVGColor.html: Added.
        * svg/dom/SVGPaint-expected.txt: Added.
        * svg/dom/SVGPaint.html: Added.
        * svg/dom/script-tests/SVGColor.js: Added.
        (checkStopColor):
        * svg/dom/script-tests/SVGPaint.js: Added.
        (resetStyle):
        (checkFillColor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/animate-color-transparent-expected.txt
LayoutTests/svg/animations/animate-currentColor-expected.txt
LayoutTests/svg/animations/animate-dynamic-update-attributeName-expected.txt
LayoutTests/svg/animations/animate-inherit-css-property-expected.txt
LayoutTests/svg/animations/script-tests/animate-color-transparent.js
LayoutTests/svg/animations/script-tests/animate-currentColor.js
LayoutTests/svg/animations/script-tests/animate-inherit-css-property.js
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/svg/custom/getPresentationAttribute-modify.svg
LayoutTests/svg/custom/rgbcolor-syntax.svg
LayoutTests/svg/dom/SVGColor-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGColor.html [new file with mode: 0644]
LayoutTests/svg/dom/SVGPaint-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGPaint.html [new file with mode: 0644]
LayoutTests/svg/dom/script-tests/SVGColor.js [new file with mode: 0644]
LayoutTests/svg/dom/script-tests/SVGPaint.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/css/SVGCSSParser.cpp
Source/WebCore/svg/SVGColor.cpp
Source/WebCore/svg/SVGColor.h
Source/WebCore/svg/SVGColor.idl
Source/WebCore/svg/SVGPaint.cpp
Source/WebCore/svg/SVGPaint.h
Source/WebCore/svg/SVGPaint.idl