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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 static SVGPaintType initialFillPaintType() { return SVG_PAINTTYPE_RGBCOLOR;
} | 71 static SVGPaintType initialFillPaintType() { return SVG_PAINTTYPE_RGBCOLOR;
} |
72 static Color initialFillPaintColor() { return Color::black; } | 72 static Color initialFillPaintColor() { return Color::black; } |
73 static String initialFillPaintUri() { return String(); } | 73 static String initialFillPaintUri() { return String(); } |
74 static float initialStrokeOpacity() { return 1; } | 74 static float initialStrokeOpacity() { return 1; } |
75 static SVGPaintType initialStrokePaintType() { return SVG_PAINTTYPE_NONE; } | 75 static SVGPaintType initialStrokePaintType() { return SVG_PAINTTYPE_NONE; } |
76 static Color initialStrokePaintColor() { return Color(); } | 76 static Color initialStrokePaintColor() { return Color(); } |
77 static String initialStrokePaintUri() { return String(); } | 77 static String initialStrokePaintUri() { return String(); } |
78 static PassRefPtr<SVGDashArray> initialStrokeDashArray(); | 78 static PassRefPtr<SVGDashArray> initialStrokeDashArray(); |
79 static Length initialStrokeDashOffset() { return Length(Fixed); } | 79 static Length initialStrokeDashOffset() { return Length(Fixed); } |
80 static float initialStrokeMiterLimit() { return 4; } | 80 static float initialStrokeMiterLimit() { return 4; } |
| 81 static UnzoomedLength initialStrokeWidth() { return UnzoomedLength(Length(1,
Fixed)); } |
81 static float initialStopOpacity() { return 1; } | 82 static float initialStopOpacity() { return 1; } |
82 static Color initialStopColor() { return Color(0, 0, 0); } | 83 static Color initialStopColor() { return Color(0, 0, 0); } |
83 static float initialFloodOpacity() { return 1; } | 84 static float initialFloodOpacity() { return 1; } |
84 static Color initialFloodColor() { return Color(0, 0, 0); } | 85 static Color initialFloodColor() { return Color(0, 0, 0); } |
85 static Color initialLightingColor() { return Color(255, 255, 255); } | 86 static Color initialLightingColor() { return Color(255, 255, 255); } |
86 static const AtomicString& initialClipperResource() { return nullAtom; } | 87 static const AtomicString& initialClipperResource() { return nullAtom; } |
87 static const AtomicString& initialFilterResource() { return nullAtom; } | 88 static const AtomicString& initialFilterResource() { return nullAtom; } |
88 static const AtomicString& initialMaskerResource() { return nullAtom; } | 89 static const AtomicString& initialMaskerResource() { return nullAtom; } |
89 static const AtomicString& initialMarkerStartResource() { return nullAtom; } | 90 static const AtomicString& initialMarkerStartResource() { return nullAtom; } |
90 static const AtomicString& initialMarkerMidResource() { return nullAtom; } | 91 static const AtomicString& initialMarkerMidResource() { return nullAtom; } |
91 static const AtomicString& initialMarkerEndResource() { return nullAtom; } | 92 static const AtomicString& initialMarkerEndResource() { return nullAtom; } |
92 static EMaskType initialMaskType() { return MT_LUMINANCE; } | 93 static EMaskType initialMaskType() { return MT_LUMINANCE; } |
93 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } | 94 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } |
94 static Length initialX() { return Length(Fixed); } | 95 static Length initialX() { return Length(Fixed); } |
95 static Length initialY() { return Length(Fixed); } | 96 static Length initialY() { return Length(Fixed); } |
96 static Length initialRx() { return Length(Fixed); } | 97 static Length initialRx() { return Length(Fixed); } |
97 static Length initialRy() { return Length(Fixed); } | 98 static Length initialRy() { return Length(Fixed); } |
98 | 99 |
99 static PassRefPtrWillBeRawPtr<SVGLength> initialStrokeWidth() | |
100 { | |
101 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(); | |
102 length->newValueSpecifiedUnits(LengthTypeNumber, 1); | |
103 return length.release(); | |
104 } | |
105 | |
106 // SVG CSS Property setters | 100 // SVG CSS Property setters |
107 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f
._alignmentBaseline = val; } | 101 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f
._alignmentBaseline = val; } |
108 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._
dominantBaseline = val; } | 102 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._
dominantBaseline = val; } |
109 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli
neShift = val; } | 103 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli
neShift = val; } |
110 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf
fect = val; } | 104 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf
fect = val; } |
111 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f
.bufferedRendering = val; } | 105 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f
.bufferedRendering = val; } |
112 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } | 106 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } |
113 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } | 107 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } |
114 void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._c
olorInterpolation = val; } | 108 void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._c
olorInterpolation = val; } |
115 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f
lags._colorInterpolationFilters = val; } | 109 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f
lags._colorInterpolationFilters = val; } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (*stroke->dashArray != *dashArray) | 194 if (*stroke->dashArray != *dashArray) |
201 stroke.access()->dashArray = dashArray; | 195 stroke.access()->dashArray = dashArray; |
202 } | 196 } |
203 | 197 |
204 void setStrokeMiterLimit(float obj) | 198 void setStrokeMiterLimit(float obj) |
205 { | 199 { |
206 if (!(stroke->miterLimit == obj)) | 200 if (!(stroke->miterLimit == obj)) |
207 stroke.access()->miterLimit = obj; | 201 stroke.access()->miterLimit = obj; |
208 } | 202 } |
209 | 203 |
210 void setStrokeWidth(PassRefPtrWillBeRawPtr<SVGLength> obj) | 204 void setStrokeWidth(const UnzoomedLength& strokeWidth) |
211 { | 205 { |
212 if (*stroke->width != *obj) | 206 if (!(stroke->width == strokeWidth)) |
213 stroke.access()->width = obj; | 207 stroke.access()->width = strokeWidth; |
214 } | 208 } |
215 | 209 |
216 void setStrokeDashOffset(const Length& dashOffset) | 210 void setStrokeDashOffset(const Length& dashOffset) |
217 { | 211 { |
218 if (!(stroke->dashOffset == dashOffset)) | 212 if (!(stroke->dashOffset == dashOffset)) |
219 stroke.access()->dashOffset = dashOffset; | 213 stroke.access()->dashOffset = dashOffset; |
220 } | 214 } |
221 | 215 |
222 void setStopOpacity(float obj) | 216 void setStopOpacity(float obj) |
223 { | 217 { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 float fillOpacity() const { return fill->opacity; } | 308 float fillOpacity() const { return fill->opacity; } |
315 const SVGPaintType& fillPaintType() const { return fill->paintType; } | 309 const SVGPaintType& fillPaintType() const { return fill->paintType; } |
316 const Color& fillPaintColor() const { return fill->paintColor; } | 310 const Color& fillPaintColor() const { return fill->paintColor; } |
317 const String& fillPaintUri() const { return fill->paintUri; } | 311 const String& fillPaintUri() const { return fill->paintUri; } |
318 float strokeOpacity() const { return stroke->opacity; } | 312 float strokeOpacity() const { return stroke->opacity; } |
319 const SVGPaintType& strokePaintType() const { return stroke->paintType; } | 313 const SVGPaintType& strokePaintType() const { return stroke->paintType; } |
320 const Color& strokePaintColor() const { return stroke->paintColor; } | 314 const Color& strokePaintColor() const { return stroke->paintColor; } |
321 const String& strokePaintUri() const { return stroke->paintUri; } | 315 const String& strokePaintUri() const { return stroke->paintUri; } |
322 SVGDashArray* strokeDashArray() const { return stroke->dashArray.get(); } | 316 SVGDashArray* strokeDashArray() const { return stroke->dashArray.get(); } |
323 float strokeMiterLimit() const { return stroke->miterLimit; } | 317 float strokeMiterLimit() const { return stroke->miterLimit; } |
324 SVGLength* strokeWidth() const { return stroke->width.get(); } | 318 const UnzoomedLength& strokeWidth() const { return stroke->width; } |
325 const Length& strokeDashOffset() const { return stroke->dashOffset; } | 319 const Length& strokeDashOffset() const { return stroke->dashOffset; } |
326 float stopOpacity() const { return stops->opacity; } | 320 float stopOpacity() const { return stops->opacity; } |
327 const Color& stopColor() const { return stops->color; } | 321 const Color& stopColor() const { return stops->color; } |
328 float floodOpacity() const { return misc->floodOpacity; } | 322 float floodOpacity() const { return misc->floodOpacity; } |
329 const Color& floodColor() const { return misc->floodColor; } | 323 const Color& floodColor() const { return misc->floodColor; } |
330 const Color& lightingColor() const { return misc->lightingColor; } | 324 const Color& lightingColor() const { return misc->lightingColor; } |
331 const Length& baselineShiftValue() const { return misc->baselineShiftValue;
} | 325 const Length& baselineShiftValue() const { return misc->baselineShiftValue;
} |
332 const Length& x() const { return layout->x; } | 326 const Length& x() const { return layout->x; } |
333 const Length& y() const { return layout->y; } | 327 const Length& y() const { return layout->y; } |
334 const Length& rx() const { return layout->rx; } | 328 const Length& rx() const { return layout->rx; } |
(...skipping 14 matching lines...) Expand all Loading... |
349 const SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visi
tedLinkPaintType; } | 343 const SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visi
tedLinkPaintType; } |
350 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin
kPaintColor; } | 344 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin
kPaintColor; } |
351 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink
PaintUri; } | 345 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink
PaintUri; } |
352 | 346 |
353 // convenience | 347 // convenience |
354 bool hasClipper() const { return !clipperResource().isEmpty(); } | 348 bool hasClipper() const { return !clipperResource().isEmpty(); } |
355 bool hasMasker() const { return !maskerResource().isEmpty(); } | 349 bool hasMasker() const { return !maskerResource().isEmpty(); } |
356 bool hasFilter() const { return !filterResource().isEmpty(); } | 350 bool hasFilter() const { return !filterResource().isEmpty(); } |
357 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } | 351 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } |
358 bool hasStroke() const { return strokePaintType() != SVG_PAINTTYPE_NONE; } | 352 bool hasStroke() const { return strokePaintType() != SVG_PAINTTYPE_NONE; } |
359 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth()->isZero
(); } | 353 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth().isZero(
); } |
360 bool hasFill() const { return fillPaintType() != SVG_PAINTTYPE_NONE; } | 354 bool hasFill() const { return fillPaintType() != SVG_PAINTTYPE_NONE; } |
361 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } | 355 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } |
362 | 356 |
363 protected: | 357 protected: |
364 // inherit | 358 // inherit |
365 struct InheritedFlags { | 359 struct InheritedFlags { |
366 bool operator==(const InheritedFlags& other) const | 360 bool operator==(const InheritedFlags& other) const |
367 { | 361 { |
368 return (_colorRendering == other._colorRendering) | 362 return (_colorRendering == other._colorRendering) |
369 && (_shapeRendering == other._shapeRendering) | 363 && (_shapeRendering == other._shapeRendering) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); | 457 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); |
464 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); | 458 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); |
465 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); | 459 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); |
466 svg_noninherited_flags.f.maskType = initialMaskType(); | 460 svg_noninherited_flags.f.maskType = initialMaskType(); |
467 } | 461 } |
468 }; | 462 }; |
469 | 463 |
470 } // namespace blink | 464 } // namespace blink |
471 | 465 |
472 #endif // SVGLayoutStyle_h | 466 #endif // SVGLayoutStyle_h |
OLD | NEW |