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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp

Issue 2378113005: Change isCSSWideKeyword() to take a StringView instead of a CSSValueID (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/CSSPropertyParserHelpers.h" 5 #include "core/css/parser/CSSPropertyParserHelpers.h"
6 6
7 #include "core/css/CSSCalculationValue.h" 7 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSColorValue.h" 8 #include "core/css/CSSColorValue.h"
9 #include "core/css/CSSCrossfadeValue.h" 9 #include "core/css/CSSCrossfadeValue.h"
10 #include "core/css/CSSGradientValue.h" 10 #include "core/css/CSSGradientValue.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 CSSPrimitiveValue* consumeIdentRange(CSSParserTokenRange& range, CSSValueID lowe r, CSSValueID upper) 307 CSSPrimitiveValue* consumeIdentRange(CSSParserTokenRange& range, CSSValueID lowe r, CSSValueID upper)
308 { 308 {
309 if (range.peek().id() < lower || range.peek().id() > upper) 309 if (range.peek().id() < lower || range.peek().id() > upper)
310 return nullptr; 310 return nullptr;
311 return consumeIdent(range); 311 return consumeIdent(range);
312 } 312 }
313 313
314 CSSCustomIdentValue* consumeCustomIdent(CSSParserTokenRange& range) 314 CSSCustomIdentValue* consumeCustomIdent(CSSParserTokenRange& range)
315 { 315 {
316 if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().id()) ) 316 if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().value ()))
317 return nullptr; 317 return nullptr;
318 return CSSCustomIdentValue::create(range.consumeIncludingWhitespace().value( ).toAtomicString()); 318 return CSSCustomIdentValue::create(range.consumeIncludingWhitespace().value( ).toAtomicString());
319 } 319 }
320 320
321 CSSStringValue* consumeString(CSSParserTokenRange& range) 321 CSSStringValue* consumeString(CSSParserTokenRange& range)
322 { 322 {
323 if (range.peek().type() != StringToken) 323 if (range.peek().type() != StringToken)
324 return nullptr; 324 return nullptr;
325 return CSSStringValue::create(range.consumeIncludingWhitespace().value().toS tring()); 325 return CSSStringValue::create(range.consumeIncludingWhitespace().value().toS tring());
326 } 326 }
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (range.peek().type() == FunctionToken) { 1103 if (range.peek().type() == FunctionToken) {
1104 CSSValueID id = range.peek().functionId(); 1104 CSSValueID id = range.peek().functionId();
1105 if (id == CSSValueWebkitImageSet) 1105 if (id == CSSValueWebkitImageSet)
1106 return consumeImageSet(range, context); 1106 return consumeImageSet(range, context);
1107 if (generatedImage == ConsumeGeneratedImage::Allow && isGeneratedImage(i d)) 1107 if (generatedImage == ConsumeGeneratedImage::Allow && isGeneratedImage(i d))
1108 return consumeGeneratedImage(range, context); 1108 return consumeGeneratedImage(range, context);
1109 } 1109 }
1110 return nullptr; 1110 return nullptr;
1111 } 1111 }
1112 1112
1113 bool isCSSWideKeyword(StringView keyword)
1114 {
1115 return equalIgnoringASCIICase(keyword, "initial")
1116 || equalIgnoringASCIICase(keyword, "inherit")
1117 || equalIgnoringASCIICase(keyword, "unset")
1118 || equalIgnoringASCIICase(keyword, "default");
1119 }
1120
1113 } // namespace CSSPropertyParserHelpers 1121 } // namespace CSSPropertyParserHelpers
1114 1122
1115 } // namespace blink 1123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698