OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSParser.h" | 5 #include "core/css/parser/CSSParser.h" |
6 | 6 |
7 #include "core/css/CSSColorValue.h" | 7 #include "core/css/CSSColorValue.h" |
8 #include "core/css/CSSKeyframeRule.h" | 8 #include "core/css/CSSKeyframeRule.h" |
9 #include "core/css/StyleColor.h" | 9 #include "core/css/StyleColor.h" |
10 #include "core/css/StylePropertySet.h" | 10 #include "core/css/StylePropertySet.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return false; | 138 return false; |
139 | 139 |
140 // The regular color parsers don't resolve named colors, so explicitly | 140 // The regular color parsers don't resolve named colors, so explicitly |
141 // handle these first. | 141 // handle these first. |
142 Color namedColor; | 142 Color namedColor; |
143 if (namedColor.setNamedColor(string)) { | 143 if (namedColor.setNamedColor(string)) { |
144 color = namedColor; | 144 color = namedColor; |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
148 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::parseColor(string,
strict ? HTMLStandardMode : HTMLQuirksMode); | 148 CSSParserContext context(strict ? HTMLStandardMode : HTMLQuirksMode, 0); |
149 // TODO(timloh): Why is this always strict mode? | 149 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::parseColor(string,
context.mode()); |
150 if (!value) | 150 if (!value) |
151 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex
t()); | 151 value = parseSingleValue(CSSPropertyColor, string, context); |
152 | 152 |
153 if (!value || !value->isColorValue()) | 153 if (!value || !value->isColorValue()) |
154 return false; | 154 return false; |
155 color = toCSSColorValue(*value).value(); | 155 color = toCSSColorValue(*value).value(); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 bool CSSParser::parseSystemColor(Color& color, const String& colorString) | 159 bool CSSParser::parseSystemColor(Color& color, const String& colorString) |
160 { | 160 { |
161 CSSParserString cssColor; | 161 CSSParserString cssColor; |
(...skipping 14 matching lines...) Expand all Loading... |
176 builder.appendLiteral(" : "); | 176 builder.appendLiteral(" : "); |
177 builder.append(propertyValue); | 177 builder.append(propertyValue); |
178 builder.appendLiteral("; }"); | 178 builder.appendLiteral("; }"); |
179 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder
.toString()); | 179 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder
.toString()); |
180 if (!rule || !rule->isFontFaceRule()) | 180 if (!rule || !rule->isFontFaceRule()) |
181 return nullptr; | 181 return nullptr; |
182 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); | 182 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); |
183 } | 183 } |
184 | 184 |
185 } // namespace blink | 185 } // namespace blink |
OLD | NEW |