| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   61  |   61  | 
|   62 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
     nresolvedProperty, const String& string, bool important, StyleSheetContents* sty
     leSheet) |   62 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
     nresolvedProperty, const String& string, bool important, StyleSheetContents* sty
     leSheet) | 
|   63 { |   63 { | 
|   64     if (string.isEmpty()) |   64     if (string.isEmpty()) | 
|   65         return false; |   65         return false; | 
|   66     CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); |   66     CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); | 
|   67     CSSParserMode parserMode = declaration->cssParserMode(); |   67     CSSParserMode parserMode = declaration->cssParserMode(); | 
|   68     CSSValue* value = CSSParserFastPaths::maybeParseValue(resolvedProperty, stri
     ng, parserMode); |   68     CSSValue* value = CSSParserFastPaths::maybeParseValue(resolvedProperty, stri
     ng, parserMode); | 
|   69     if (value) |   69     if (value) | 
|   70         return declaration->setProperty(CSSProperty(resolvedProperty, *value, im
     portant)); |   70         return declaration->setProperty(CSSProperty(resolvedProperty, *value, im
     portant)); | 
|   71     CSSParserContext context(parserMode, 0); |   71     CSSParserContext context(parserMode, nullptr); | 
|   72     if (styleSheet) { |   72     if (styleSheet) { | 
|   73         context = styleSheet->parserContext(); |   73         context = styleSheet->parserContext(); | 
|   74         context.setMode(parserMode); |   74         context.setMode(parserMode); | 
|   75     } |   75     } | 
|   76     return parseValue(declaration, unresolvedProperty, string, important, contex
     t); |   76     return parseValue(declaration, unresolvedProperty, string, important, contex
     t); | 
|   77 } |   77 } | 
|   78  |   78  | 
|   79 bool CSSParser::parseValueForCustomProperty(MutableStylePropertySet* declaration
     , const AtomicString& propertyName, const String& value, bool important, StyleSh
     eetContents* styleSheet) |   79 bool CSSParser::parseValueForCustomProperty(MutableStylePropertySet* declaration
     , const AtomicString& propertyName, const String& value, bool important, StyleSh
     eetContents* styleSheet) | 
|   80 { |   80 { | 
|   81     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled() && CSSVariableParser::i
     sValidVariableName(propertyName)); |   81     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled() && CSSVariableParser::i
     sValidVariableName(propertyName)); | 
|   82     if (value.isEmpty()) |   82     if (value.isEmpty()) | 
|   83         return false; |   83         return false; | 
|   84     CSSParserMode parserMode = declaration->cssParserMode(); |   84     CSSParserMode parserMode = declaration->cssParserMode(); | 
|   85     CSSParserContext context(parserMode, 0); |   85     CSSParserContext context(parserMode, nullptr); | 
|   86     if (styleSheet) { |   86     if (styleSheet) { | 
|   87         context = styleSheet->parserContext(); |   87         context = styleSheet->parserContext(); | 
|   88         context.setMode(parserMode); |   88         context.setMode(parserMode); | 
|   89     } |   89     } | 
|   90     return CSSParserImpl::parseVariableValue(declaration, propertyName, value, i
     mportant, context); |   90     return CSSParserImpl::parseVariableValue(declaration, propertyName, value, i
     mportant, context); | 
|   91 } |   91 } | 
|   92  |   92  | 
|   93 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet(CSSParserTokenRange
      range) |   93 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet(CSSParserTokenRange
      range) | 
|   94 { |   94 { | 
|   95     return CSSParserImpl::parseCustomPropertySet(range); |   95     return CSSParserImpl::parseCustomPropertySet(range); | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  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 |