| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE
G; } | 72 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE
G; } |
| 73 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO;
} | 73 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO;
} |
| 74 static float initialFillOpacity() { return 1; } | 74 static float initialFillOpacity() { return 1; } |
| 75 static SVGPaint::SVGPaintType initialFillPaintType() { return SVGPaint::SVG_
PAINTTYPE_RGBCOLOR; } | 75 static SVGPaint::SVGPaintType initialFillPaintType() { return SVGPaint::SVG_
PAINTTYPE_RGBCOLOR; } |
| 76 static Color initialFillPaintColor() { return Color::black; } | 76 static Color initialFillPaintColor() { return Color::black; } |
| 77 static String initialFillPaintUri() { return String(); } | 77 static String initialFillPaintUri() { return String(); } |
| 78 static float initialStrokeOpacity() { return 1; } | 78 static float initialStrokeOpacity() { return 1; } |
| 79 static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SV
G_PAINTTYPE_NONE; } | 79 static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SV
G_PAINTTYPE_NONE; } |
| 80 static Color initialStrokePaintColor() { return Color(); } | 80 static Color initialStrokePaintColor() { return Color(); } |
| 81 static String initialStrokePaintUri() { return String(); } | 81 static String initialStrokePaintUri() { return String(); } |
| 82 static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>
(); } | 82 static PassRefPtr<SVGLengthList> initialStrokeDashArray() { return SVGLength
List::create(); } |
| 83 static float initialStrokeMiterLimit() { return 4; } | 83 static float initialStrokeMiterLimit() { return 4; } |
| 84 static float initialStopOpacity() { return 1; } | 84 static float initialStopOpacity() { return 1; } |
| 85 static Color initialStopColor() { return Color(0, 0, 0); } | 85 static Color initialStopColor() { return Color(0, 0, 0); } |
| 86 static float initialFloodOpacity() { return 1; } | 86 static float initialFloodOpacity() { return 1; } |
| 87 static Color initialFloodColor() { return Color(0, 0, 0); } | 87 static Color initialFloodColor() { return Color(0, 0, 0); } |
| 88 static Color initialLightingColor() { return Color(255, 255, 255); } | 88 static Color initialLightingColor() { return Color(255, 255, 255); } |
| 89 static const AtomicString& initialClipperResource() { return nullAtom; } | 89 static const AtomicString& initialClipperResource() { return nullAtom; } |
| 90 static const AtomicString& initialFilterResource() { return nullAtom; } | 90 static const AtomicString& initialFilterResource() { return nullAtom; } |
| 91 static const AtomicString& initialMaskerResource() { return nullAtom; } | 91 static const AtomicString& initialMaskerResource() { return nullAtom; } |
| 92 static String initialMarkerStartResource() { return String(); } | 92 static String initialMarkerStartResource() { return String(); } |
| 93 static String initialMarkerMidResource() { return String(); } | 93 static String initialMarkerMidResource() { return String(); } |
| 94 static String initialMarkerEndResource() { return String(); } | 94 static String initialMarkerEndResource() { return String(); } |
| 95 static EMaskType initialMaskType() { return MT_LUMINANCE; } | 95 static EMaskType initialMaskType() { return MT_LUMINANCE; } |
| 96 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } | 96 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } |
| 97 | 97 |
| 98 static SVGLength initialBaselineShiftValue() | 98 static PassRefPtr<SVGLength> initialBaselineShiftValue() |
| 99 { | 99 { |
| 100 SVGLength length; | 100 RefPtr<SVGLength> length = SVGLength::create(); |
| 101 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION); | 101 length->newValueSpecifiedUnits(LengthTypeNumber, 0); |
| 102 return length; | 102 return length.release(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 static SVGLength initialKerning() | 105 static PassRefPtr<SVGLength> initialKerning() |
| 106 { | 106 { |
| 107 SVGLength length; | 107 RefPtr<SVGLength> length = SVGLength::create(); |
| 108 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION); | 108 length->newValueSpecifiedUnits(LengthTypeNumber, 0); |
| 109 return length; | 109 return length.release(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 static SVGLength initialStrokeDashOffset() | 112 static PassRefPtr<SVGLength> initialStrokeDashOffset() |
| 113 { | 113 { |
| 114 SVGLength length; | 114 RefPtr<SVGLength> length = SVGLength::create(); |
| 115 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION); | 115 length->newValueSpecifiedUnits(LengthTypeNumber, 0); |
| 116 return length; | 116 return length.release(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 static SVGLength initialStrokeWidth() | 119 static PassRefPtr<SVGLength> initialStrokeWidth() |
| 120 { | 120 { |
| 121 SVGLength length; | 121 RefPtr<SVGLength> length = SVGLength::create(); |
| 122 length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION); | 122 length->newValueSpecifiedUnits(LengthTypeNumber, 1); |
| 123 return length; | 123 return length.release(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // SVG CSS Property setters | 126 // SVG CSS Property setters |
| 127 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f
._alignmentBaseline = val; } | 127 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f
._alignmentBaseline = val; } |
| 128 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._
dominantBaseline = val; } | 128 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._
dominantBaseline = val; } |
| 129 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli
neShift = val; } | 129 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli
neShift = val; } |
| 130 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf
fect = val; } | 130 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf
fect = val; } |
| 131 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f
.bufferedRendering = val; } | 131 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f
.bufferedRendering = val; } |
| 132 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } | 132 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } |
| 133 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } | 133 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (applyToVisitedLinkStyle) { | 189 if (applyToVisitedLinkStyle) { |
| 190 if (!(stroke->visitedLinkPaintType == type)) | 190 if (!(stroke->visitedLinkPaintType == type)) |
| 191 stroke.access()->visitedLinkPaintType = type; | 191 stroke.access()->visitedLinkPaintType = type; |
| 192 if (!(stroke->visitedLinkPaintColor == color)) | 192 if (!(stroke->visitedLinkPaintColor == color)) |
| 193 stroke.access()->visitedLinkPaintColor = color; | 193 stroke.access()->visitedLinkPaintColor = color; |
| 194 if (!(stroke->visitedLinkPaintUri == uri)) | 194 if (!(stroke->visitedLinkPaintUri == uri)) |
| 195 stroke.access()->visitedLinkPaintUri = uri; | 195 stroke.access()->visitedLinkPaintUri = uri; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void setStrokeDashArray(const Vector<SVGLength>& obj) | 199 void setStrokeDashArray(PassRefPtr<SVGLengthList> obj) |
| 200 { | 200 { |
| 201 if (!(stroke->dashArray == obj)) | 201 if (!(stroke->dashArray == obj)) |
| 202 stroke.access()->dashArray = obj; | 202 stroke.access()->dashArray = obj; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void setStrokeMiterLimit(float obj) | 205 void setStrokeMiterLimit(float obj) |
| 206 { | 206 { |
| 207 if (!(stroke->miterLimit == obj)) | 207 if (!(stroke->miterLimit == obj)) |
| 208 stroke.access()->miterLimit = obj; | 208 stroke.access()->miterLimit = obj; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void setStrokeWidth(const SVGLength& obj) | 211 void setStrokeWidth(PassRefPtr<SVGLength> obj) |
| 212 { | 212 { |
| 213 if (!(stroke->width == obj)) | 213 if (!(stroke->width == obj)) |
| 214 stroke.access()->width = obj; | 214 stroke.access()->width = obj; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void setStrokeDashOffset(const SVGLength& obj) | 217 void setStrokeDashOffset(PassRefPtr<SVGLength> obj) |
| 218 { | 218 { |
| 219 if (!(stroke->dashOffset == obj)) | 219 if (!(stroke->dashOffset == obj)) |
| 220 stroke.access()->dashOffset = obj; | 220 stroke.access()->dashOffset = obj; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void setKerning(const SVGLength& obj) | 223 void setKerning(PassRefPtr<SVGLength> obj) |
| 224 { | 224 { |
| 225 if (!(text->kerning == obj)) | 225 if (!(text->kerning == obj)) |
| 226 text.access()->kerning = obj; | 226 text.access()->kerning = obj; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void setStopOpacity(float obj) | 229 void setStopOpacity(float obj) |
| 230 { | 230 { |
| 231 if (!(stops->opacity == obj)) | 231 if (!(stops->opacity == obj)) |
| 232 stops.access()->opacity = obj; | 232 stops.access()->opacity = obj; |
| 233 } | 233 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 249 if (!(misc->floodColor == obj)) | 249 if (!(misc->floodColor == obj)) |
| 250 misc.access()->floodColor = obj; | 250 misc.access()->floodColor = obj; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void setLightingColor(const Color& obj) | 253 void setLightingColor(const Color& obj) |
| 254 { | 254 { |
| 255 if (!(misc->lightingColor == obj)) | 255 if (!(misc->lightingColor == obj)) |
| 256 misc.access()->lightingColor = obj; | 256 misc.access()->lightingColor = obj; |
| 257 } | 257 } |
| 258 | 258 |
| 259 void setBaselineShiftValue(const SVGLength& obj) | 259 void setBaselineShiftValue(PassRefPtr<SVGLength> obj) |
| 260 { | 260 { |
| 261 if (!(misc->baselineShiftValue == obj)) | 261 if (!(misc->baselineShiftValue == obj)) |
| 262 misc.access()->baselineShiftValue = obj; | 262 misc.access()->baselineShiftValue = obj; |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Setters for non-inherited resources | 265 // Setters for non-inherited resources |
| 266 void setClipperResource(const AtomicString& obj) | 266 void setClipperResource(const AtomicString& obj) |
| 267 { | 267 { |
| 268 if (!(resources->clipper == obj)) | 268 if (!(resources->clipper == obj)) |
| 269 resources.access()->clipper = obj; | 269 resources.access()->clipper = obj; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta
tion) svg_inherited_flags._glyphOrientationHorizontal; } | 319 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta
tion) svg_inherited_flags._glyphOrientationHorizontal; } |
| 320 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati
on) svg_inherited_flags._glyphOrientationVertical; } | 320 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati
on) svg_inherited_flags._glyphOrientationVertical; } |
| 321 float fillOpacity() const { return fill->opacity; } | 321 float fillOpacity() const { return fill->opacity; } |
| 322 const SVGPaint::SVGPaintType& fillPaintType() const { return fill->paintType
; } | 322 const SVGPaint::SVGPaintType& fillPaintType() const { return fill->paintType
; } |
| 323 const Color& fillPaintColor() const { return fill->paintColor; } | 323 const Color& fillPaintColor() const { return fill->paintColor; } |
| 324 const String& fillPaintUri() const { return fill->paintUri; } | 324 const String& fillPaintUri() const { return fill->paintUri; } |
| 325 float strokeOpacity() const { return stroke->opacity; } | 325 float strokeOpacity() const { return stroke->opacity; } |
| 326 const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paint
Type; } | 326 const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paint
Type; } |
| 327 const Color& strokePaintColor() const { return stroke->paintColor; } | 327 const Color& strokePaintColor() const { return stroke->paintColor; } |
| 328 const String& strokePaintUri() const { return stroke->paintUri; } | 328 const String& strokePaintUri() const { return stroke->paintUri; } |
| 329 Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } | 329 PassRefPtr<SVGLengthList> strokeDashArray() const { return stroke->dashArray
; } |
| 330 float strokeMiterLimit() const { return stroke->miterLimit; } | 330 float strokeMiterLimit() const { return stroke->miterLimit; } |
| 331 SVGLength strokeWidth() const { return stroke->width; } | 331 PassRefPtr<SVGLength> strokeWidth() const { return stroke->width; } |
| 332 SVGLength strokeDashOffset() const { return stroke->dashOffset; } | 332 PassRefPtr<SVGLength> strokeDashOffset() const { return stroke->dashOffset;
} |
| 333 SVGLength kerning() const { return text->kerning; } | 333 PassRefPtr<SVGLength> kerning() const { return text->kerning; } |
| 334 float stopOpacity() const { return stops->opacity; } | 334 float stopOpacity() const { return stops->opacity; } |
| 335 const Color& stopColor() const { return stops->color; } | 335 const Color& stopColor() const { return stops->color; } |
| 336 float floodOpacity() const { return misc->floodOpacity; } | 336 float floodOpacity() const { return misc->floodOpacity; } |
| 337 const Color& floodColor() const { return misc->floodColor; } | 337 const Color& floodColor() const { return misc->floodColor; } |
| 338 const Color& lightingColor() const { return misc->lightingColor; } | 338 const Color& lightingColor() const { return misc->lightingColor; } |
| 339 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } | 339 PassRefPtr<SVGLength> baselineShiftValue() const { return misc->baselineShif
tValue; } |
| 340 const AtomicString& clipperResource() const { return resources->clipper; } | 340 const AtomicString& clipperResource() const { return resources->clipper; } |
| 341 const AtomicString& filterResource() const { return resources->filter; } | 341 const AtomicString& filterResource() const { return resources->filter; } |
| 342 const AtomicString& maskerResource() const { return resources->masker; } | 342 const AtomicString& maskerResource() const { return resources->masker; } |
| 343 String markerStartResource() const { return inheritedResources->markerStart;
} | 343 String markerStartResource() const { return inheritedResources->markerStart;
} |
| 344 String markerMidResource() const { return inheritedResources->markerMid; } | 344 String markerMidResource() const { return inheritedResources->markerMid; } |
| 345 String markerEndResource() const { return inheritedResources->markerEnd; } | 345 String markerEndResource() const { return inheritedResources->markerEnd; } |
| 346 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas
kType; } | 346 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas
kType; } |
| 347 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p
aintOrder; } | 347 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p
aintOrder; } |
| 348 EPaintOrderType paintOrderType(unsigned index) const; | 348 EPaintOrderType paintOrderType(unsigned index) const; |
| 349 | 349 |
| 350 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill
->visitedLinkPaintType; } | 350 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill
->visitedLinkPaintType; } |
| 351 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai
ntColor; } | 351 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai
ntColor; } |
| 352 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain
tUri; } | 352 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain
tUri; } |
| 353 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st
roke->visitedLinkPaintType; } | 353 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st
roke->visitedLinkPaintType; } |
| 354 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin
kPaintColor; } | 354 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin
kPaintColor; } |
| 355 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink
PaintUri; } | 355 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink
PaintUri; } |
| 356 | 356 |
| 357 // convenience | 357 // convenience |
| 358 bool hasClipper() const { return !clipperResource().isEmpty(); } | 358 bool hasClipper() const { return !clipperResource().isEmpty(); } |
| 359 bool hasMasker() const { return !maskerResource().isEmpty(); } | 359 bool hasMasker() const { return !maskerResource().isEmpty(); } |
| 360 bool hasFilter() const { return !filterResource().isEmpty(); } | 360 bool hasFilter() const { return !filterResource().isEmpty(); } |
| 361 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } | 361 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker
MidResource().isEmpty() || !markerEndResource().isEmpty(); } |
| 362 bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE
_NONE; } | 362 bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE
_NONE; } |
| 363 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth().isZero(
); } | 363 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth()->isZero
(); } |
| 364 bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NON
E; } | 364 bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NON
E; } |
| 365 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } | 365 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ
ingMode() == WM_TB; } |
| 366 | 366 |
| 367 protected: | 367 protected: |
| 368 // inherit | 368 // inherit |
| 369 struct InheritedFlags { | 369 struct InheritedFlags { |
| 370 bool operator==(const InheritedFlags& other) const | 370 bool operator==(const InheritedFlags& other) const |
| 371 { | 371 { |
| 372 return (_colorRendering == other._colorRendering) | 372 return (_colorRendering == other._colorRendering) |
| 373 && (_shapeRendering == other._shapeRendering) | 373 && (_shapeRendering == other._shapeRendering) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); | 464 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); |
| 465 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); | 465 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); |
| 466 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); | 466 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); |
| 467 svg_noninherited_flags.f.maskType = initialMaskType(); | 467 svg_noninherited_flags.f.maskType = initialMaskType(); |
| 468 } | 468 } |
| 469 }; | 469 }; |
| 470 | 470 |
| 471 } // namespace WebCore | 471 } // namespace WebCore |
| 472 | 472 |
| 473 #endif // SVGRenderStyle_h | 473 #endif // SVGRenderStyle_h |
| OLD | NEW |