| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet(CSSParserTokenRange
range) | 93 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet(CSSParserTokenRange
range) |
| 94 { | 94 { |
| 95 return CSSParserImpl::parseCustomPropertySet(range); | 95 return CSSParserImpl::parseCustomPropertySet(range); |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
nresolvedProperty, const String& string, bool important, const CSSParserContext&
context) | 98 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
nresolvedProperty, const String& string, bool important, const CSSParserContext&
context) |
| 99 { | 99 { |
| 100 return CSSParserImpl::parseValue(declaration, unresolvedProperty, string, im
portant, context); | 100 return CSSParserImpl::parseValue(declaration, unresolvedProperty, string, im
portant, context); |
| 101 } | 101 } |
| 102 | 102 |
| 103 CSSValue* CSSParser::parseSingleValue(CSSPropertyID propertyID, const String& st
ring, const CSSParserContext& context) | 103 const CSSValue* CSSParser::parseSingleValue(CSSPropertyID propertyID, const Stri
ng& string, const CSSParserContext& context) |
| 104 { | 104 { |
| 105 if (string.isEmpty()) | 105 if (string.isEmpty()) |
| 106 return nullptr; | 106 return nullptr; |
| 107 if (CSSValue* value = CSSParserFastPaths::maybeParseValue(propertyID, string
, context.mode())) | 107 if (CSSValue* value = CSSParserFastPaths::maybeParseValue(propertyID, string
, context.mode())) |
| 108 return value; | 108 return value; |
| 109 CSSTokenizer::Scope scope(string); | 109 CSSTokenizer::Scope scope(string); |
| 110 return CSSPropertyParser::parseSingleValue(propertyID, scope.tokenRange(), c
ontext); | 110 return CSSPropertyParser::parseSingleValue(propertyID, scope.tokenRange(), c
ontext); |
| 111 } | 111 } |
| 112 | 112 |
| 113 ImmutableStylePropertySet* CSSParser::parseInlineStyleDeclaration(const String&
styleString, Element* element) | 113 ImmutableStylePropertySet* CSSParser::parseInlineStyleDeclaration(const String&
styleString, Element* element) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 139 return false; | 139 return false; |
| 140 | 140 |
| 141 // The regular color parsers don't resolve named colors, so explicitly | 141 // The regular color parsers don't resolve named colors, so explicitly |
| 142 // handle these first. | 142 // handle these first. |
| 143 Color namedColor; | 143 Color namedColor; |
| 144 if (namedColor.setNamedColor(string)) { | 144 if (namedColor.setNamedColor(string)) { |
| 145 color = namedColor; | 145 color = namedColor; |
| 146 return true; | 146 return true; |
| 147 } | 147 } |
| 148 | 148 |
| 149 CSSValue* value = CSSParserFastPaths::parseColor(string, strict ? HTMLStanda
rdMode : HTMLQuirksMode); | 149 const CSSValue* value = CSSParserFastPaths::parseColor(string, strict ? HTML
StandardMode : HTMLQuirksMode); |
| 150 // TODO(timloh): Why is this always strict mode? | 150 // TODO(timloh): Why is this always strict mode? |
| 151 if (!value) | 151 if (!value) |
| 152 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex
t()); | 152 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex
t()); |
| 153 | 153 |
| 154 if (!value || !value->isColorValue()) | 154 if (!value || !value->isColorValue()) |
| 155 return false; | 155 return false; |
| 156 color = toCSSColorValue(*value).value(); | 156 color = toCSSColorValue(*value).value(); |
| 157 return true; | 157 return true; |
| 158 } | 158 } |
| 159 | 159 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 175 builder.append(" : "); | 175 builder.append(" : "); |
| 176 builder.append(propertyValue); | 176 builder.append(propertyValue); |
| 177 builder.append("; }"); | 177 builder.append("; }"); |
| 178 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); | 178 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); |
| 179 if (!rule || !rule->isFontFaceRule()) | 179 if (!rule || !rule->isFontFaceRule()) |
| 180 return nullptr; | 180 return nullptr; |
| 181 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue(propertyI
D); | 181 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue(propertyI
D); |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |