OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 2004, 2005 Rob Buis <buis@kde.org> | 3 2004, 2005 Rob Buis <buis@kde.org> |
4 Copyright (C) 2005, 2006 Apple Computer, Inc. | 4 Copyright (C) 2005, 2006 Apple Computer, Inc. |
5 Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 static EColorInterpolation initialColorInterpolationFilters() { return CI_LI
NEARRGB; } | 63 static EColorInterpolation initialColorInterpolationFilters() { return CI_LI
NEARRGB; } |
64 static EColorRendering initialColorRendering() { return CR_AUTO; } | 64 static EColorRendering initialColorRendering() { return CR_AUTO; } |
65 static WindRule initialFillRule() { return RULE_NONZERO; } | 65 static WindRule initialFillRule() { return RULE_NONZERO; } |
66 static EImageRendering initialImageRendering() { return IR_AUTO; } | 66 static EImageRendering initialImageRendering() { return IR_AUTO; } |
67 static LineJoin initialJoinStyle() { return MiterJoin; } | 67 static LineJoin initialJoinStyle() { return MiterJoin; } |
68 static EShapeRendering initialShapeRendering() { return SR_AUTO; } | 68 static EShapeRendering initialShapeRendering() { return SR_AUTO; } |
69 static ETextAnchor initialTextAnchor() { return TA_START; } | 69 static ETextAnchor initialTextAnchor() { return TA_START; } |
70 static SVGWritingMode initialWritingMode() { return WM_LRTB; } | 70 static SVGWritingMode initialWritingMode() { return WM_LRTB; } |
71 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE
G; } | 71 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE
G; } |
72 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO;
} | 72 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO;
} |
73 static float initialFillOpacity() { return 1; } | 73 static float initialFillOpacity() { return 1.0f; } |
74 static SVGPaint::SVGPaintType initialFillPaintType() { return SVGPaint::SVG_
PAINTTYPE_RGBCOLOR; } | 74 static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); } |
75 static Color initialFillPaintColor() { return Color::black; } | 75 static float initialStrokeOpacity() { return 1.0f; } |
76 static String initialFillPaintUri() { return String(); } | 76 static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); } |
77 static float initialStrokeOpacity() { return 1; } | |
78 static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SV
G_PAINTTYPE_NONE; } | |
79 static Color initialStrokePaintColor() { return Color(); } | |
80 static String initialStrokePaintUri() { return String(); } | |
81 static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>
(); } | 77 static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>
(); } |
82 static float initialStrokeMiterLimit() { return 4; } | 78 static float initialStrokeMiterLimit() { return 4.0f; } |
83 static float initialStopOpacity() { return 1; } | 79 static float initialStopOpacity() { return 1.0f; } |
84 static Color initialStopColor() { return Color(0, 0, 0); } | 80 static Color initialStopColor() { return Color(0, 0, 0); } |
85 static float initialFloodOpacity() { return 1; } | 81 static float initialFloodOpacity() { return 1.0f; } |
86 static Color initialFloodColor() { return Color(0, 0, 0); } | 82 static Color initialFloodColor() { return Color(0, 0, 0); } |
87 static Color initialLightingColor() { return Color(255, 255, 255); } | 83 static Color initialLightingColor() { return Color(255, 255, 255); } |
88 static ShadowData* initialShadow() { return 0; } | 84 static ShadowData* initialShadow() { return 0; } |
89 static String initialClipperResource() { return String(); } | 85 static String initialClipperResource() { return String(); } |
90 static String initialFilterResource() { return String(); } | 86 static String initialFilterResource() { return String(); } |
91 static String initialMaskerResource() { return String(); } | 87 static String initialMaskerResource() { return String(); } |
92 static String initialMarkerStartResource() { return String(); } | 88 static String initialMarkerStartResource() { return String(); } |
93 static String initialMarkerMidResource() { return String(); } | 89 static String initialMarkerMidResource() { return String(); } |
94 static String initialMarkerEndResource() { return String(); } | 90 static String initialMarkerEndResource() { return String(); } |
95 | 91 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode =
val; } | 143 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode =
val; } |
148 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl
ags._glyphOrientationHorizontal = val; } | 144 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl
ags._glyphOrientationHorizontal = val; } |
149 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag
s._glyphOrientationVertical = val; } | 145 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag
s._glyphOrientationVertical = val; } |
150 | 146 |
151 void setFillOpacity(float obj) | 147 void setFillOpacity(float obj) |
152 { | 148 { |
153 if (!(fill->opacity == obj)) | 149 if (!(fill->opacity == obj)) |
154 fill.access()->opacity = obj; | 150 fill.access()->opacity = obj; |
155 } | 151 } |
156 | 152 |
157 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str
ing& uri) | 153 void setFillPaint(PassRefPtr<SVGPaint> obj) |
158 { | 154 { |
159 if (!(fill->paintType == type)) | 155 if (!(fill->paint == obj)) |
160 fill.access()->paintType = type; | 156 fill.access()->paint = obj; |
161 if (!(fill->paintColor == color)) | |
162 fill.access()->paintColor = color; | |
163 if (!(fill->paintUri == uri)) | |
164 fill.access()->paintUri = uri; | |
165 } | 157 } |
166 | 158 |
167 void setStrokeOpacity(float obj) | 159 void setStrokeOpacity(float obj) |
168 { | 160 { |
169 if (!(stroke->opacity == obj)) | 161 if (!(stroke->opacity == obj)) |
170 stroke.access()->opacity = obj; | 162 stroke.access()->opacity = obj; |
171 } | 163 } |
172 | 164 |
173 void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const S
tring& uri) | 165 void setStrokePaint(PassRefPtr<SVGPaint> obj) |
174 { | 166 { |
175 if (!(stroke->paintType == type)) | 167 if (!(stroke->paint == obj)) |
176 stroke.access()->paintType = type; | 168 stroke.access()->paint = obj; |
177 if (!(stroke->paintColor == color)) | |
178 stroke.access()->paintColor = color; | |
179 if (!(stroke->paintUri == uri)) | |
180 stroke.access()->paintUri = uri; | |
181 } | 169 } |
182 | 170 |
183 void setStrokeDashArray(const Vector<SVGLength>& obj) | 171 void setStrokeDashArray(const Vector<SVGLength>& obj) |
184 { | 172 { |
185 if (!(stroke->dashArray == obj)) | 173 if (!(stroke->dashArray == obj)) |
186 stroke.access()->dashArray = obj; | 174 stroke.access()->dashArray = obj; |
187 } | 175 } |
188 | 176 |
189 void setStrokeMiterLimit(float obj) | 177 void setStrokeMiterLimit(float obj) |
190 { | 178 { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EColorRendering colorRendering() const { return (EColorRendering) svg_inheri
ted_flags._colorRendering; } | 286 EColorRendering colorRendering() const { return (EColorRendering) svg_inheri
ted_flags._colorRendering; } |
299 WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule;
} | 287 WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule;
} |
300 EImageRendering imageRendering() const { return (EImageRendering) svg_inheri
ted_flags._imageRendering; } | 288 EImageRendering imageRendering() const { return (EImageRendering) svg_inheri
ted_flags._imageRendering; } |
301 LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyl
e; } | 289 LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyl
e; } |
302 EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inheri
ted_flags._shapeRendering; } | 290 EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inheri
ted_flags._shapeRendering; } |
303 ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._t
extAnchor; } | 291 ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._t
extAnchor; } |
304 SVGWritingMode writingMode() const { return (SVGWritingMode) svg_inherited_f
lags._writingMode; } | 292 SVGWritingMode writingMode() const { return (SVGWritingMode) svg_inherited_f
lags._writingMode; } |
305 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta
tion) svg_inherited_flags._glyphOrientationHorizontal; } | 293 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta
tion) svg_inherited_flags._glyphOrientationHorizontal; } |
306 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati
on) svg_inherited_flags._glyphOrientationVertical; } | 294 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati
on) svg_inherited_flags._glyphOrientationVertical; } |
307 float fillOpacity() const { return fill->opacity; } | 295 float fillOpacity() const { return fill->opacity; } |
308 const SVGPaint::SVGPaintType& fillPaintType() const { return fill->paintType
; } | 296 SVGPaint* fillPaint() const { return fill->paint.get(); } |
309 const Color& fillPaintColor() const { return fill->paintColor; } | |
310 const String& fillPaintUri() const { return fill->paintUri; } | |
311 float strokeOpacity() const { return stroke->opacity; } | 297 float strokeOpacity() const { return stroke->opacity; } |
312 const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paint
Type; } | 298 SVGPaint* strokePaint() const { return stroke->paint.get(); } |
313 const Color& strokePaintColor() const { return stroke->paintColor; } | |
314 const String& strokePaintUri() const { return stroke->paintUri; } | |
315 Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } | 299 Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } |
316 float strokeMiterLimit() const { return stroke->miterLimit; } | 300 float strokeMiterLimit() const { return stroke->miterLimit; } |
317 SVGLength strokeWidth() const { return stroke->width; } | 301 SVGLength strokeWidth() const { return stroke->width; } |
318 SVGLength strokeDashOffset() const { return stroke->dashOffset; } | 302 SVGLength strokeDashOffset() const { return stroke->dashOffset; } |
319 SVGLength kerning() const { return text->kerning; } | 303 SVGLength kerning() const { return text->kerning; } |
320 float stopOpacity() const { return stops->opacity; } | 304 float stopOpacity() const { return stops->opacity; } |
321 Color stopColor() const { return stops->color; } | 305 Color stopColor() const { return stops->color; } |
322 float floodOpacity() const { return misc->floodOpacity; } | 306 float floodOpacity() const { return misc->floodOpacity; } |
323 Color floodColor() const { return misc->floodColor; } | 307 Color floodColor() const { return misc->floodColor; } |
324 Color lightingColor() const { return misc->lightingColor; } | 308 Color lightingColor() const { return misc->lightingColor; } |
325 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } | 309 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } |
326 ShadowData* shadow() const { return shadowSVG->shadow.get(); } | 310 ShadowData* shadow() const { return shadowSVG->shadow.get(); } |
327 String clipperResource() const { return resources->clipper; } | 311 String clipperResource() const { return resources->clipper; } |
328 String filterResource() const { return resources->filter; } | 312 String filterResource() const { return resources->filter; } |
329 String maskerResource() const { return resources->masker; } | 313 String maskerResource() const { return resources->masker; } |
330 String markerStartResource() const { return inheritedResources->markerStart;
} | 314 String markerStartResource() const { return inheritedResources->markerStart;
} |
331 String markerMidResource() const { return inheritedResources->markerMid; } | 315 String markerMidResource() const { return inheritedResources->markerMid; } |
332 String markerEndResource() const { return inheritedResources->markerEnd; } | 316 String markerEndResource() const { return inheritedResources->markerEnd; } |
333 | 317 |
334 // convenience | 318 // convenience |
335 bool hasClipper() const { return !clipperResource().isEmpty(); } | 319 bool hasClipper() const { return !clipperResource().isEmpty(); } |
336 bool hasMasker() const { return !maskerResource().isEmpty(); } | 320 bool hasMasker() const { return !maskerResource().isEmpty(); } |
337 bool hasFilter() const { return !filterResource().isEmpty(); } | 321 bool hasFilter() const { return !filterResource().isEmpty(); } |
338 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } | 322 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } |
339 bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE
_NONE; } | 323 bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_
PAINTTYPE_NONE; } |
340 bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NON
E; } | 324 bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAIN
TTYPE_NONE; } |
341 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } | 325 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } |
342 | 326 |
343 protected: | 327 protected: |
344 // inherit | 328 // inherit |
345 struct InheritedFlags { | 329 struct InheritedFlags { |
346 bool operator==(const InheritedFlags& other) const | 330 bool operator==(const InheritedFlags& other) const |
347 { | 331 { |
348 return (_colorRendering == other._colorRendering) | 332 return (_colorRendering == other._colorRendering) |
349 && (_imageRendering == other._imageRendering) | 333 && (_imageRendering == other._imageRendering) |
350 && (_shapeRendering == other._shapeRendering) | 334 && (_shapeRendering == other._shapeRendering) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); | 422 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); |
439 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); | 423 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); |
440 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); | 424 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); |
441 } | 425 } |
442 }; | 426 }; |
443 | 427 |
444 } // namespace WebCore | 428 } // namespace WebCore |
445 | 429 |
446 #endif // ENABLE(SVG) | 430 #endif // ENABLE(SVG) |
447 #endif // SVGRenderStyle_h | 431 #endif // SVGRenderStyle_h |
OLD | NEW |