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

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

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
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 #ifndef CSSPropertyParserHelpers_h 5 #ifndef CSSPropertyParserHelpers_h
6 #define CSSPropertyParserHelpers_h 6 #define CSSPropertyParserHelpers_h
7 7
8 #include "core/css/CSSCustomIdentValue.h" 8 #include "core/css/CSSCustomIdentValue.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/parser/CSSParserMode.h" 10 #include "core/css/parser/CSSParserMode.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bool consumeOneOrTwoValuedPosition(CSSParserTokenRange&, CSSParserMode, Unitless Quirk, CSSValue*& resultX, CSSValue*& resultY); 62 bool consumeOneOrTwoValuedPosition(CSSParserTokenRange&, CSSParserMode, Unitless Quirk, CSSValue*& resultX, CSSValue*& resultY);
63 63
64 enum class ConsumeGeneratedImage { 64 enum class ConsumeGeneratedImage {
65 Allow, 65 Allow,
66 Forbid 66 Forbid
67 }; 67 };
68 68
69 CSSValue* consumeImage(CSSParserTokenRange&, CSSParserContext, ConsumeGeneratedI mage = ConsumeGeneratedImage::Allow); 69 CSSValue* consumeImage(CSSParserTokenRange&, CSSParserContext, ConsumeGeneratedI mage = ConsumeGeneratedImage::Allow);
70 CSSValue* consumeImageOrNone(CSSParserTokenRange&, CSSParserContext); 70 CSSValue* consumeImageOrNone(CSSParserTokenRange&, CSSParserContext);
71 71
72 bool isCSSWideKeyword(StringView);
73
72 // Template implementations are at the bottom of the file for readability. 74 // Template implementations are at the bottom of the file for readability.
73 75
74 template<typename... emptyBaseCase> inline bool identMatches(CSSValueID id) { re turn false; } 76 template<typename... emptyBaseCase> inline bool identMatches(CSSValueID id) { re turn false; }
75 template<CSSValueID head, CSSValueID... tail> inline bool identMatches(CSSValueI D id) 77 template<CSSValueID head, CSSValueID... tail> inline bool identMatches(CSSValueI D id)
76 { 78 {
77 return id == head || identMatches<tail...>(id); 79 return id == head || identMatches<tail...>(id);
78 } 80 }
79 81
80 template<CSSValueID... names> CSSPrimitiveValue* consumeIdent(CSSParserTokenRang e& range) 82 template<CSSValueID... names> CSSPrimitiveValue* consumeIdent(CSSParserTokenRang e& range)
81 { 83 {
82 if (range.peek().type() != IdentToken || !identMatches<names...>(range.peek( ).id())) 84 if (range.peek().type() != IdentToken || !identMatches<names...>(range.peek( ).id()))
83 return nullptr; 85 return nullptr;
84 return CSSPrimitiveValue::createIdentifier(range.consumeIncludingWhitespace( ).id()); 86 return CSSPrimitiveValue::createIdentifier(range.consumeIncludingWhitespace( ).id());
85 } 87 }
86 88
87 static inline bool isCSSWideKeyword(const CSSValueID& id)
88 {
89 return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueDefault;
90 }
91
92 } // namespace CSSPropertyParserHelpers 89 } // namespace CSSPropertyParserHelpers
93 90
94 } // namespace blink 91 } // namespace blink
95 92
96 #endif // CSSPropertyParserHelpers_h 93 #endif // CSSPropertyParserHelpers_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698