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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 return false; | 1006 return false; |
1007 | 1007 |
1008 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 1008 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
1009 if (!primitiveValue->isRGBColor()) | 1009 if (!primitiveValue->isRGBColor()) |
1010 return false; | 1010 return false; |
1011 | 1011 |
1012 color = primitiveValue->getRGBA32Value(); | 1012 color = primitiveValue->getRGBA32Value(); |
1013 return true; | 1013 return true; |
1014 } | 1014 } |
1015 | 1015 |
| 1016 StyleColor BisonCSSParser::colorFromRGBColorString(const String& colorString) |
| 1017 { |
| 1018 // FIXME: Rework css parser so it is more SVG aware. |
| 1019 RGBA32 color; |
| 1020 if (parseColor(color, colorString.stripWhiteSpace())) |
| 1021 return StyleColor(color); |
| 1022 // FIXME: This branch catches the string currentColor, but we should error i
f we have an illegal color value. |
| 1023 return StyleColor::currentColor(); |
| 1024 } |
| 1025 |
1016 bool BisonCSSParser::parseColor(const String& string) | 1026 bool BisonCSSParser::parseColor(const String& string) |
1017 { | 1027 { |
1018 setupParser("@-internal-decls color:", string, ""); | 1028 setupParser("@-internal-decls color:", string, ""); |
1019 cssyyparse(this); | 1029 cssyyparse(this); |
1020 m_rule = nullptr; | 1030 m_rule = nullptr; |
1021 | 1031 |
1022 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C
SSPropertyColor; | 1032 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C
SSPropertyColor; |
1023 } | 1033 } |
1024 | 1034 |
1025 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string) | 1035 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string) |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 rule->setProperties(createStylePropertySet()); | 2108 rule->setProperties(createStylePropertySet()); |
2099 clearProperties(); | 2109 clearProperties(); |
2100 | 2110 |
2101 StyleRuleViewport* result = rule.get(); | 2111 StyleRuleViewport* result = rule.get(); |
2102 m_parsedRules.append(rule.release()); | 2112 m_parsedRules.append(rule.release()); |
2103 | 2113 |
2104 return result; | 2114 return result; |
2105 } | 2115 } |
2106 | 2116 |
2107 } | 2117 } |
OLD | NEW |