| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 2 Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 2004, 2005, 2007, 2010 Rob Buis <buis@kde.org> | 4 2004, 2005, 2007, 2010 Rob Buis <buis@kde.org> |
| 5 Copyright (C) 2005, 2006 Apple Computer, Inc. | 5 Copyright (C) 2005, 2006 Apple Computer, Inc. |
| 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 18 matching lines...) Expand all Loading... |
| 29 #include "CSSPropertyNames.h" | 29 #include "CSSPropertyNames.h" |
| 30 #include "CSSValueKeywords.h" | 30 #include "CSSValueKeywords.h" |
| 31 #include "CSSValueList.h" | 31 #include "CSSValueList.h" |
| 32 #include "RenderTheme.h" | 32 #include "RenderTheme.h" |
| 33 #include "SVGPaint.h" | 33 #include "SVGPaint.h" |
| 34 | 34 |
| 35 using namespace std; | 35 using namespace std; |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 static bool isSystemColor(int id) |
| 40 { |
| 41 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS
ValueMenu; |
| 42 } |
| 43 |
| 39 bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important) | 44 bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important) |
| 40 { | 45 { |
| 41 CSSParserValue* value = m_valueList->current(); | 46 CSSParserValue* value = m_valueList->current(); |
| 42 if (!value) | 47 if (!value) |
| 43 return false; | 48 return false; |
| 44 | 49 |
| 45 int id = value->id; | 50 int id = value->id; |
| 46 | 51 |
| 47 bool valid_primitive = false; | 52 bool valid_primitive = false; |
| 48 RefPtr<CSSValue> parsedValue; | 53 RefPtr<CSSValue> parsedValue; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 183 } |
| 179 break; | 184 break; |
| 180 | 185 |
| 181 case CSSPropertyFill: // <paint> | inherit | 186 case CSSPropertyFill: // <paint> | inherit |
| 182 case CSSPropertyStroke: // <paint> | inherit | 187 case CSSPropertyStroke: // <paint> | inherit |
| 183 { | 188 { |
| 184 if (id == CSSValueNone) | 189 if (id == CSSValueNone) |
| 185 parsedValue = SVGPaint::createNone(); | 190 parsedValue = SVGPaint::createNone(); |
| 186 else if (id == CSSValueCurrentcolor) | 191 else if (id == CSSValueCurrentcolor) |
| 187 parsedValue = SVGPaint::createCurrentColor(); | 192 parsedValue = SVGPaint::createCurrentColor(); |
| 188 else if ((id >= CSSValueActiveborder && id <= CSSValueWindowtext) ||
id == CSSValueMenu) | 193 else if (isSystemColor(id)) |
| 189 parsedValue = SVGPaint::createColor(RenderTheme::defaultTheme()-
>systemColor(id)); | 194 parsedValue = SVGPaint::createColor(RenderTheme::defaultTheme()-
>systemColor(id)); |
| 190 else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 195 else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
| 191 RGBA32 c = Color::transparent; | 196 RGBA32 c = Color::transparent; |
| 192 if (m_valueList->next()) { | 197 if (m_valueList->next()) { |
| 193 if (parseColorFromValue(m_valueList->current(), c)) | 198 if (parseColorFromValue(m_valueList->current(), c)) |
| 194 parsedValue = SVGPaint::createURIAndColor(value->string,
c); | 199 parsedValue = SVGPaint::createURIAndColor(value->string,
c); |
| 195 else if (m_valueList->current()->id == CSSValueNone) | 200 else if (m_valueList->current()->id == CSSValueNone) |
| 196 parsedValue = SVGPaint::createURIAndNone(value->string); | 201 parsedValue = SVGPaint::createURIAndNone(value->string); |
| 197 } | 202 } |
| 198 if (!parsedValue) | 203 if (!parsedValue) |
| 199 parsedValue = SVGPaint::createURI(value->string); | 204 parsedValue = SVGPaint::createURI(value->string); |
| 200 } else | 205 } else |
| 201 parsedValue = parseSVGPaint(); | 206 parsedValue = parseSVGPaint(); |
| 202 | 207 |
| 203 if (parsedValue) | 208 if (parsedValue) |
| 204 m_valueList->next(); | 209 m_valueList->next(); |
| 205 } | 210 } |
| 206 break; | 211 break; |
| 207 | 212 |
| 208 case CSSPropertyStopColor: // TODO : icccolor | 213 case CSSPropertyStopColor: // TODO : icccolor |
| 209 case CSSPropertyFloodColor: | 214 case CSSPropertyFloodColor: |
| 210 case CSSPropertyLightingColor: | 215 case CSSPropertyLightingColor: |
| 211 if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || | 216 if (isSystemColor(id)) |
| 212 (id >= CSSValueAliceblue && id <= CSSValueYellowgreen)) | 217 parsedValue = SVGColor::createFromColor(RenderTheme::defaultTheme()-
>systemColor(id)); |
| 218 else if ((id >= CSSValueAqua && id <= CSSValueTransparent) || |
| 219 (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id ==
CSSValueGrey) |
| 213 parsedValue = SVGColor::createFromString(value->string); | 220 parsedValue = SVGColor::createFromString(value->string); |
| 214 else if (id == CSSValueCurrentcolor) | 221 else if (id == CSSValueCurrentcolor) |
| 215 parsedValue = SVGColor::createCurrentColor(); | 222 parsedValue = SVGColor::createCurrentColor(); |
| 216 else // TODO : svgcolor (iccColor) | 223 else // TODO : svgcolor (iccColor) |
| 217 parsedValue = parseSVGColor(); | 224 parsedValue = parseSVGColor(); |
| 218 | 225 |
| 219 if (parsedValue) | 226 if (parsedValue) |
| 220 m_valueList->next(); | 227 m_valueList->next(); |
| 221 | 228 |
| 222 break; | 229 break; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 { | 368 { |
| 362 RGBA32 c = Color::transparent; | 369 RGBA32 c = Color::transparent; |
| 363 if (!parseColorFromValue(m_valueList->current(), c)) | 370 if (!parseColorFromValue(m_valueList->current(), c)) |
| 364 return 0; | 371 return 0; |
| 365 return SVGColor::createFromColor(Color(c)); | 372 return SVGColor::createFromColor(Color(c)); |
| 366 } | 373 } |
| 367 | 374 |
| 368 } | 375 } |
| 369 | 376 |
| 370 #endif // ENABLE(SVG) | 377 #endif // ENABLE(SVG) |
| OLD | NEW |