OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 return false; | 1018 return false; |
1019 | 1019 |
1020 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 1020 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
1021 if (!primitiveValue->isRGBColor()) | 1021 if (!primitiveValue->isRGBColor()) |
1022 return false; | 1022 return false; |
1023 | 1023 |
1024 color = primitiveValue->getRGBA32Value(); | 1024 color = primitiveValue->getRGBA32Value(); |
1025 return true; | 1025 return true; |
1026 } | 1026 } |
1027 | 1027 |
| 1028 StyleColor BisonCSSParser::colorFromRGBColorString(const String& colorString) |
| 1029 { |
| 1030 // FIXME: Rework css parser so it is more SVG aware. |
| 1031 RGBA32 color; |
| 1032 if (BisonCSSParser::parseColor(color, colorString.stripWhiteSpace())) |
| 1033 return StyleColor(color); |
| 1034 // FIXME: This branch catches the string currentColor, but we should error i
f we have an illegal color value. |
| 1035 return StyleColor::currentColor(); |
| 1036 } |
| 1037 |
1028 bool BisonCSSParser::parseColor(const String& string) | 1038 bool BisonCSSParser::parseColor(const String& string) |
1029 { | 1039 { |
1030 setupParser("@-internal-decls color:", string, ""); | 1040 setupParser("@-internal-decls color:", string, ""); |
1031 cssyyparse(this); | 1041 cssyyparse(this); |
1032 m_rule = nullptr; | 1042 m_rule = nullptr; |
1033 | 1043 |
1034 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C
SSPropertyColor; | 1044 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C
SSPropertyColor; |
1035 } | 1045 } |
1036 | 1046 |
1037 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string) | 1047 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string) |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 rule->setProperties(createStylePropertySet()); | 2120 rule->setProperties(createStylePropertySet()); |
2111 clearProperties(); | 2121 clearProperties(); |
2112 | 2122 |
2113 StyleRuleViewport* result = rule.get(); | 2123 StyleRuleViewport* result = rule.get(); |
2114 m_parsedRules.append(rule.release()); | 2124 m_parsedRules.append(rule.release()); |
2115 | 2125 |
2116 return result; | 2126 return result; |
2117 } | 2127 } |
2118 | 2128 |
2119 } | 2129 } |
OLD | NEW |