Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: Source/core/css/parser/CSSParser.cpp

Issue 1232593004: Don't resolve extended color keywords during parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test expectations fixups. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 CSSTokenizer::Scope scope(condition); 105 CSSTokenizer::Scope scope(condition);
106 CSSParserImpl parser(strictCSSParserContext()); 106 CSSParserImpl parser(strictCSSParserContext());
107 return CSSSupportsParser::supportsCondition(scope.tokenRange(), parser) == C SSSupportsParser::Supported; 107 return CSSSupportsParser::supportsCondition(scope.tokenRange(), parser) == C SSSupportsParser::Supported;
108 } 108 }
109 109
110 bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict) 110 bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict)
111 { 111 {
112 if (string.isEmpty()) 112 if (string.isEmpty())
113 return false; 113 return false;
114 114
115 // The regular color parsers don't resolve all named colors, so explicitly 115 // The regular color parsers don't resolve named colors, so explicitly
116 // handle these first. 116 // handle these first.
117 Color namedColor; 117 Color namedColor;
118 if (namedColor.setNamedColor(string)) { 118 if (namedColor.setNamedColor(string)) {
119 color = namedColor.rgb(); 119 color = namedColor.rgb();
120 return true; 120 return true;
121 } 121 }
122 122
123 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::parseColor(string, strict ? HTMLStandardMode : HTMLQuirksMode); 123 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::parseColor(string, strict ? HTMLStandardMode : HTMLQuirksMode);
124 // TODO(timloh): Why is this always strict mode? 124 // TODO(timloh): Why is this always strict mode?
125 if (!value) 125 if (!value)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 builder.appendLiteral(" : "); 157 builder.appendLiteral(" : ");
158 builder.append(propertyValue); 158 builder.append(propertyValue);
159 builder.appendLiteral("; }"); 159 builder.appendLiteral("; }");
160 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString()); 160 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString());
161 if (!rule || !rule->isFontFaceRule()) 161 if (!rule || !rule->isFontFaceRule())
162 return nullptr; 162 return nullptr;
163 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); 163 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID);
164 } 164 }
165 165
166 } // namespace blink 166 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698