Changeset 79985 in webkit


Ignore:
Timestamp:
Mar 1, 2011 2:52:51 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2011-03-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Antti Koivisto.

SVG 1.1 2nd Edition color-prop-05-t.svg exposes bug in 'currentColor' handling
https://bugs.webkit.org/show_bug.cgi?id=54800

Add new layout test from the SVG 1.1 2nd Edition test suite, covering currentColor handling.
Add tests ensuring that mutating a previously shared SVGPaint object makes it unique, so that
mutations take affect, but don't affect other renderers which shared the SVGPaint object before.

  • platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.checksum: Added.
  • platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.png: Added.
  • platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.txt: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.checksum: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.png: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.txt: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.checksum: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.png: Added.
  • platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.txt: Added.
  • svg/W3C-SVG-1.1-SE/color-prop-05-t.svg: Added.
  • svg/animations/animate-color-fill-currentColor-expected.txt: Added.
  • svg/animations/animate-color-fill-currentColor.html: Added.
  • svg/animations/script-tests/animate-color-fill-currentColor.js: Added.
  • svg/custom/SVGPaint-mutate-attribute.svg: Added.
  • svg/custom/SVGPaint-mutate-inline-style.svg: Added.
  • svg/dom/SVGColor-expected.txt: SVGColor mutations now reflected in style/computed style.
  • svg/dom/SVGPaint-expected.txt: Same for SVGPaint.

2011-03-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Antti Koivisto.

SVG 1.1 2nd Edition color-prop-05-t.svg exposes bug in 'currentColor' handling
https://bugs.webkit.org/show_bug.cgi?id=54800

Wrong handling of currentColor on inherit
https://bugs.webkit.org/show_bug.cgi?id=38102

Stop storing RefPtr<SVGPaint> objects in the SVGRenderStyle for fill/stroke. These are the last
two objects that held references to CSSValues, they're all gone now, aligning better with RenderStyle.
It's also dangerous, as a SVGPaint object can be shared by multiple SVGRenderStyles (MappedAttribute will
once create a CSSStyleDeclaration for fill="red" and reuse it where possible), and it was easy to
accidently mutate the object, affecting multiple styles. Instead store a Color, an URI and a paint
type in SVGRenderStyle, enough to create a SVGPaint object, if needed (eg for computed styles).

<g color="green"><rect fill="currentColor"/> already worked fine in trunk, but
<g fill="currentColor" color="green"><rect color="red"/> procuded a red rectangle.

In order to fix to bug we have to resolve all currentColor values for SVGPaint objects, in SVGCSSStyleSelector,
as it's already done for SVGColor objects (stop-color, flood-color, etc.) instead of in RenderSVGResource::fill/strokePaintingResource,
when trying to use the paint server. The correct "color" value that should be used from the RenderStyle, is directly
available in CSSStyleSelector: in applyProperty m_style->color() gives the desired value. In CSSStyleSelector it's handled
exactly this way for non-SVG currentColor properties. Also fix computed styles, which did not resolve currentColor for SVGPaint/SVGColor.

A previous patch implemented the SVGPaint/SVGColor API. SVG demands these CSSValues to be mutable. Introduce
CSSMutableValue, which extends CSSValue by a Node pointer, and let SVGPaint/SVGColor inherit from it.
Mutating a SVGPaint/SVGColor object now takes immediate effect, which is reflected in the inline style / computed style.
(Note that getPresentationAttribute() already takes care of removing the CSSValue from the mapped attribute cache, so that it's no longer shared.)

Add several new tests covering the patch.

Tests: svg/W3C-SVG-1.1-SE/color-prop-05-t.svg

svg/animations/animate-color-fill-currentColor.html
svg/custom/SVGPaint-mutate-attribute.svg
svg/custom/SVGPaint-mutate-inline-style.svg

  • GNUMakefile.am: Add CSSMutableValue.h
  • WebCore.gypi: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • css/CSSMutableStyleDeclaration.cpp: Reset the Node pointer in all CSSMutableValues belonging to this style declaration. (WebCore::CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration):
  • css/CSSMutableStyleDeclaration.h: Add destructor.
  • css/CSSMutableValue.h: Added. (WebCore::CSSMutableValue::CSSMutableValue): (WebCore::CSSMutableValue::~CSSMutableValue): (WebCore::CSSMutableValue::isMutableValue): (WebCore::CSSMutableValue::node): (WebCore::CSSMutableValue::setNode): (WebCore::CSSMutableValue::setNeedsStyleRecalc):
  • css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::getPropertyCSSValue): Set the Node object of a CSSMutableValue to the Node, this style declaration belongs to.
  • css/CSSValue.h: (WebCore::CSSValue::isMutableValue): Return false, default.
  • css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor): Add helper function, resolving currentColor values for SVGPaint objects. (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): Use currentColorOrValidColor/adjustSVGPaintForCurrentColor to resolve SVGColor/SVGPaint values.
  • css/SVGCSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applySVGProperty): Store fill/stroke uri, color, paint type seperated in SVGRenderStyle, don't store the full SVGPaint object anymore.
  • rendering/style/SVGRenderStyle.cpp: (WebCore::SVGRenderStyle::diff): Adapt to SVGPaint changes.
  • rendering/style/SVGRenderStyle.h: Ditto. (WebCore::SVGRenderStyle::initialFillOpacity): (WebCore::SVGRenderStyle::initialFillPaintType): (WebCore::SVGRenderStyle::initialFillPaintColor): (WebCore::SVGRenderStyle::initialFillPaintUri): (WebCore::SVGRenderStyle::initialStrokeOpacity): (WebCore::SVGRenderStyle::initialStrokePaintType): (WebCore::SVGRenderStyle::initialStrokePaintColor): (WebCore::SVGRenderStyle::initialStrokePaintUri): (WebCore::SVGRenderStyle::initialStrokeMiterLimit): (WebCore::SVGRenderStyle::initialStopOpacity): (WebCore::SVGRenderStyle::initialFloodOpacity): (WebCore::SVGRenderStyle::setFillPaint): (WebCore::SVGRenderStyle::setStrokePaint): (WebCore::SVGRenderStyle::fillPaintType): (WebCore::SVGRenderStyle::fillPaintColor): (WebCore::SVGRenderStyle::fillPaintUri): (WebCore::SVGRenderStyle::strokePaintType): (WebCore::SVGRenderStyle::strokePaintColor): (WebCore::SVGRenderStyle::strokePaintUri): (WebCore::SVGRenderStyle::hasStroke): (WebCore::SVGRenderStyle::hasFill):
  • rendering/style/SVGRenderStyleDefs.cpp: Ditto. (WebCore::StyleFillData::StyleFillData): (WebCore::StyleFillData::operator==): (WebCore::StyleStrokeData::StyleStrokeData): (WebCore::StyleStrokeData::operator==):
  • rendering/style/SVGRenderStyleDefs.h: Ditto.
  • rendering/svg/RenderSVGResource.cpp: Ditto. (WebCore::requestPaintingResource):
  • rendering/svg/RenderSVGResourceClipper.cpp: Ditto. (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
  • rendering/svg/SVGResources.cpp: Ditto. (WebCore::paintingResourceFromSVGPaint): (WebCore::SVGResources::buildCachedResources):
  • svg/SVGColor.cpp: Call setNeedsStyleRecalc() after mutating the object. (WebCore::SVGColor::setRGBColor): (WebCore::SVGColor::setRGBColorICCColor): (WebCore::SVGColor::setColor):
  • svg/SVGColor.h:
  • svg/SVGPaint.cpp: Ditto. (WebCore::SVGPaint::setUri): (WebCore::SVGPaint::setPaint):
  • svg/SVGPaint.h:
Location:
trunk
Files:
16 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r79980 r79985  
     12011-03-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        SVG 1.1 2nd Edition color-prop-05-t.svg exposes bug in 'currentColor' handling
     6        https://bugs.webkit.org/show_bug.cgi?id=54800
     7
     8        Add new layout test from the SVG 1.1 2nd Edition test suite, covering currentColor handling.
     9        Add tests ensuring that mutating a previously shared SVGPaint object makes it unique, so that
     10        mutations take affect, but don't affect other renderers which shared the SVGPaint object before.
     11
     12        * platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.checksum: Added.
     13        * platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.png: Added.
     14        * platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.txt: Added.
     15        * platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.checksum: Added.
     16        * platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.png: Added.
     17        * platform/mac/svg/custom/SVGPaint-mutate-attribute-expected.txt: Added.
     18        * platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.checksum: Added.
     19        * platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.png: Added.
     20        * platform/mac/svg/custom/SVGPaint-mutate-inline-style-expected.txt: Added.
     21        * svg/W3C-SVG-1.1-SE/color-prop-05-t.svg: Added.
     22        * svg/animations/animate-color-fill-currentColor-expected.txt: Added.
     23        * svg/animations/animate-color-fill-currentColor.html: Added.
     24        * svg/animations/script-tests/animate-color-fill-currentColor.js: Added.
     25        * svg/custom/SVGPaint-mutate-attribute.svg: Added.
     26        * svg/custom/SVGPaint-mutate-inline-style.svg: Added.
     27        * svg/dom/SVGColor-expected.txt: SVGColor mutations now reflected in style/computed style.
     28        * svg/dom/SVGPaint-expected.txt: Same for SVGPaint.
     29
    1302011-03-01  Pavel Feldman  <pfeldman@chromium.org>
    231
     
    408437        https://bugs.webkit.org/show_bug.cgi?id=55121
    409438
    410         [chromium] Recently, French Academy changed the sorting
    411         rules for French in such a way that accents are not weighted
    412         from the end of a word any more. ICU 4.6 / CLDR 1.9
    413         incorporated the change. Canadian French hasn't adopted the
    414         change, yet.
     439        [chromium] Recently, French Academy changed the sorting
     440        rules for French in such a way that accents are not weighted
     441        from the end of a word any more. ICU 4.6 / CLDR 1.9
     442        incorporated the change. Canadian French hasn't adopted the
     443        change, yet.
    415444
    416445        Chrome is the only port that uses new rules with ICU 4.6. So,
  • trunk/LayoutTests/svg/dom/SVGColor-expected.txt

    r79675 r79985  
    4444PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 77
    4545PASS stopElement.style.stopColor is "#4d004d"
    46 FAIL document.defaultView.getComputedStyle(stopElement).stopColor should be rgb(77, 0, 77). Was rgb(255, 0, 0).
     46PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(77, 0, 77)"
    4747
    4848Test using setColor() and SVG_COLORTYPE_CURRENTCOLOR
     
    5555PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
    5656PASS stopElement.style.stopColor is "currentColor"
    57 FAIL document.defaultView.getComputedStyle(stopElement).stopColor should be rgb(0, 128, 0). Was rgb(255, 0, 0).
     57PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(0, 128, 0)"
    5858
    5959Test using setColor() and SVG_COLORTYPE_RGBCOLOR
     
    6565PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 77
    6666PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
    67 FAIL document.defaultView.getComputedStyle(stopElement).stopColor should be rgb(0, 77, 0). Was rgb(255, 0, 0).
     67PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(0, 77, 0)"
    6868PASS successfullyParsed is true
    6969
  • trunk/LayoutTests/svg/dom/SVGPaint-expected.txt

    r79675 r79985  
    166166PASS fillColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
    167167PASS rectElement.style.fill is "url(#foo) currentColor"
    168 FAIL document.defaultView.getComputedStyle(rectElement).fill should be url(#foo) #00ff00. Was url(#foo) currentColor.
     168PASS document.defaultView.getComputedStyle(rectElement).fill is "url(#foo) #00ff00"
    169169
    170170Test using setPaint() and SVG_PAINTTYPE_URI_RGBCOLOR
     
    214214PASS fillColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
    215215PASS rectElement.style.fill is "currentColor"
    216 FAIL document.defaultView.getComputedStyle(rectElement).fill should be #00ff00. Was currentColor.
     216PASS document.defaultView.getComputedStyle(rectElement).fill is "#00ff00"
    217217
    218218Test using setPaint() and SVG_PAINTTYPE_RGBCOLOR
  • trunk/Source/WebCore/ChangeLog

    r79984 r79985  
     12011-03-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        SVG 1.1 2nd Edition color-prop-05-t.svg exposes bug in 'currentColor' handling
     6        https://bugs.webkit.org/show_bug.cgi?id=54800
     7
     8        Wrong handling of currentColor on inherit
     9        https://bugs.webkit.org/show_bug.cgi?id=38102
     10
     11        Stop storing RefPtr<SVGPaint> objects in the SVGRenderStyle for fill/stroke. These are the last
     12        two objects that held references to CSSValues, they're all gone now, aligning better with RenderStyle.
     13        It's also dangerous, as a SVGPaint object can be shared by multiple SVGRenderStyles (MappedAttribute will
     14        once create a CSSStyleDeclaration for fill="red" and reuse it where possible), and it was easy to
     15        accidently mutate the object, affecting multiple styles. Instead store a Color, an URI and a paint
     16        type in SVGRenderStyle, enough to create a SVGPaint object, if needed (eg for computed styles).
     17
     18        <g color="green"><rect fill="currentColor"/> already worked fine in trunk, but
     19        <g fill="currentColor" color="green"><rect color="red"/> procuded a red rectangle.
     20
     21        In order to fix to bug we have to resolve all currentColor values for SVGPaint objects, in SVGCSSStyleSelector,
     22        as it's already done for SVGColor objects (stop-color, flood-color, etc.) instead of in RenderSVGResource::fill/strokePaintingResource,
     23        when trying to use the paint server. The correct "color" value that should be used from the RenderStyle, is directly
     24        available in CSSStyleSelector: in applyProperty m_style->color() gives the desired value. In CSSStyleSelector it's handled
     25        exactly this way for non-SVG currentColor properties. Also fix computed styles, which did not resolve currentColor for SVGPaint/SVGColor.
     26
     27        A previous patch implemented the SVGPaint/SVGColor API. SVG demands these CSSValues to be mutable. Introduce
     28        CSSMutableValue, which extends CSSValue by a Node pointer, and let SVGPaint/SVGColor inherit from it.
     29        Mutating a SVGPaint/SVGColor object now takes immediate effect, which is reflected in the inline style / computed style.
     30        (Note that getPresentationAttribute() already takes care of removing the CSSValue from the mapped attribute cache, so that it's no longer shared.)
     31
     32        Add several new tests covering the patch.
     33
     34        Tests: svg/W3C-SVG-1.1-SE/color-prop-05-t.svg
     35               svg/animations/animate-color-fill-currentColor.html
     36               svg/custom/SVGPaint-mutate-attribute.svg
     37               svg/custom/SVGPaint-mutate-inline-style.svg
     38
     39        * GNUMakefile.am: Add CSSMutableValue.h
     40        * WebCore.gypi: Ditto.
     41        * WebCore.xcodeproj/project.pbxproj: Ditto.
     42        * css/CSSMutableStyleDeclaration.cpp: Reset the Node pointer in all CSSMutableValues belonging to this style declaration.
     43        (WebCore::CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration):
     44        * css/CSSMutableStyleDeclaration.h: Add destructor.
     45        * css/CSSMutableValue.h: Added.
     46        (WebCore::CSSMutableValue::CSSMutableValue):
     47        (WebCore::CSSMutableValue::~CSSMutableValue):
     48        (WebCore::CSSMutableValue::isMutableValue):
     49        (WebCore::CSSMutableValue::node):
     50        (WebCore::CSSMutableValue::setNode):
     51        (WebCore::CSSMutableValue::setNeedsStyleRecalc):
     52        * css/CSSStyleDeclaration.cpp:
     53        (WebCore::CSSStyleDeclaration::getPropertyCSSValue): Set the Node object of a CSSMutableValue to the Node, this style declaration belongs to.
     54        * css/CSSValue.h:
     55        (WebCore::CSSValue::isMutableValue): Return false, default.
     56        * css/SVGCSSComputedStyleDeclaration.cpp:
     57        (WebCore::CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor): Add helper function, resolving currentColor values for SVGPaint objects.
     58        (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): Use currentColorOrValidColor/adjustSVGPaintForCurrentColor to resolve SVGColor/SVGPaint values.
     59        * css/SVGCSSStyleSelector.cpp:
     60        (WebCore::CSSStyleSelector::applySVGProperty): Store fill/stroke uri, color, paint type seperated in SVGRenderStyle, don't store the full SVGPaint object anymore.
     61        * rendering/style/SVGRenderStyle.cpp:
     62        (WebCore::SVGRenderStyle::diff): Adapt to SVGPaint changes.
     63        * rendering/style/SVGRenderStyle.h: Ditto.
     64        (WebCore::SVGRenderStyle::initialFillOpacity):
     65        (WebCore::SVGRenderStyle::initialFillPaintType):
     66        (WebCore::SVGRenderStyle::initialFillPaintColor):
     67        (WebCore::SVGRenderStyle::initialFillPaintUri):
     68        (WebCore::SVGRenderStyle::initialStrokeOpacity):
     69        (WebCore::SVGRenderStyle::initialStrokePaintType):
     70        (WebCore::SVGRenderStyle::initialStrokePaintColor):
     71        (WebCore::SVGRenderStyle::initialStrokePaintUri):
     72        (WebCore::SVGRenderStyle::initialStrokeMiterLimit):
     73        (WebCore::SVGRenderStyle::initialStopOpacity):
     74        (WebCore::SVGRenderStyle::initialFloodOpacity):
     75        (WebCore::SVGRenderStyle::setFillPaint):
     76        (WebCore::SVGRenderStyle::setStrokePaint):
     77        (WebCore::SVGRenderStyle::fillPaintType):
     78        (WebCore::SVGRenderStyle::fillPaintColor):
     79        (WebCore::SVGRenderStyle::fillPaintUri):
     80        (WebCore::SVGRenderStyle::strokePaintType):
     81        (WebCore::SVGRenderStyle::strokePaintColor):
     82        (WebCore::SVGRenderStyle::strokePaintUri):
     83        (WebCore::SVGRenderStyle::hasStroke):
     84        (WebCore::SVGRenderStyle::hasFill):
     85        * rendering/style/SVGRenderStyleDefs.cpp: Ditto.
     86        (WebCore::StyleFillData::StyleFillData):
     87        (WebCore::StyleFillData::operator==):
     88        (WebCore::StyleStrokeData::StyleStrokeData):
     89        (WebCore::StyleStrokeData::operator==):
     90        * rendering/style/SVGRenderStyleDefs.h: Ditto.
     91        * rendering/svg/RenderSVGResource.cpp: Ditto.
     92        (WebCore::requestPaintingResource):
     93        * rendering/svg/RenderSVGResourceClipper.cpp: Ditto.
     94        (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
     95        * rendering/svg/SVGResources.cpp: Ditto.
     96        (WebCore::paintingResourceFromSVGPaint):
     97        (WebCore::SVGResources::buildCachedResources):
     98        * svg/SVGColor.cpp: Call setNeedsStyleRecalc() after mutating the object.
     99        (WebCore::SVGColor::setRGBColor):
     100        (WebCore::SVGColor::setRGBColorICCColor):
     101        (WebCore::SVGColor::setColor):
     102        * svg/SVGColor.h:
     103        * svg/SVGPaint.cpp: Ditto.
     104        (WebCore::SVGPaint::setUri):
     105        (WebCore::SVGPaint::setPaint):
     106        * svg/SVGPaint.h:
     107
    11082011-03-01  Andrey Adaikin  <aandrey@google.com>
    2109
  • trunk/Source/WebCore/GNUmakefile.am

    r79983 r79985  
    10041004        Source/WebCore/css/CSSMutableStyleDeclaration.cpp \
    10051005        Source/WebCore/css/CSSMutableStyleDeclaration.h \
     1006        Source/WebCore/css/CSSMutableValue.h \
    10061007        Source/WebCore/css/CSSNamespace.h \
    10071008        Source/WebCore/css/CSSOMUtils.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r79978 r79985  
    10451045            'css/CSSMutableStyleDeclaration.cpp',
    10461046            'css/CSSMutableStyleDeclaration.h',
     1047            'css/CSSMutableValue.h',
    10471048            'css/CSSNamespace.h',
    10481049            'css/CSSOMUtils.cpp',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r79978 r79985  
    186186                0897D97B0F007A4600411BB3 /* WMLMetaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 0897D9790F007A4600411BB3 /* WMLMetaElement.h */; };
    187187                089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */; };
     188                089F0D511316CE93005877AD /* CSSMutableValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 089F0D501316CE93005877AD /* CSSMutableValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    188189                08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A484750E5272C500C3FE76 /* ScriptElement.cpp */; };
    189190                08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; };
     
    64736474                0897D9790F007A4600411BB3 /* WMLMetaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLMetaElement.h; sourceTree = "<group>"; };
    64746475                089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPathSegListPropertyTearOff.h; sourceTree = "<group>"; };
     6476                089F0D501316CE93005877AD /* CSSMutableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSMutableValue.h; sourceTree = "<group>"; };
    64756477                08A484750E5272C500C3FE76 /* ScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptElement.cpp; sourceTree = "<group>"; };
    64766478                08A484760E5272C500C3FE76 /* ScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptElement.h; sourceTree = "<group>"; };
     
    1856518567                                A80E6DF90A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp */,
    1856618568                                A80E6DFA0A199067007FB8C5 /* CSSMutableStyleDeclaration.h */,
     18569                                089F0D501316CE93005877AD /* CSSMutableValue.h */,
    1856718570                                A80E73470A199C77007FB8C5 /* CSSNamespace.h */,
    1856818571                                F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */,
     
    2248322486                                E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
    2248422487                                977E2E0F12F0FC9C00C13379 /* XSSFilter.h in Headers */,
     22488                                089F0D511316CE93005877AD /* CSSMutableValue.h in Headers */,
    2248522489                        );
    2248622490                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h

    r67568 r79985  
    2323
    2424#include "CSSStyleDeclaration.h"
    25 #include "PlatformString.h"
    2625#include "RenderStyleConstants.h"
    2726#include <wtf/RefPtr.h>
     27#include <wtf/text/WTFString.h>
    2828
    2929namespace WebCore {
     
    3535class RenderStyle;
    3636class ShadowData;
     37class SVGPaint;
    3738
    3839enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
     
    7778    PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const;
    7879    PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
    79    
     80#if ENABLE(SVG)
     81    PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
     82#endif
     83
    8084    RefPtr<Node> m_node;
    8185    PseudoId m_pseudoElementSpecifier;
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp

    r79009 r79985  
    2323
    2424#include "CSSImageValue.h"
     25#include "CSSMutableValue.h"
    2526#include "CSSParser.h"
    2627#include "CSSPropertyLonghand.h"
     
    9293}
    9394
     95CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration()
     96{
     97    const CSSMutableStyleDeclarationConstIterator end = this->end();
     98    for (CSSMutableStyleDeclarationConstIterator it = begin(); it != end; ++it) {
     99        CSSValue* value = it->value();
     100        if (!value || !value->isMutableValue())
     101            continue;
     102        static_cast<CSSMutableValue*>(value)->setNode(0);
     103    }
     104}
     105 
    94106CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other)
    95107{
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h

    r76012 r79985  
    5858class CSSMutableStyleDeclaration : public CSSStyleDeclaration {
    5959public:
     60    virtual ~CSSMutableStyleDeclaration();
     61
    6062    static PassRefPtr<CSSMutableStyleDeclaration> create()
    6163    {
  • trunk/Source/WebCore/css/CSSStyleDeclaration.cpp

    r72116 r79985  
    2323
    2424#include "CSSMutableStyleDeclaration.h"
     25#include "CSSMutableValue.h"
    2526#include "CSSParser.h"
    2627#include "CSSProperty.h"
    2728#include "CSSPropertyNames.h"
    2829#include "CSSRule.h"
     30#include "Node.h"
     31#include "SVGElement.h"
    2932#include <wtf/ASCIICType.h>
    3033
     
    4346    if (!propID)
    4447        return 0;
    45     return getPropertyCSSValue(propID);
     48
     49    // Short-cut, not involving any change to the refcount.
     50    if (!isMutableStyleDeclaration())
     51        return getPropertyCSSValue(propID);
     52
     53    // Slow path.
     54    RefPtr<CSSValue> value = getPropertyCSSValue(propID);
     55    if (!value || !value->isMutableValue())
     56        return value.release();
     57
     58    Node* node = static_cast<CSSMutableStyleDeclaration*>(this)->node();
     59    if (!node || !node->isStyledElement())
     60        return value.release();
     61
     62    Node* associatedNode = static_cast<CSSMutableValue*>(value.get())->node();
     63    if (associatedNode) {
     64        ASSERT(associatedNode == node);
     65        return value.release();
     66    }
     67
     68    static_cast<CSSMutableValue*>(value.get())->setNode(node);
     69    return value.release();
    4670}
    4771
  • trunk/Source/WebCore/css/CSSValue.h

    r76966 r79985  
    5151    void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented.
    5252
     53    virtual bool isMutableValue() const { return false; }
     54
    5355    virtual bool isBorderImageValue() const { return false; }
    5456    virtual bool isCursorImageValue() const { return false; }
  • trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp

    r67568 r79985  
    2828#include "Document.h"
    2929#include "RenderStyle.h"
     30#include "SVGPaint.h"
    3031
    3132namespace WebCore {
     
    5859
    5960    return list.release();
     61}
     62
     63PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const
     64{
     65    RefPtr<SVGPaint> paint = newPaint;
     66    if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
     67        paint->setColor(style->color());
     68    return paint.release();
    6069}
    6170
     
    128137            return CSSPrimitiveValue::createIdentifier(CSSValueNone);
    129138        case CSSPropertyFloodColor:
    130             return CSSPrimitiveValue::createColor(svgStyle->floodColor().rgb());
     139            return currentColorOrValidColor(style, svgStyle->floodColor());
    131140        case CSSPropertyLightingColor:
    132             return CSSPrimitiveValue::createColor(svgStyle->lightingColor().rgb());
     141            return currentColorOrValidColor(style, svgStyle->lightingColor());
    133142        case CSSPropertyStopColor:
    134             return CSSPrimitiveValue::createColor(svgStyle->stopColor().rgb());
     143            return currentColorOrValidColor(style, svgStyle->stopColor());
    135144        case CSSPropertyFill:
    136             return svgStyle->fillPaint();
     145            return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fillPaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), style);
    137146        case CSSPropertyKerning:
    138147            return SVGLength::toCSSPrimitiveValue(svgStyle->kerning());
     
    150159            return CSSPrimitiveValue::createIdentifier(CSSValueNone);
    151160        case CSSPropertyStroke:
    152             return svgStyle->strokePaint();
     161            return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->strokePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), style);
    153162        case CSSPropertyStrokeDasharray:
    154163            return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray());
  • trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp

    r74538 r79985  
    232232        case CSSPropertyFill:
    233233        {
    234             HANDLE_INHERIT_AND_INITIAL(fillPaint, FillPaint)
    235             if (value->isSVGPaint())
    236                 svgstyle->setFillPaint(static_cast<SVGPaint*>(value));
     234            if (isInherit) {
     235                const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
     236                svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri());
     237                return;
     238            }
     239            if (isInitial) {
     240                svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri());
     241                return;
     242            }
     243            if (value->isSVGPaint()) {
     244                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
     245                svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
     246            }
    237247            break;
    238248        }
    239249        case CSSPropertyStroke:
    240250        {
    241             HANDLE_INHERIT_AND_INITIAL(strokePaint, StrokePaint)
    242             if (value->isSVGPaint())
    243                 svgstyle->setStrokePaint(static_cast<SVGPaint*>(value));
    244            
     251            if (isInherit) {
     252                const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
     253                svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri());
     254                return;
     255            }
     256            if (isInitial) {
     257                svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri());
     258                return;
     259            }
     260            if (value->isSVGPaint()) {
     261                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
     262                svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
     263            }
    245264            break;
    246265        }
  • trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp

    r69279 r79985  
    170170    if (stroke != other->stroke) {
    171171        if (stroke->width != other->stroke->width
    172             || stroke->paint != other->stroke->paint
     172            || stroke->paintType != other->stroke->paintType
     173            || stroke->paintColor != other->stroke->paintColor
     174            || stroke->paintUri != other->stroke->paintUri
    173175            || stroke->miterLimit != other->stroke->miterLimit
    174176            || stroke->dashArray != other->stroke->dashArray
     
    192194
    193195    // If fill changes, we just need to repaint. Fill boundaries are not influenced by this, only by the Path, that RenderSVGPath contains.
    194     if (fill != other->fill)
     196    if (fill->paintType != other->fill->paintType || fill->paintColor != other->fill->paintColor || fill->paintUri != other->fill->paintUri)
    195197        return StyleDifferenceRepaint;
    196198
  • trunk/Source/WebCore/rendering/style/SVGRenderStyle.h

    r71014 r79985  
    7171    static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DEG; }
    7272    static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO; }
    73     static float initialFillOpacity() { return 1.0f; }
    74     static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); }
    75     static float initialStrokeOpacity() { return 1.0f; }
    76     static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); }
     73    static float initialFillOpacity() { return 1; }
     74    static SVGPaint::SVGPaintType initialFillPaintType() { return SVGPaint::SVG_PAINTTYPE_RGBCOLOR; }
     75    static Color initialFillPaintColor() { return Color::black; }
     76    static String initialFillPaintUri() { return String(); }
     77    static float initialStrokeOpacity() { return 1; }
     78    static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SVG_PAINTTYPE_NONE; }
     79    static Color initialStrokePaintColor() { return Color(); }
     80    static String initialStrokePaintUri() { return String(); }
    7781    static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); }
    78     static float initialStrokeMiterLimit() { return 4.0f; }
    79     static float initialStopOpacity() { return 1.0f; }
     82    static float initialStrokeMiterLimit() { return 4; }
     83    static float initialStopOpacity() { return 1; }
    8084    static Color initialStopColor() { return Color(0, 0, 0); }
    81     static float initialFloodOpacity() { return 1.0f; }
     85    static float initialFloodOpacity() { return 1; }
    8286    static Color initialFloodColor() { return Color(0, 0, 0); }
    8387    static Color initialLightingColor() { return Color(255, 255, 255); }
     
    151155    }
    152156
    153     void setFillPaint(PassRefPtr<SVGPaint> obj)
    154     {
    155         if (!(fill->paint == obj))
    156             fill.access()->paint = obj;
     157    void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
     158    {
     159        if (!(fill->paintType == type))
     160            fill.access()->paintType = type;
     161        if (!(fill->paintColor == color))
     162            fill.access()->paintColor = color;
     163        if (!(fill->paintUri == uri))
     164            fill.access()->paintUri = uri;
    157165    }
    158166
     
    163171    }
    164172
    165     void setStrokePaint(PassRefPtr<SVGPaint> obj)
    166     {
    167         if (!(stroke->paint == obj))
    168             stroke.access()->paint = obj;
     173    void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
     174    {
     175        if (!(stroke->paintType == type))
     176            stroke.access()->paintType = type;
     177        if (!(stroke->paintColor == color))
     178            stroke.access()->paintColor = color;
     179        if (!(stroke->paintUri == uri))
     180            stroke.access()->paintUri = uri;
    169181    }
    170182
     
    294306    EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientation) svg_inherited_flags._glyphOrientationVertical; }
    295307    float fillOpacity() const { return fill->opacity; }
    296     SVGPaint* fillPaint() const { return fill->paint.get(); }
     308    const SVGPaint::SVGPaintType& fillPaintType() const { return fill->paintType; }
     309    const Color& fillPaintColor() const { return fill->paintColor; }
     310    const String& fillPaintUri() const { return fill->paintUri; }   
    297311    float strokeOpacity() const { return stroke->opacity; }
    298     SVGPaint* strokePaint() const { return stroke->paint.get(); }
     312    const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paintType; }
     313    const Color& strokePaintColor() const { return stroke->paintColor; }
     314    const String& strokePaintUri() const { return stroke->paintUri; }
    299315    Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
    300316    float strokeMiterLimit() const { return stroke->miterLimit; }
     
    321337    bool hasFilter() const { return !filterResource().isEmpty(); }
    322338    bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); }
    323     bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
    324     bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
     339    bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
     340    bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
    325341    bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writingMode() == WM_TB; }
    326342
  • trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp

    r64830 r79985  
    3838StyleFillData::StyleFillData()
    3939    : opacity(SVGRenderStyle::initialFillOpacity())
    40     , paint(SVGRenderStyle::initialFillPaint())
     40    , paintType(SVGRenderStyle::initialFillPaintType())
     41    , paintColor(SVGRenderStyle::initialFillPaintColor())
     42    , paintUri(SVGRenderStyle::initialFillPaintUri())
    4143{
    4244}
     
    4547    : RefCounted<StyleFillData>()
    4648    , opacity(other.opacity)
    47     , paint(other.paint)
     49    , paintType(other.paintType)
     50    , paintColor(other.paintColor)
     51    , paintUri(other.paintUri)
    4852{
    4953}
     
    5155bool StyleFillData::operator==(const StyleFillData& other) const
    5256{
    53     if (opacity != other.opacity)
    54         return false;
    55 
    56     if (!paint || !other.paint)
    57         return paint == other.paint;
    58 
    59     if (paint->paintType() != other.paint->paintType())
    60         return false;
    61 
    62     if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_URI)
    63         return paint->uri() == other.paint->uri();
    64 
    65     if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
    66         return paint->color() == other.paint->color();
    67 
    68     return paint == other.paint;
     57    return opacity == other.opacity
     58        && paintType == other.paintType
     59        && paintColor == other.paintColor
     60        && paintUri == other.paintUri;
    6961}
    7062
     
    7567    , dashOffset(SVGRenderStyle::initialStrokeDashOffset())
    7668    , dashArray(SVGRenderStyle::initialStrokeDashArray())
    77     , paint(SVGRenderStyle::initialStrokePaint())
     69    , paintType(SVGRenderStyle::initialStrokePaintType())
     70    , paintColor(SVGRenderStyle::initialStrokePaintColor())
     71    , paintUri(SVGRenderStyle::initialStrokePaintUri())
    7872{
    7973}
     
    8680    , dashOffset(other.dashOffset)
    8781    , dashArray(other.dashArray)
    88     , paint(other.paint)
     82    , paintType(other.paintType)
     83    , paintColor(other.paintColor)
     84    , paintUri(other.paintUri)
    8985{
    9086}
     
    9288bool StyleStrokeData::operator==(const StyleStrokeData& other) const
    9389{
    94     return paint == other.paint
    95         && width == other.width
     90    return width == other.width
    9691        && opacity == other.opacity
    9792        && miterLimit == other.miterLimit
    9893        && dashOffset == other.dashOffset
    99         && dashArray == other.dashArray;
     94        && dashArray == other.dashArray
     95        && paintType == other.paintType
     96        && paintColor == other.paintColor
     97        && paintUri == other.paintUri;
    10098}
    10199
  • trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h

    r69220 r79985  
    3030
    3131#if ENABLE(SVG)
    32 #include "Color.h"
    33 #include "PlatformString.h"
    3432#include "SVGLength.h"
     33#include "SVGPaint.h"
    3534#include "ShadowData.h"
    3635#include <wtf/OwnPtr.h>
     
    9998        static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
    10099        PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
    101        
     100
    102101        bool operator==(const StyleFillData&) const;
    103102        bool operator!=(const StyleFillData& other) const
     
    107106
    108107        float opacity;
    109         RefPtr<SVGPaint> paint;
     108        SVGPaint::SVGPaintType paintType;
     109        Color paintColor;
     110        String paintUri;
    110111
    111112    private:
     
    132133        Vector<SVGLength> dashArray;
    133134
    134         RefPtr<SVGPaint> paint;
     135        SVGPaint::SVGPaintType paintType;
     136        Color paintColor;
     137        String paintUri;
    135138
    136139    private:       
     
    263266
    264267#endif // ENABLE(SVG)
    265 
    266268#endif // SVGRenderStyleDefs_h
  • trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp

    r75350 r79985  
    5252    }
    5353
    54     SVGPaint* paint = mode == ApplyToFillMode ? svgStyle->fillPaint() : svgStyle->strokePaint();
    55     ASSERT(paint);
    56 
    57     SVGPaint::SVGPaintType paintType = paint->paintType();
     54    bool applyToFill = mode == ApplyToFillMode;
     55    SVGPaint::SVGPaintType paintType = applyToFill ? svgStyle->fillPaintType() : svgStyle->strokePaintType();
    5856    if (paintType == SVGPaint::SVG_PAINTTYPE_NONE)
    5957        return 0;
    6058
    6159    Color color;
    62     if (paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR
    63         || paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR
    64         || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR
    65         || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR)
    66         color = paint->color();
    67     else if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paintType == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
    68         color = style->visitedDependentColor(CSSPropertyColor);
     60    switch (paintType) {
     61    case SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR:
     62    case SVGPaint::SVG_PAINTTYPE_RGBCOLOR:
     63    case SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR:
     64    case SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR:
     65    case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR:
     66    case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR:
     67        color = applyToFill ? svgStyle->fillPaintColor() : svgStyle->strokePaintColor();
     68    default:
     69        break;
     70    }
    6971
    7072    if (style->insideLink() == InsideVisitedLink) {
     
    7274        ASSERT(visitedStyle);
    7375
    74         if (SVGPaint* visitedPaint = mode == ApplyToFillMode ? visitedStyle->svgStyle()->fillPaint() : visitedStyle->svgStyle()->strokePaint()) {
    75             // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
    76             if (visitedPaint->paintType() < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaint->paintType() != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
    77                 const Color& visitedColor = visitedPaint->color();
    78                 if (visitedColor.isValid())
    79                     color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
    80             }
     76        const SVGRenderStyle* svgVisitedStyle = visitedStyle->svgStyle();
     77        SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgVisitedStyle->fillPaintType() : svgVisitedStyle->strokePaintType();
     78
     79        // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
     80        if (visitedPaintType < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
     81            const Color& visitedColor = applyToFill ? svgVisitedStyle->fillPaintColor() : svgVisitedStyle->strokePaintColor();
     82            if (visitedColor.isValid())
     83                color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
    8184        }
    8285    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp

    r75350 r79985  
    255255        RefPtr<RenderStyle> newRenderStyle = RenderStyle::clone(oldRenderStyle.get());
    256256        SVGRenderStyle* svgStyle = newRenderStyle.get()->accessSVGStyle();
    257         svgStyle->setFillPaint(SVGPaint::defaultFill());
    258         svgStyle->setStrokePaint(SVGPaint::defaultStroke());
     257        svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri());
     258        svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri());
    259259        svgStyle->setFillRule(newClipRule);
    260260        newRenderStyle.get()->setOpacity(1.0f);
  • trunk/Source/WebCore/rendering/svg/SVGResources.cpp

    r75350 r79985  
    153153}
    154154
    155 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, SVGPaint* paint, AtomicString& id, bool& hasPendingResource)
    156 {
    157     ASSERT(paint);
    158 
    159     SVGPaint::SVGPaintType paintType = paint->paintType();
     155static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, AtomicString& id, bool& hasPendingResource)
     156{
    160157    if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)
    161158        return 0;
    162159
    163     id = SVGURIReference::getTarget(paint->uri());
     160    id = SVGURIReference::getTarget(paintUri);
    164161    RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(document, id);
    165162    if (!container) {
     
    260257            bool hasPendingResource = false;
    261258            AtomicString id;
    262             if (setFill(paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource)))
     259            if (setFill(paintingResourceFromSVGPaint(document, style->fillPaintType(), style->fillPaintUri(), id, hasPendingResource)))
    263260                foundResources = true;
    264261            else if (hasPendingResource)
     
    269266            bool hasPendingResource = false;
    270267            AtomicString id;
    271             if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource)))
     268            if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResource)))
    272269                foundResources = true;
    273270            else if (hasPendingResource)
  • trunk/Source/WebCore/svg/SVGColor.cpp

    r79675 r79985  
    5151    m_color = color;
    5252    m_colorType = SVG_COLORTYPE_RGBCOLOR;
    53     // FIXME: A follow up patch will call valueChanged() here.
     53    setNeedsStyleRecalc();
    5454}
    5555
     
    7676
    7777    m_colorType = SVG_COLORTYPE_RGBCOLOR_ICCCOLOR;
    78     // FIXME: A follow up patch will call valueChanged() here.
     78    setNeedsStyleRecalc();
    7979}
    8080
     
    116116    }
    117117
    118     // FIXME: A follow up patch will call valueChanged() here.
     118    setNeedsStyleRecalc();
    119119    m_colorType = type;
    120120    if (!requiresRGBColor) {
  • trunk/Source/WebCore/svg/SVGColor.h

    r79675 r79985  
    2424
    2525#if ENABLE(SVG)
    26 #include "CSSValue.h"
     26#include "CSSMutableValue.h"
    2727#include "Color.h"
    2828#include <wtf/PassRefPtr.h>
     
    3232class RGBColor;
    3333
    34 class SVGColor : public CSSValue {
     34class SVGColor : public CSSMutableValue {
    3535public:
    3636    enum SVGColorType {
  • trunk/Source/WebCore/svg/SVGPaint.cpp

    r79675 r79985  
    6868    setColor(Color());
    6969    setColorType(colorTypeForPaintType(m_paintType));
    70     // FIXME: A follow up patch will call valueChanged() here.
    71 }
    72 
    73 SVGPaint* SVGPaint::defaultFill()
    74 {
    75     static SVGPaint* staticDefaultFill = createColor(Color::black).releaseRef();
    76     return staticDefaultFill;
    77 }
    78 
    79 SVGPaint* SVGPaint::defaultStroke()
    80 {
    81     static SVGPaint* staticDefaultStroke = createNone().releaseRef();
    82     return staticDefaultStroke;
     70    setNeedsStyleRecalc();
    8371}
    8472
     
    133121    m_paintType = type;
    134122    m_uri = requiresURI ? uri : String();
    135     // FIXME: A follow up patch will call valueChanged() here.
     123    setNeedsStyleRecalc();
    136124}
    137125
  • trunk/Source/WebCore/svg/SVGPaint.h

    r79675 r79985  
    8888    bool matchesTargetURI(const String& referenceId);
    8989
    90     static SVGPaint* defaultFill();
    91     static SVGPaint* defaultStroke();
    92 
    9390private:
    9491    friend class CSSComputedStyleDeclaration;
Note: See TracChangeset for help on using the changeset viewer.