Add WTF::move()
[WebKit-https.git] / Source / WebCore / css / SVGCSSStyleSelector.cpp
1 /*
2     Copyright (C) 2005 Apple Inc.
3     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
4                   2004, 2005, 2008 Rob Buis <buis@kde.org>
5     Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6
7     Based on khtml css code by:
8     Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org)
9              (C) 2003 Apple Inc.
10              (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com)
11              (C) 2004 Germain Garand(germain@ebooksfrance.org)
12
13     This library is free software; you can redistribute it and/or
14     modify it under the terms of the GNU Library General Public
15     License as published by the Free Software Foundation; either
16     version 2 of the License, or (at your option) any later version.
17
18     This library is distributed in the hope that it will be useful,
19     but WITHOUT ANY WARRANTY; without even the implied warranty of
20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21     Library General Public License for more details.
22
23     You should have received a copy of the GNU Library General Public License
24     along with this library; see the file COPYING.LIB.  If not, write to
25     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26     Boston, MA 02110-1301, USA.
27 */
28
29 #include "config.h"
30 #include "StyleResolver.h"
31
32 #include "CSSPrimitiveValueMappings.h"
33 #include "CSSPropertyNames.h"
34 #include "CSSShadowValue.h"
35 #include "CSSValueList.h"
36 #include "Document.h"
37 #include "SVGColor.h"
38 #include "SVGElement.h"
39 #include "SVGNames.h"
40 #include "SVGPaint.h"
41 #include "SVGRenderStyle.h"
42 #include "SVGRenderStyleDefs.h"
43 #include "SVGURIReference.h"
44 #include <stdlib.h>
45 #include <wtf/MathExtras.h>
46
47 #define HANDLE_INHERIT(prop, Prop) \
48 if (isInherit) \
49 { \
50     svgStyle.set##Prop(state.parentStyle()->svgStyle().prop()); \
51     return; \
52 }
53
54 #define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
55 HANDLE_INHERIT(prop, Prop) \
56 if (isInitial) { \
57     svgStyle.set##Prop(SVGRenderStyle::initial##Prop()); \
58     return; \
59 }
60
61 namespace WebCore {
62
63 static float roundToNearestGlyphOrientationAngle(float angle)
64 {
65     angle = fabsf(fmodf(angle, 360.0f));
66
67     if (angle <= 45.0f || angle > 315.0f)
68         return 0.0f;
69     else if (angle > 45.0f && angle <= 135.0f)
70         return 90.0f;
71     else if (angle > 135.0f && angle <= 225.0f)
72         return 180.0f;
73
74     return 270.0f;
75 }
76
77 static int angleToGlyphOrientation(float angle)
78 {
79     angle = roundToNearestGlyphOrientationAngle(angle);
80
81     if (angle == 0.0f)
82         return GO_0DEG;
83     else if (angle == 90.0f)
84         return GO_90DEG;
85     else if (angle == 180.0f)
86         return GO_180DEG;
87     else if (angle == 270.0f)
88         return GO_270DEG;
89
90     return -1;
91 }
92
93 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
94 {
95     Color color;
96     if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
97         color = fgColor;
98     else
99         color = svgColor->color();
100     return color;
101 }
102
103 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
104 {
105     ASSERT(value);
106     CSSPrimitiveValue* primitiveValue = 0;
107     if (value->isPrimitiveValue())
108         primitiveValue = toCSSPrimitiveValue(value);
109
110     const State& state = m_state;
111     SVGRenderStyle& svgStyle = state.style()->accessSVGStyle();
112
113     bool isInherit = state.parentStyle() && value->isInheritedValue();
114     bool isInitial = value->isInitialValue() || (!state.parentStyle() && value->isInheritedValue());
115
116     // What follows is a list that maps the CSS properties into their
117     // corresponding front-end RenderStyle values. Shorthands(e.g. border,
118     // background) occur in this list as well and are only hit when mapping
119     // "inherit" or "initial" into front-end values.
120     switch (id)
121     {
122         // ident only properties
123         case CSSPropertyAlignmentBaseline:
124         {
125             HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
126             if (!primitiveValue)
127                 break;
128
129             svgStyle.setAlignmentBaseline(*primitiveValue);
130             break;
131         }
132         case CSSPropertyBaselineShift:
133         {
134             HANDLE_INHERIT_AND_INITIAL(baselineShift, BaselineShift);
135             if (!primitiveValue)
136                 break;
137
138             if (primitiveValue->getValueID()) {
139                 switch (primitiveValue->getValueID()) {
140                 case CSSValueBaseline:
141                     svgStyle.setBaselineShift(BS_BASELINE);
142                     break;
143                 case CSSValueSub:
144                     svgStyle.setBaselineShift(BS_SUB);
145                     break;
146                 case CSSValueSuper:
147                     svgStyle.setBaselineShift(BS_SUPER);
148                     break;
149                 default:
150                     break;
151                 }
152             } else {
153                 svgStyle.setBaselineShift(BS_LENGTH);
154                 svgStyle.setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
155             }
156
157             break;
158         }
159         case CSSPropertyKerning:
160         {
161             HANDLE_INHERIT_AND_INITIAL(kerning, Kerning);
162             if (primitiveValue)
163                 svgStyle.setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
164             break;
165         }
166         case CSSPropertyDominantBaseline:
167         {
168             HANDLE_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline)
169             if (primitiveValue)
170                 svgStyle.setDominantBaseline(*primitiveValue);
171             break;
172         }
173         case CSSPropertyColorInterpolation:
174         {
175             HANDLE_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation)
176             if (primitiveValue)
177                 svgStyle.setColorInterpolation(*primitiveValue);
178             break;
179         }
180         case CSSPropertyColorInterpolationFilters:
181         {
182             HANDLE_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters)
183             if (primitiveValue)
184                 svgStyle.setColorInterpolationFilters(*primitiveValue);
185             break;
186         }
187         case CSSPropertyColorProfile:
188         {
189             // Not implemented.
190             break;
191         }
192         case CSSPropertyColorRendering:
193         {
194             HANDLE_INHERIT_AND_INITIAL(colorRendering, ColorRendering)
195             if (primitiveValue)
196                 svgStyle.setColorRendering(*primitiveValue);
197             break;
198         }
199         case CSSPropertyClipRule:
200         {
201             HANDLE_INHERIT_AND_INITIAL(clipRule, ClipRule)
202             if (primitiveValue)
203                 svgStyle.setClipRule(*primitiveValue);
204             break;
205         }
206         case CSSPropertyPaintOrder: {
207             HANDLE_INHERIT_AND_INITIAL(paintOrder, PaintOrder)
208             // 'normal' is the only primitiveValue
209             if (primitiveValue)
210                 svgStyle.setPaintOrder(PaintOrderNormal);
211             if (!value->isValueList())
212                 break;
213             CSSValueList* orderTypeList = toCSSValueList(value);
214
215             // Serialization happened during parsing. No additional checking needed.
216             unsigned length = orderTypeList->length();
217             primitiveValue = toCSSPrimitiveValue(orderTypeList->itemWithoutBoundsCheck(0));
218             PaintOrder paintOrder;
219             switch (primitiveValue->getValueID()) {
220             case CSSValueFill:
221                 paintOrder = length > 1 ? PaintOrderFillMarkers : PaintOrderFill;
222                 break;
223             case CSSValueStroke:
224                 paintOrder = length > 1 ? PaintOrderStrokeMarkers : PaintOrderStroke;
225                 break;
226             case CSSValueMarkers:
227                 paintOrder = length > 1 ? PaintOrderMarkersStroke : PaintOrderMarkers;
228                 break;
229             default:
230                 ASSERT_NOT_REACHED();
231                 paintOrder = PaintOrderNormal;
232             }
233             svgStyle.setPaintOrder(static_cast<PaintOrder>(paintOrder));
234             break;
235         }
236         case CSSPropertyFillRule:
237         {
238             HANDLE_INHERIT_AND_INITIAL(fillRule, FillRule)
239             if (primitiveValue)
240                 svgStyle.setFillRule(*primitiveValue);
241             break;
242         }
243         case CSSPropertyStrokeLinejoin:
244         {
245             HANDLE_INHERIT_AND_INITIAL(joinStyle, JoinStyle)
246             if (primitiveValue)
247                 svgStyle.setJoinStyle(*primitiveValue);
248             break;
249         }
250         case CSSPropertyShapeRendering:
251         {
252             HANDLE_INHERIT_AND_INITIAL(shapeRendering, ShapeRendering)
253             if (primitiveValue)
254                 svgStyle.setShapeRendering(*primitiveValue);
255             break;
256         }
257         // end of ident only properties
258         case CSSPropertyFill:
259         {
260             if (isInherit) {
261                 const SVGRenderStyle& svgParentStyle = state.parentStyle()->svgStyle();
262                 svgStyle.setFillPaint(svgParentStyle.fillPaintType(), svgParentStyle.fillPaintColor(), svgParentStyle.fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
263                 return;
264             }
265             if (isInitial) {
266                 svgStyle.setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
267                 return;
268             }
269             if (value->isSVGPaint()) {
270                 SVGPaint* svgPaint = toSVGPaint(value);
271                 svgStyle.setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
272             }
273             break;
274         }
275         case CSSPropertyStroke:
276         {
277             if (isInherit) {
278                 const SVGRenderStyle& svgParentStyle = state.parentStyle()->svgStyle();
279                 svgStyle.setStrokePaint(svgParentStyle.strokePaintType(), svgParentStyle.strokePaintColor(), svgParentStyle.strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
280                 return;
281             }
282             if (isInitial) {
283                 svgStyle.setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
284                 return;
285             }
286             if (value->isSVGPaint()) {
287                 SVGPaint* svgPaint = toSVGPaint(value);
288                 svgStyle.setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
289             }
290             break;
291         }
292         case CSSPropertyStrokeWidth:
293         {
294             HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
295             if (primitiveValue)
296                 svgStyle.setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue));
297             break;
298         }
299         case CSSPropertyStrokeDasharray:
300         {
301             HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
302             if (!value->isValueList()) {
303                 svgStyle.setStrokeDashArray(SVGRenderStyle::initialStrokeDashArray());
304                 break;
305             }
306
307             CSSValueList* dashes = toCSSValueList(value);
308
309             Vector<SVGLength> array;
310             size_t length = dashes->length();
311             for (size_t i = 0; i < length; ++i) {
312                 CSSValue* currValue = dashes->itemWithoutBoundsCheck(i);
313                 if (!currValue->isPrimitiveValue())
314                     continue;
315
316                 CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBoundsCheck(i));
317                 array.append(SVGLength::fromCSSPrimitiveValue(dash));
318             }
319
320             svgStyle.setStrokeDashArray(array);
321             break;
322         }
323         case CSSPropertyStrokeDashoffset:
324         {
325             HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
326             if (primitiveValue)
327                 svgStyle.setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue));
328             break;
329         }
330         case CSSPropertyFillOpacity:
331         {
332             HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
333             if (!primitiveValue)
334                 return;
335
336             float f = 0.0f;
337             int type = primitiveValue->primitiveType();
338             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
339                 f = primitiveValue->getFloatValue() / 100.0f;
340             else if (type == CSSPrimitiveValue::CSS_NUMBER)
341                 f = primitiveValue->getFloatValue();
342             else
343                 return;
344
345             svgStyle.setFillOpacity(f);
346             break;
347         }
348         case CSSPropertyStrokeOpacity:
349         {
350             HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
351             if (!primitiveValue)
352                 return;
353
354             float f = 0.0f;
355             int type = primitiveValue->primitiveType();
356             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
357                 f = primitiveValue->getFloatValue() / 100.0f;
358             else if (type == CSSPrimitiveValue::CSS_NUMBER)
359                 f = primitiveValue->getFloatValue();
360             else
361                 return;
362
363             svgStyle.setStrokeOpacity(f);
364             break;
365         }
366         case CSSPropertyStopOpacity:
367         {
368             HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
369             if (!primitiveValue)
370                 return;
371
372             float f = 0.0f;
373             int type = primitiveValue->primitiveType();
374             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
375                 f = primitiveValue->getFloatValue() / 100.0f;
376             else if (type == CSSPrimitiveValue::CSS_NUMBER)
377                 f = primitiveValue->getFloatValue();
378             else
379                 return;
380
381             svgStyle.setStopOpacity(f);
382             break;
383         }
384         case CSSPropertyMarkerStart:
385         {
386             HANDLE_INHERIT_AND_INITIAL(markerStartResource, MarkerStartResource)
387             if (!primitiveValue)
388                 return;
389
390             String s;
391             int type = primitiveValue->primitiveType();
392             if (type == CSSPrimitiveValue::CSS_URI)
393                 s = primitiveValue->getStringValue();
394
395             svgStyle.setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
396             break;
397         }
398         case CSSPropertyMarkerMid:
399         {
400             HANDLE_INHERIT_AND_INITIAL(markerMidResource, MarkerMidResource)
401             if (!primitiveValue)
402                 return;
403
404             String s;
405             int type = primitiveValue->primitiveType();
406             if (type == CSSPrimitiveValue::CSS_URI)
407                 s = primitiveValue->getStringValue();
408
409             svgStyle.setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
410             break;
411         }
412         case CSSPropertyMarkerEnd:
413         {
414             HANDLE_INHERIT_AND_INITIAL(markerEndResource, MarkerEndResource)
415             if (!primitiveValue)
416                 return;
417
418             String s;
419             int type = primitiveValue->primitiveType();
420             if (type == CSSPrimitiveValue::CSS_URI)
421                 s = primitiveValue->getStringValue();
422
423             svgStyle.setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
424             break;
425         }
426         case CSSPropertyStrokeLinecap:
427         {
428             HANDLE_INHERIT_AND_INITIAL(capStyle, CapStyle)
429             if (primitiveValue)
430                 svgStyle.setCapStyle(*primitiveValue);
431             break;
432         }
433         case CSSPropertyStrokeMiterlimit:
434         {
435             HANDLE_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)
436             if (!primitiveValue)
437                 return;
438
439             float f = 0.0f;
440             int type = primitiveValue->primitiveType();
441             if (type == CSSPrimitiveValue::CSS_NUMBER)
442                 f = primitiveValue->getFloatValue();
443             else
444                 return;
445
446             svgStyle.setStrokeMiterLimit(f);
447             break;
448         }
449         case CSSPropertyFilter:
450         {
451             HANDLE_INHERIT_AND_INITIAL(filterResource, FilterResource)
452             if (!primitiveValue)
453                 return;
454
455             String s;
456             int type = primitiveValue->primitiveType();
457             if (type == CSSPrimitiveValue::CSS_URI)
458                 s = primitiveValue->getStringValue();
459
460             svgStyle.setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
461             break;
462         }
463         case CSSPropertyMask:
464         {
465             HANDLE_INHERIT_AND_INITIAL(maskerResource, MaskerResource)
466             if (!primitiveValue)
467                 return;
468
469             String s;
470             int type = primitiveValue->primitiveType();
471             if (type == CSSPrimitiveValue::CSS_URI)
472                 s = primitiveValue->getStringValue();
473
474             svgStyle.setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
475             break;
476         }
477         case CSSPropertyClipPath:
478         {
479             HANDLE_INHERIT_AND_INITIAL(clipperResource, ClipperResource)
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
488             svgStyle.setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
489             break;
490         }
491         case CSSPropertyTextAnchor:
492         {
493             HANDLE_INHERIT_AND_INITIAL(textAnchor, TextAnchor)
494             if (primitiveValue)
495                 svgStyle.setTextAnchor(*primitiveValue);
496             break;
497         }
498         case CSSPropertyWritingMode:
499         {
500             HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode)
501             if (primitiveValue)
502                 svgStyle.setWritingMode(*primitiveValue);
503             break;
504         }
505         case CSSPropertyStopColor:
506         {
507             HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor);
508             if (value->isSVGColor())
509                 svgStyle.setStopColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
510             break;
511         }
512        case CSSPropertyLightingColor:
513         {
514             HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor);
515             if (value->isSVGColor())
516                 svgStyle.setLightingColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
517             break;
518         }
519         case CSSPropertyFloodOpacity:
520         {
521             HANDLE_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)
522             if (!primitiveValue)
523                 return;
524
525             float f = 0.0f;
526             int type = primitiveValue->primitiveType();
527             if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
528                 f = primitiveValue->getFloatValue() / 100.0f;
529             else if (type == CSSPrimitiveValue::CSS_NUMBER)
530                 f = primitiveValue->getFloatValue();
531             else
532                 return;
533
534             svgStyle.setFloodOpacity(f);
535             break;
536         }
537         case CSSPropertyFloodColor:
538         {
539             HANDLE_INHERIT_AND_INITIAL(floodColor, FloodColor);
540             if (value->isSVGColor())
541                 svgStyle.setFloodColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
542             break;
543         }
544         case CSSPropertyGlyphOrientationHorizontal:
545         {
546             HANDLE_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientationHorizontal)
547             if (!primitiveValue)
548                 return;
549
550             if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
551                 int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());
552                 ASSERT(orientation != -1);
553
554                 svgStyle.setGlyphOrientationHorizontal((EGlyphOrientation) orientation);
555             }
556
557             break;
558         }
559         case CSSPropertyGlyphOrientationVertical:
560         {
561             HANDLE_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientationVertical)
562             if (!primitiveValue)
563                 return;
564
565             if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
566                 int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());
567                 ASSERT(orientation != -1);
568
569                 svgStyle.setGlyphOrientationVertical((EGlyphOrientation) orientation);
570             } else if (primitiveValue->getValueID() == CSSValueAuto)
571                 svgStyle.setGlyphOrientationVertical(GO_AUTO);
572
573             break;
574         }
575         case CSSPropertyEnableBackground:
576             // Silently ignoring this property for now
577             // http://bugs.webkit.org/show_bug.cgi?id=6022
578             break;
579         case CSSPropertyWebkitSvgShadow: {
580             if (isInherit)
581                 return svgStyle.setShadow(state.parentStyle()->svgStyle().shadow() ? std::make_unique<ShadowData>(*state.parentStyle()->svgStyle().shadow()) : nullptr);
582             if (isInitial || primitiveValue) // initial | none
583                 return svgStyle.setShadow(nullptr);
584
585             if (!value->isValueList())
586                 return;
587
588             CSSValueList* list = toCSSValueList(value);
589             if (!list->length())
590                 return;
591
592             CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
593             if (!firstValue->isShadowValue())
594                 return;
595             CSSShadowValue* item = toCSSShadowValue(firstValue);
596             IntPoint location(item->x->computeLength<int>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0f)),
597                 item->y->computeLength<int>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0f)));
598             int blur = item->blur ? item->blur->computeLength<int>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0f)) : 0;
599             Color color;
600             if (item->color)
601                 color = colorFromPrimitiveValue(item->color.get());
602
603             // -webkit-svg-shadow does should not have a spread or style
604             ASSERT(!item->spread);
605             ASSERT(!item->style);
606
607             auto shadowData = std::make_unique<ShadowData>(location, blur, 0, Normal, false, color.isValid() ? color : Color::transparent);
608             svgStyle.setShadow(WTF::move(shadowData));
609             return;
610         }
611         case CSSPropertyVectorEffect: {
612             HANDLE_INHERIT_AND_INITIAL(vectorEffect, VectorEffect)
613             if (!primitiveValue)
614                 break;
615
616             svgStyle.setVectorEffect(*primitiveValue);
617             break;
618         }
619         case CSSPropertyBufferedRendering: {
620             HANDLE_INHERIT_AND_INITIAL(bufferedRendering, BufferedRendering)
621             if (!primitiveValue)
622                 break;
623
624             svgStyle.setBufferedRendering(*primitiveValue);
625             break;
626         }
627         case CSSPropertyMaskType: {
628             HANDLE_INHERIT_AND_INITIAL(maskType, MaskType)
629             if (!primitiveValue)
630                 break;
631
632             svgStyle.setMaskType(*primitiveValue);
633             break;
634         }
635         default:
636             // If you crash here, it's because you added a css property and are not handling it
637             // in either this switch statement or the one in StyleResolver::applyProperty
638             ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id);
639             return;
640     }
641 }
642
643 }