OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 { | 60 { |
61 } | 61 } |
62 | 62 |
63 void SVGPaint::setUri(const String& uri) | 63 void SVGPaint::setUri(const String& uri) |
64 { | 64 { |
65 // Spec: Sets the paintType to SVG_PAINTTYPE_URI_NONE and sets uri to the sp
ecified value. | 65 // Spec: Sets the paintType to SVG_PAINTTYPE_URI_NONE and sets uri to the sp
ecified value. |
66 m_uri = uri; | 66 m_uri = uri; |
67 m_paintType = SVG_PAINTTYPE_URI_NONE; | 67 m_paintType = SVG_PAINTTYPE_URI_NONE; |
68 setColor(Color()); | 68 setColor(Color()); |
69 setColorType(colorTypeForPaintType(m_paintType)); | 69 setColorType(colorTypeForPaintType(m_paintType)); |
70 setNeedsStyleRecalc(); | 70 // FIXME: A follow up patch will call valueChanged() here. |
| 71 } |
| 72 |
| 73 SVGPaint* SVGPaint::defaultFill() |
| 74 { |
| 75 static SVGPaint* staticDefaultFill = createColor(Color::black).releaseRef(); |
| 76 return staticDefaultFill; |
| 77 } |
| 78 |
| 79 SVGPaint* SVGPaint::defaultStroke() |
| 80 { |
| 81 static SVGPaint* staticDefaultStroke = createNone().releaseRef(); |
| 82 return staticDefaultStroke; |
71 } | 83 } |
72 | 84 |
73 void SVGPaint::setPaint(unsigned short paintType, const String& uri, const Strin
g& rgbColor, const String& iccColor, ExceptionCode& ec) | 85 void SVGPaint::setPaint(unsigned short paintType, const String& uri, const Strin
g& rgbColor, const String& iccColor, ExceptionCode& ec) |
74 { | 86 { |
75 if ((paintType > SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR && paintType < SVG_PAINTTYP
E_NONE) || paintType > SVG_PAINTTYPE_URI) { | 87 if ((paintType > SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR && paintType < SVG_PAINTTYP
E_NONE) || paintType > SVG_PAINTTYPE_URI) { |
76 ec = SVGException::SVG_WRONG_TYPE_ERR; | 88 ec = SVGException::SVG_WRONG_TYPE_ERR; |
77 return; | 89 return; |
78 } | 90 } |
79 | 91 |
80 bool requiresURI = false; | 92 bool requiresURI = false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 setColorType(colorType); | 125 setColorType(colorType); |
114 setColor(Color()); | 126 setColor(Color()); |
115 } else { | 127 } else { |
116 setColor(colorType, rgbColor, iccColor, ec); | 128 setColor(colorType, rgbColor, iccColor, ec); |
117 if (ec) | 129 if (ec) |
118 return; | 130 return; |
119 } | 131 } |
120 | 132 |
121 m_paintType = type; | 133 m_paintType = type; |
122 m_uri = requiresURI ? uri : String(); | 134 m_uri = requiresURI ? uri : String(); |
123 setNeedsStyleRecalc(); | 135 // FIXME: A follow up patch will call valueChanged() here. |
124 } | 136 } |
125 | 137 |
126 String SVGPaint::cssText() const | 138 String SVGPaint::cssText() const |
127 { | 139 { |
128 switch (m_paintType) { | 140 switch (m_paintType) { |
129 case SVG_PAINTTYPE_UNKNOWN: | 141 case SVG_PAINTTYPE_UNKNOWN: |
130 case SVG_PAINTTYPE_RGBCOLOR: | 142 case SVG_PAINTTYPE_RGBCOLOR: |
131 case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: | 143 case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: |
132 case SVG_PAINTTYPE_CURRENTCOLOR: | 144 case SVG_PAINTTYPE_CURRENTCOLOR: |
133 return SVGColor::cssText(); | 145 return SVGColor::cssText(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return referenceId == SVGURIReference::getTarget(m_uri); | 180 return referenceId == SVGURIReference::getTarget(m_uri); |
169 } | 181 } |
170 | 182 |
171 ASSERT_NOT_REACHED(); | 183 ASSERT_NOT_REACHED(); |
172 return false; | 184 return false; |
173 } | 185 } |
174 | 186 |
175 } | 187 } |
176 | 188 |
177 #endif // ENABLE(SVG) | 189 #endif // ENABLE(SVG) |
OLD | NEW |