| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/CSSParser.h" | 6 #include "core/css/parser/CSSParser.h" |
| 7 | 7 |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents*
styleSheet, const String& text) | 44 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents*
styleSheet, const String& text) |
| 45 { | 45 { |
| 46 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); | 46 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void CSSParser::parseSheetForInspector(const CSSParserContext& context, StyleShe
etContents* styleSheet, const String& text, CSSParserObserver& observer) | 49 void CSSParser::parseSheetForInspector(const CSSParserContext& context, StyleShe
etContents* styleSheet, const String& text, CSSParserObserver& observer) |
| 50 { | 50 { |
| 51 return CSSParserImpl::parseStyleSheetForInspector(text, context, styleSheet,
observer); | 51 return CSSParserImpl::parseStyleSheetForInspector(text, context, styleSheet,
observer); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
nresolvedProperty, const String& string, bool important, CSSParserMode parserMod
e, StyleSheetContents* styleSheet) | 54 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u
nresolvedProperty, const String& string, bool important, StyleSheetContents* sty
leSheet) |
| 55 { | 55 { |
| 56 if (string.isEmpty()) | 56 if (string.isEmpty()) |
| 57 return false; | 57 return false; |
| 58 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); | 58 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); |
| 59 CSSParserMode parserMode = declaration->cssParserMode(); |
| 59 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(res
olvedProperty, string, parserMode); | 60 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(res
olvedProperty, string, parserMode); |
| 60 if (value) | 61 if (value) |
| 61 return declaration->setProperty(CSSProperty(resolvedProperty, value.rele
ase(), important)); | 62 return declaration->setProperty(CSSProperty(resolvedProperty, value.rele
ase(), important)); |
| 62 CSSParserContext context(parserMode, 0); | 63 CSSParserContext context(parserMode, 0); |
| 63 if (styleSheet) { | 64 if (styleSheet) { |
| 64 context = styleSheet->parserContext(); | 65 context = styleSheet->parserContext(); |
| 65 context.setMode(parserMode); | 66 context.setMode(parserMode); |
| 66 } | 67 } |
| 67 return parseValue(declaration, unresolvedProperty, string, important, contex
t); | 68 return parseValue(declaration, unresolvedProperty, string, important, contex
t); |
| 68 } | 69 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 builder.appendLiteral(" : "); | 158 builder.appendLiteral(" : "); |
| 158 builder.append(propertyValue); | 159 builder.append(propertyValue); |
| 159 builder.appendLiteral("; }"); | 160 builder.appendLiteral("; }"); |
| 160 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder
.toString()); | 161 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder
.toString()); |
| 161 if (!rule || !rule->isFontFaceRule()) | 162 if (!rule || !rule->isFontFaceRule()) |
| 162 return nullptr; | 163 return nullptr; |
| 163 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); | 164 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |