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

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

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/core/css/StylePropertySet.cpp ('k') | Source/core/css/parser/CSSPropertyParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 NullableCSSValue value = CSSParserFastPaths::parseColor(string, !strict); 123 NullableCSSValue value = CSSParserFastPaths::parseColor(string, !strict);
124 // TODO(timloh): Why is this always strict mode? 124 // TODO(timloh): Why is this always strict mode?
125 if (!value) 125 if (!value)
126 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex t()); 126 value = parseSingleValue(CSSPropertyColor, string, strictCSSParserContex t());
127 127
128 if (!value || !value->isPrimitiveValue()) 128 if (!value || !value->isPrimitiveValue())
129 return false; 129 return false;
130 130
131 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 131 CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(*value);
132 if (!primitiveValue->isRGBColor()) 132 if (!primitiveValue.isRGBColor())
133 return false; 133 return false;
134 134
135 color = primitiveValue->getRGBA32Value(); 135 color = primitiveValue.getRGBA32Value();
136 return true; 136 return true;
137 } 137 }
138 138
139 StyleColor CSSParser::colorFromRGBColorString(const String& string) 139 StyleColor CSSParser::colorFromRGBColorString(const String& string)
140 { 140 {
141 // FIXME: Rework css parser so it is more SVG aware. 141 // FIXME: Rework css parser so it is more SVG aware.
142 RGBA32 color; 142 RGBA32 color;
143 if (parseColor(color, string.stripWhiteSpace())) 143 if (parseColor(color, string.stripWhiteSpace()))
144 return StyleColor(color); 144 return StyleColor(color);
145 // FIXME: This branch catches the string currentColor, but we should error i f we have an illegal color value. 145 // FIXME: This branch catches the string currentColor, but we should error i f we have an illegal color value.
(...skipping 21 matching lines...) Expand all
167 builder.appendLiteral(" : "); 167 builder.appendLiteral(" : ");
168 builder.append(propertyValue); 168 builder.append(propertyValue);
169 builder.appendLiteral("; }"); 169 builder.appendLiteral("; }");
170 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString()); 170 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString());
171 if (!rule || !rule->isFontFaceRule()) 171 if (!rule || !rule->isFontFaceRule())
172 return nullptr; 172 return nullptr;
173 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); 173 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID);
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySet.cpp ('k') | Source/core/css/parser/CSSPropertyParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698