2006-09-25 Anders Carlsson <acarlsson@apple.com>
[WebKit-https.git] / WebCore / ksvg2 / css / SVGCSSStyleSelector.cpp
1 /*
2     Copyright (C) 2005 Apple Computer, Inc.
3     Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
4                   2004, 2005 Rob Buis <buis@kde.org>
5
6     Based on khtml css code by:
7     Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org)
8              (C) 2003 Apple Computer, Inc.
9              (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com)
10              (C) 2004 Germain Garand(germain@ebooksfrance.org)
11
12     This file is part of the KDE project
13
14     This library is free software; you can redistribute it and/or
15     modify it under the terms of the GNU Library General Public
16     License as published by the Free Software Foundation; either
17     version 2 of the License, or (at your option) any later version.
18
19     This library is distributed in the hope that it will be useful,
20     but WITHOUT ANY WARRANTY; without even the implied warranty of
21     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22     Library General Public License for more details.
23
24     You should have received a copy of the GNU Library General Public License
25     along with this library; see the file COPYING.LIB.  If not, write to
26     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27     Boston, MA 02111-1307, USA.
28 */
29
30 #include "config.h"
31 #ifdef SVG_SUPPORT
32 #include "cssstyleselector.h"
33
34 #include "SVGColor.h"
35 #include "SVGNames.h"
36 #include "SVGPaint.h"
37 #include "SVGRenderStyle.h"
38 #include "SVGRenderStyleDefs.h"
39 #include "SVGStyledElement.h"
40 #include "CSSValueKeywords.h"
41 #include "CSSValueList.h"
42 #include "ksvg.h"
43 #include "ksvgcssvalues.h"
44 #include "ksvgcssproperties.h"
45 #include <stdlib.h>
46 #include <math.h>
47
48 #define HANDLE_INHERIT(prop, Prop) \
49 if (isInherit) \
50 {\
51     svgstyle->set##Prop(parentStyle->svgStyle()->prop());\
52     return;\
53 }
54
55 #define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
56 HANDLE_INHERIT(prop, Prop) \
57 else if (isInitial) \
58     svgstyle->set##Prop(SVGRenderStyle::initial##Prop());
59
60 #define HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(prop, Prop, Value) \
61 HANDLE_INHERIT(prop, Prop) \
62 else if (isInitial) \
63     svgstyle->set##Prop(SVGRenderStyle::initial##Value());
64
65 #define HANDLE_INHERIT_COND(propID, prop, Prop) \
66 if (id == propID) \
67 {\
68     svgstyle->set##Prop(parentStyle->prop());\
69     return;\
70 }
71
72 #define HANDLE_INITIAL_COND(propID, Prop) \
73 if (id == propID) \
74 {\
75     svgstyle->set##Prop(SVGRenderStyle::initial##Prop());\
76     return;\
77 }
78
79 #define HANDLE_INITIAL_COND_WITH_VALUE(propID, Prop, Value) \
80 if (id == propID) \
81 {\
82     svgstyle->set##Prop(SVGRenderStyle::initial##Value());\
83     return;\
84 }
85
86 namespace WebCore {
87
88 void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
89 {
90     CSSPrimitiveValue* primitiveValue = 0;
91     if (value->isPrimitiveValue())
92         primitiveValue = static_cast<CSSPrimitiveValue*>(value);
93
94     Length l;
95     SVGRenderStyle* svgstyle = style->accessSVGStyle();
96     
97     unsigned short valueType = value->cssValueType();
98     
99     bool isInherit = parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT;
100     bool isInitial = valueType == CSSPrimitiveValue::CSS_INITIAL || (!parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT);
101
102     // What follows is a list that maps the CSS properties into their
103     // corresponding front-end RenderStyle values. Shorthands(e.g. border,
104     // background) occur in this list as well and are only hit when mapping
105     // "inherit" or "initial" into front-end values.
106     switch (id)
107     {
108         // ident only properties
109         case SVGCSS_PROP_ALIGNMENT_BASELINE:
110         {
111             HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
112             if (!primitiveValue)
113                 break;
114
115             switch (primitiveValue->getIdent())
116             {
117                 case CSS_VAL_AUTO:
118                     svgstyle->setAlignmentBaseline(AB_AUTO);
119                     break;
120                 case CSS_VAL_BASELINE:
121                     svgstyle->setAlignmentBaseline(AB_BASELINE);
122                     break;
123                 case SVGCSS_VAL_BEFORE_EDGE:
124                     svgstyle->setAlignmentBaseline(AB_BEFORE_EDGE);
125                     break;
126                 case SVGCSS_VAL_TEXT_BEFORE_EDGE:
127                     svgstyle->setAlignmentBaseline(AB_TEXT_BEFORE_EDGE);
128                     break;
129                 case CSS_VAL_MIDDLE:
130                     svgstyle->setAlignmentBaseline(AB_MIDDLE);
131                     break;
132                 case SVGCSS_VAL_CENTRAL:
133                     svgstyle->setAlignmentBaseline(AB_CENTRAL);
134                     break;
135                 case SVGCSS_VAL_AFTER_EDGE:
136                     svgstyle->setAlignmentBaseline(AB_AFTER_EDGE);
137                     break;
138                 case SVGCSS_VAL_TEXT_AFTER_EDGE:
139                     svgstyle->setAlignmentBaseline(AB_TEXT_AFTER_EDGE);
140                     break;
141                 case SVGCSS_VAL_IDEOGRAPHIC:
142                     svgstyle->setAlignmentBaseline(AB_IDEOGRAPHIC);
143                     break;
144                 case SVGCSS_VAL_ALPHABETIC:
145                     svgstyle->setAlignmentBaseline(AB_ALPHABETIC);
146                     break;
147                 case SVGCSS_VAL_HANGING:
148                     svgstyle->setAlignmentBaseline(AB_HANGING);
149                     break;
150                 case SVGCSS_VAL_MATHEMATICAL:
151                     svgstyle->setAlignmentBaseline(AB_MATHEMATICAL);
152                     break;
153                 default:
154                     return;
155             }
156
157             break;
158         }
159         case SVGCSS_PROP_POINTER_EVENTS:
160         {
161             HANDLE_INHERIT_AND_INITIAL(pointerEvents, PointerEvents)
162             if (!primitiveValue)
163                 break;
164                 
165             switch (primitiveValue->getIdent())
166             {
167                 case SVGCSS_VAL_ALL:
168                     svgstyle->setPointerEvents(PE_ALL);
169                     break;
170                 case CSS_VAL_NONE:
171                     svgstyle->setPointerEvents(PE_NONE);
172                     break;
173                 case SVGCSS_VAL_VISIBLEPAINTED:
174                     svgstyle->setPointerEvents(PE_VISIBLE_PAINTED);
175                     break;
176                 case SVGCSS_VAL_VISIBLEFILL:
177                     svgstyle->setPointerEvents(PE_VISIBLE_FILL);
178                     break;
179                 case SVGCSS_VAL_VISIBLESTROKE:
180                     svgstyle->setPointerEvents(PE_VISIBLE_STROKE);
181                     break;
182                 case CSS_VAL_VISIBLE:
183                     svgstyle->setPointerEvents(PE_VISIBLE);
184                     break;
185                 case SVGCSS_VAL_PAINTED:
186                     svgstyle->setPointerEvents(PE_PAINTED);
187                     break;
188                 case SVGCSS_VAL_FILL:
189                     svgstyle->setPointerEvents(PE_FILL);
190                     break;
191                 case SVGCSS_VAL_STROKE:
192                     svgstyle->setPointerEvents(PE_STROKE);
193                 default:
194                     return;
195             }
196
197             break;
198         }
199         case SVGCSS_PROP_DOMINANT_BASELINE:
200         {
201             HANDLE_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline)
202             if (!primitiveValue)
203                 break;
204     
205             switch (primitiveValue->getIdent())
206             {
207                 case CSS_VAL_AUTO:
208                     svgstyle->setDominantBaseline(DB_AUTO);
209                     break;
210                 case SVGCSS_VAL_USE_SCRIPT:
211                     svgstyle->setDominantBaseline(DB_USE_SCRIPT);
212                     break;
213                 case SVGCSS_VAL_NO_CHANGE:
214                     svgstyle->setDominantBaseline(DB_NO_CHANGE);
215                     break;
216                 case SVGCSS_VAL_RESET_SIZE:
217                     svgstyle->setDominantBaseline(DB_RESET_SIZE);
218                     break;
219                 case SVGCSS_VAL_IDEOGRAPHIC:
220                     svgstyle->setDominantBaseline(DB_IDEOGRAPHIC);
221                     break;
222                 case SVGCSS_VAL_ALPHABETIC:
223                     svgstyle->setDominantBaseline(DB_ALPHABETIC);
224                     break;
225                 case SVGCSS_VAL_HANGING:
226                     svgstyle->setDominantBaseline(DB_HANGING);
227                     break;
228                 case SVGCSS_VAL_MATHEMATICAL:
229                     svgstyle->setDominantBaseline(DB_MATHEMATICAL);
230                     break;
231                 case SVGCSS_VAL_CENTRAL:
232                     svgstyle->setDominantBaseline(DB_CENTRAL);
233                     break;
234                 case CSS_VAL_MIDDLE:
235                     svgstyle->setDominantBaseline(DB_MIDDLE);
236                     break;
237                 case SVGCSS_VAL_TEXT_AFTER_EDGE:
238                     svgstyle->setDominantBaseline(DB_TEXT_AFTER_EDGE);
239                     break;
240                 case SVGCSS_VAL_TEXT_BEFORE_EDGE:
241                     svgstyle->setDominantBaseline(DB_TEXT_BEFORE_EDGE);
242                     break;
243                 default:
244                     return;
245             }
246     
247             break;
248         }
249         case SVGCSS_PROP_COLOR_INTERPOLATION:
250         {
251             HANDLE_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation)
252             if (!primitiveValue)
253                 return;
254                 
255             switch (primitiveValue->getIdent())
256             {
257                 case SVGCSS_VAL_SRGB:
258                     svgstyle->setColorInterpolation(CI_SRGB);
259                     break;
260                 case SVGCSS_VAL_LINEARRGB:
261                     svgstyle->setColorInterpolation(CI_LINEARRGB);
262                     break;
263                 case CSS_VAL_AUTO:
264                     svgstyle->setColorInterpolation(CI_AUTO);
265                 default:
266                     return;
267             }
268     
269             break;
270         }
271         case SVGCSS_PROP_COLOR_INTERPOLATION_FILTERS:
272         {
273             HANDLE_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters)
274             if (!primitiveValue)
275                 return;
276                 
277             switch (primitiveValue->getIdent())
278             {
279                 case SVGCSS_VAL_SRGB:
280                     svgstyle->setColorInterpolationFilters(CI_SRGB);
281                     break;
282                 case SVGCSS_VAL_LINEARRGB:
283                     svgstyle->setColorInterpolationFilters(CI_LINEARRGB);
284                     break;
285                 case CSS_VAL_AUTO:
286                     svgstyle->setColorInterpolationFilters(CI_AUTO);
287                 default:
288                     return;
289             }
290             
291             break;
292         }
293         case SVGCSS_PROP_CLIP_RULE:
294         {
295             HANDLE_INHERIT_AND_INITIAL(clipRule, ClipRule)
296             if (!primitiveValue)
297                 break;
298                 
299             switch (primitiveValue->getIdent())
300             {
301                 case SVGCSS_VAL_NONZERO:
302                     svgstyle->setClipRule(RULE_NONZERO);
303                     break;
304                 case SVGCSS_VAL_EVENODD:
305                     svgstyle->setClipRule(RULE_EVENODD);
306                     break;
307                 default:
308                     break;
309             }
310         
311             break;
312         }
313         case SVGCSS_PROP_FILL_RULE:
314         {
315             HANDLE_INHERIT_AND_INITIAL(fillRule, FillRule)
316             if (!primitiveValue)
317                 break;
318             
319             switch (primitiveValue->getIdent())
320             {
321                 case SVGCSS_VAL_NONZERO:
322                     svgstyle->setFillRule(RULE_NONZERO);
323                     break;
324                 case SVGCSS_VAL_EVENODD:
325                     svgstyle->setFillRule(RULE_EVENODD);
326                 default:
327                     return;
328             }
329         
330             break;
331         }
332         case SVGCSS_PROP_STROKE_LINEJOIN:
333         {
334             HANDLE_INHERIT_AND_INITIAL(joinStyle, JoinStyle)
335
336             if (!primitiveValue)
337                 break;
338                 
339             switch (primitiveValue->getIdent())
340             {
341                 case SVGCSS_VAL_MITER:
342                     svgstyle->setJoinStyle(JS_MITER);
343                     break;
344                 case CSS_VAL_ROUND:
345                     svgstyle->setJoinStyle(JS_ROUND);
346                     break;
347                 case SVGCSS_VAL_BEVEL:
348                     svgstyle->setJoinStyle(JS_BEVEL);
349                 default:
350                     return;
351             }
352             
353             break;
354         }
355         case SVGCSS_PROP_IMAGE_RENDERING:
356         {
357             HANDLE_INHERIT_AND_INITIAL(imageRendering, ImageRendering)
358             if (!primitiveValue)
359                 return;
360             
361             switch (primitiveValue->getIdent())
362             {
363                 case SVGCSS_VAL_OPTIMIZESPEED:
364                     svgstyle->setImageRendering(IR_OPTIMIZESPEED);
365                 default:
366                     return;
367             }
368     
369             break;
370         }
371         // end of ident only properties
372         case SVGCSS_PROP_FILL:
373         {
374             HANDLE_INHERIT_AND_INITIAL(fillPaint, FillPaint)
375             if (!primitiveValue && value) {
376                 SVGPaint *paint = static_cast<SVGPaint*>(value);
377                 if (paint)
378                     svgstyle->setFillPaint(paint);
379             }
380             
381             break;
382         }
383         case SVGCSS_PROP_STROKE:
384         {
385             HANDLE_INHERIT_AND_INITIAL(strokePaint, StrokePaint)
386             if (!primitiveValue && value) {
387                 SVGPaint *paint = static_cast<SVGPaint*>(value);
388                 if (paint)
389                     svgstyle->setStrokePaint(paint);
390             }
391             
392             break;
393         }
394         case SVGCSS_PROP_STROKE_WIDTH:
395         {
396             HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
397             if (!primitiveValue)
398                 return;
399         
400             svgstyle->setStrokeWidth(primitiveValue);
401             break;
402         }
403         case SVGCSS_PROP_STROKE_DASHARRAY:
404         {
405             HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
406             if (!primitiveValue && value) {
407                 CSSValueList* dashes = static_cast<CSSValueList*>(value);
408                 if (dashes)
409                     svgstyle->setStrokeDashArray(dashes);
410             }
411         
412             break;
413         }
414         case SVGCSS_PROP_STROKE_DASHOFFSET:
415         {
416             HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
417             if (!primitiveValue)
418                 return;
419
420             svgstyle->setStrokeDashOffset(primitiveValue);
421             break;
422         }
423         case SVGCSS_PROP_FILL_OPACITY:
424         {
425             HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
426             if (!primitiveValue)
427                 return;
428         
429             float f = 0.0;    
430             int type = primitiveValue->primitiveType();
431             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
432                 f = primitiveValue->getFloatValue() / 100.;
433             else if (type == CSSPrimitiveValue::CSS_NUMBER)
434                 f = primitiveValue->getFloatValue();
435             else
436                 return;
437
438             svgstyle->setFillOpacity(f);
439             break;
440         }
441         case SVGCSS_PROP_STROKE_OPACITY:
442         {
443             HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
444             if (!primitiveValue)
445                 return;
446         
447             float f = 0.0;    
448             int type = primitiveValue->primitiveType();
449             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
450                 f = primitiveValue->getFloatValue() / 100.;
451             else if (type == CSSPrimitiveValue::CSS_NUMBER)
452                 f = primitiveValue->getFloatValue();
453             else
454                 return;
455
456             svgstyle->setStrokeOpacity(f);
457             break;
458         }
459         case SVGCSS_PROP_STOP_OPACITY:
460         {
461             HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
462             if (!primitiveValue)
463                 return;
464         
465             float f = 0.0;    
466             int type = primitiveValue->primitiveType();
467             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
468                 f = primitiveValue->getFloatValue() / 100.;
469             else if (type == CSSPrimitiveValue::CSS_NUMBER)
470                 f = primitiveValue->getFloatValue();
471             else
472                 return;
473
474             svgstyle->setStopOpacity(f);
475             break;
476         }
477         case SVGCSS_PROP_MARKER_START:
478         {
479             HANDLE_INHERIT_AND_INITIAL(startMarker, StartMarker)
480             if (!primitiveValue)
481                 return;
482
483             String s;
484             int type = primitiveValue->primitiveType();
485             if (type == CSSPrimitiveValue::CSS_URI)
486                 s = primitiveValue->getStringValue();
487             else
488                 return;
489
490             svgstyle->setStartMarker(s);
491             break;
492         }
493         case SVGCSS_PROP_MARKER_MID:
494         {
495             HANDLE_INHERIT_AND_INITIAL(midMarker, MidMarker)
496             if (!primitiveValue)
497                 return;
498
499             String s;
500             int type = primitiveValue->primitiveType();
501             if (type == CSSPrimitiveValue::CSS_URI)
502                 s = primitiveValue->getStringValue();
503             else
504                 return;
505
506             svgstyle->setMidMarker(s);
507             break;
508         }
509         case SVGCSS_PROP_MARKER_END:
510         {
511             HANDLE_INHERIT_AND_INITIAL(endMarker, EndMarker)
512             if (!primitiveValue)
513                 return;
514
515             String s;
516             int type = primitiveValue->primitiveType();
517             if (type == CSSPrimitiveValue::CSS_URI)
518                 s = primitiveValue->getStringValue();
519             else
520                 return;
521
522             svgstyle->setEndMarker(s);
523             break;
524         }
525         case SVGCSS_PROP_STROKE_LINECAP:
526         {
527             HANDLE_INHERIT_AND_INITIAL(capStyle, CapStyle)
528             if (!primitiveValue)
529                 break;
530             
531             switch (primitiveValue->getIdent())
532             {
533                 case SVGCSS_VAL_BUTT:
534                     svgstyle->setCapStyle(CS_BUTT);
535                     break;
536                 case CSS_VAL_ROUND:
537                     svgstyle->setCapStyle(CS_ROUND);
538                     break;
539                 case CSS_VAL_SQUARE:
540                     svgstyle->setCapStyle(CS_SQUARE);
541                 default:
542                     return;
543             }
544
545             break;
546         }
547         case SVGCSS_PROP_STROKE_MITERLIMIT:
548         {
549             HANDLE_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)
550             if (!primitiveValue)
551                 return;
552
553             float f = 0.0;
554             int type = primitiveValue->primitiveType();
555             if (type == CSSPrimitiveValue::CSS_NUMBER)
556                 f = primitiveValue->getFloatValue();
557             else
558                 return;
559
560             svgstyle->setStrokeMiterLimit(lroundf(f));
561             break;
562         }
563         case SVGCSS_PROP_FILTER:
564         {
565             HANDLE_INHERIT_AND_INITIAL(filter, Filter)
566             if (!primitiveValue)
567                 return;
568
569             String s;
570             int type = primitiveValue->primitiveType();
571             if (type == CSSPrimitiveValue::CSS_URI)
572                 s = primitiveValue->getStringValue();
573             else
574                 return;
575             svgstyle->setFilter(s);
576             break;
577         }
578         case SVGCSS_PROP_MASK:
579         {
580             HANDLE_INHERIT_AND_INITIAL(maskElement, MaskElement)
581             if (!primitiveValue)
582                 return;
583
584             String s;
585             int type = primitiveValue->primitiveType();
586             if (type == CSSPrimitiveValue::CSS_URI)
587                 s = primitiveValue->getStringValue();
588             else
589                 return;
590
591             svgstyle->setMaskElement(s);
592             break;
593         }
594         case SVGCSS_PROP_CLIP_PATH:
595         {
596             HANDLE_INHERIT_AND_INITIAL(clipPath, ClipPath)
597             if (!primitiveValue)
598                 return;
599
600             String s;
601             int type = primitiveValue->primitiveType();
602             if (type == CSSPrimitiveValue::CSS_URI)
603                 s = primitiveValue->getStringValue();
604             else
605                 return;
606
607             svgstyle->setClipPath(s);
608             break;
609         }
610         case SVGCSS_PROP_TEXT_ANCHOR:
611         {
612             HANDLE_INHERIT_AND_INITIAL(textAnchor, TextAnchor)
613             if (!primitiveValue)
614                 break;
615             
616             switch (primitiveValue->getIdent())
617             {
618                 case CSS_VAL_START:
619                     svgstyle->setTextAnchor(TA_START);
620                     break;
621                 case CSS_VAL_MIDDLE:
622                     svgstyle->setTextAnchor(TA_MIDDLE);
623                     break;
624                 case CSS_VAL_END:
625                     svgstyle->setTextAnchor(TA_END);
626                 default:
627                     return;
628             }
629             
630             break;
631         }
632         case SVGCSS_PROP_WRITING_MODE:
633         {
634             HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode)
635             if (primitiveValue)
636                 svgstyle->setWritingMode((EWritingMode)(primitiveValue->getIdent() - SVGCSS_VAL_LR_TB));
637             break;
638         }       
639 #if 0
640         case CSS_PROP_COLOR: // colors || inherit
641         {
642             Color col;
643             if (isInherit) {
644                 HANDLE_INHERIT_COND(CSS_PROP_COLOR, color, Color)
645                 return;
646             } else if (isInitial)
647                 col = RenderStyle::initialColor();
648             else {
649                 SVGColor *c = static_cast<SVGColor*>(value);
650                 if (!c)
651                     return CSSStyleSelector::applyProperty(id, value);
652                 
653                 col = c->color();
654             }
655         
656             svgstyle->setColor(col);
657             break;
658         }
659 #endif
660         case SVGCSS_PROP_STOP_COLOR:
661         {
662             Color col;
663             if (isInherit) {
664                 style->setColor(parentStyle->color());
665                 return;
666             } else if (isInitial)
667                 col = SVGRenderStyle::initialStopColor();
668             else {
669                 SVGColor *c = static_cast<SVGColor*>(value);
670                 if (!c)
671                     return CSSStyleSelector::applyProperty(id, value);
672
673                 if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
674                     col = style->color();
675                 else
676                     col = c->color();
677             }
678
679             svgstyle->setStopColor(col);
680             break;
681         }
682         case SVGCSS_PROP_FLOOD_OPACITY:
683         {
684             HANDLE_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)
685             if (!primitiveValue)
686                 return;
687
688             float f = 0.0;    
689             int type = primitiveValue->primitiveType();
690             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
691                 f = primitiveValue->getFloatValue() / 100.;
692             else if (type == CSSPrimitiveValue::CSS_NUMBER)
693                 f = primitiveValue->getFloatValue();
694             else
695                 return;
696
697             svgstyle->setFloodOpacity(f);
698             break;
699         }
700         case SVGCSS_PROP_FLOOD_COLOR:
701         {
702             Color col;
703             if (isInitial)
704                 col = SVGRenderStyle::initialStopColor();
705             else {
706                 SVGColor *c = static_cast<SVGColor*>(value);
707                 if (!c)
708                     return CSSStyleSelector::applyProperty(id, value);
709
710                 if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
711                     col = style->color();
712                 else
713                     col = c->color();
714             }
715
716             svgstyle->setFloodColor(col);
717             break;
718         }
719         default:
720             return;
721     }
722 }
723
724 }
725
726 // vim:ts=4:noet
727 #endif // SVG_SUPPORT