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

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

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use m_unit Created 5 years, 1 month 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/CSSParserToken.h" 6 #include "core/css/parser/CSSParserToken.h"
7 7
8 #include "core/css/CSSMarkup.h" 8 #include "core/css/CSSMarkup.h"
9 #include "core/css/parser/CSSPropertyParser.h" 9 #include "core/css/parser/CSSPropertyParser.h"
10 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 CSSValueID CSSParserToken::functionId() const 123 CSSValueID CSSParserToken::functionId() const
124 { 124 {
125 if (m_type != FunctionToken) 125 if (m_type != FunctionToken)
126 return CSSValueInvalid; 126 return CSSValueInvalid;
127 if (m_id < 0) 127 if (m_id < 0)
128 m_id = cssValueKeywordID(value()); 128 m_id = cssValueKeywordID(value());
129 return static_cast<CSSValueID>(m_id); 129 return static_cast<CSSValueID>(m_id);
130 } 130 }
131 131
132 bool CSSParserToken::hasStringBacking() const
133 {
134 CSSParserTokenType tokenType = type();
135 return tokenType == IdentToken
136 || tokenType == FunctionToken
137 || tokenType == AtKeywordToken
138 || tokenType == HashToken
139 || tokenType == UrlToken
140 || tokenType == DimensionToken
141 || tokenType == StringToken;
142 }
143
144 CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars erString) const
145 {
146 CSSParserToken copy(*this);
147 copy.initValueFromCSSParserString(parserString);
148 return copy;
149 }
150
132 void CSSParserToken::serialize(StringBuilder& builder) const 151 void CSSParserToken::serialize(StringBuilder& builder) const
133 { 152 {
134 // This is currently only used for @supports CSSOM. To keep our implementati on 153 // This is currently only used for @supports CSSOM. To keep our implementati on
135 // simple we handle some of the edge cases incorrectly (see comments below). 154 // simple we handle some of the edge cases incorrectly (see comments below).
136 switch (type()) { 155 switch (type()) {
137 case IdentToken: 156 case IdentToken:
138 serializeIdentifier(value(), builder); 157 serializeIdentifier(value(), builder);
139 break; 158 break;
140 case FunctionToken: 159 case FunctionToken:
141 serializeIdentifier(value(), builder); 160 serializeIdentifier(value(), builder);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return builder.append('}'); 235 return builder.append('}');
217 236
218 case EOFToken: 237 case EOFToken:
219 case CommentToken: 238 case CommentToken:
220 ASSERT_NOT_REACHED(); 239 ASSERT_NOT_REACHED();
221 return; 240 return;
222 } 241 }
223 } 242 }
224 243
225 } // namespace blink 244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698