| OLD | NEW |
| 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 "core/css/parser/CSSParserToken.h" | 5 #include "core/css/parser/CSSParserToken.h" |
| 6 | 6 |
| 7 #include "core/css/CSSMarkup.h" | 7 #include "core/css/CSSMarkup.h" |
| 8 #include "core/css/parser/CSSPropertyParser.h" | 8 #include "core/css/parser/CSSPropertyParser.h" |
| 9 #include "wtf/HashMap.h" | 9 #include "wtf/HashMap.h" |
| 10 #include "wtf/text/StringBuilder.h" | 10 #include "wtf/text/StringBuilder.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (unit.is8Bit()) |
| 72 m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(unit.characte
rs8(), unit.length())); |
| 73 else |
| 74 m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(unit.characte
rs16(), unit.length())); |
| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 return builder.append('}'); | 237 return builder.append('}'); |
| 235 | 238 |
| 236 case EOFToken: | 239 case EOFToken: |
| 237 case CommentToken: | 240 case CommentToken: |
| 238 ASSERT_NOT_REACHED(); | 241 ASSERT_NOT_REACHED(); |
| 239 return; | 242 return; |
| 240 } | 243 } |
| 241 } | 244 } |
| 242 | 245 |
| 243 } // namespace blink | 246 } // namespace blink |
| OLD | NEW |