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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex
t()); | 151 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex
t()); |
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 CSSValueID id = cssValueKeywordID(colorString); |
162 cssColor.init(colorString); | |
163 CSSValueID id = cssValueKeywordID(cssColor); | |
164 if (!CSSPropertyParser::isSystemColor(id)) | 162 if (!CSSPropertyParser::isSystemColor(id)) |
165 return false; | 163 return false; |
166 | 164 |
167 color = LayoutTheme::theme().systemColor(id); | 165 color = LayoutTheme::theme().systemColor(id); |
168 return true; | 166 return true; |
169 } | 167 } |
170 | 168 |
171 CSSValue* CSSParser::parseFontFaceDescriptor(CSSPropertyID propertyID, const Str
ing& propertyValue, const CSSParserContext& context) | 169 CSSValue* CSSParser::parseFontFaceDescriptor(CSSPropertyID propertyID, const Str
ing& propertyValue, const CSSParserContext& context) |
172 { | 170 { |
173 StringBuilder builder; | 171 StringBuilder builder; |
174 builder.appendLiteral("@font-face { "); | 172 builder.appendLiteral("@font-face { "); |
175 builder.append(getPropertyNameString(propertyID)); | 173 builder.append(getPropertyNameString(propertyID)); |
176 builder.appendLiteral(" : "); | 174 builder.appendLiteral(" : "); |
177 builder.append(propertyValue); | 175 builder.append(propertyValue); |
178 builder.appendLiteral("; }"); | 176 builder.appendLiteral("; }"); |
179 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); | 177 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); |
180 if (!rule || !rule->isFontFaceRule()) | 178 if (!rule || !rule->isFontFaceRule()) |
181 return nullptr; | 179 return nullptr; |
182 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue(propertyI
D); | 180 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue(propertyI
D); |
183 } | 181 } |
184 | 182 |
185 } // namespace blink | 183 } // namespace blink |
OLD | NEW |