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

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

Issue 1319453002: Experiment: Switch to code-driven conversion of CSS unit type names. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: drop redundant namespace prefix 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/CSSPrimitiveValue.cpp ('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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 , m_hashTokenType(type) 61 , m_hashTokenType(type)
62 { 62 {
63 initValueFromCSSParserString(value); 63 initValueFromCSSParserString(value);
64 } 64 }
65 65
66 void CSSParserToken::convertToDimensionWithUnit(CSSParserString unit) 66 void CSSParserToken::convertToDimensionWithUnit(CSSParserString unit)
67 { 67 {
68 ASSERT(m_type == NumberToken); 68 ASSERT(m_type == NumberToken);
69 m_type = DimensionToken; 69 m_type = DimensionToken;
70 initValueFromCSSParserString(unit); 70 initValueFromCSSParserString(unit);
71 m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(unit)); 71 if (m_valueIs8Bit)
72 m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(reinterpret_c ast<const LChar*>(m_valueDataCharRaw), m_valueLength));
73 else
74 m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(reinterpret_c ast<const UChar*>(m_valueDataCharRaw), m_valueLength));
72 } 75 }
73 76
74 void CSSParserToken::convertToPercentage() 77 void CSSParserToken::convertToPercentage()
75 { 78 {
76 ASSERT(m_type == NumberToken); 79 ASSERT(m_type == NumberToken);
77 m_type = PercentageToken; 80 m_type = PercentageToken;
78 m_unit = static_cast<unsigned>(CSSPrimitiveValue::UnitType::Percentage); 81 m_unit = static_cast<unsigned>(CSSPrimitiveValue::UnitType::Percentage);
79 } 82 }
80 83
81 UChar CSSParserToken::delimiter() const 84 UChar CSSParserToken::delimiter() const
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return builder.append('}'); 200 return builder.append('}');
198 201
199 case EOFToken: 202 case EOFToken:
200 case CommentToken: 203 case CommentToken:
201 ASSERT_NOT_REACHED(); 204 ASSERT_NOT_REACHED();
202 return; 205 return;
203 } 206 }
204 } 207 }
205 208
206 } // namespace blink 209 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698