| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cssom/LengthValue.h" | 5 #include "core/css/cssom/LengthValue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/css/CSSPrimitiveValueUnitTrie.h" |
| 8 #include "core/css/cssom/CalcDictionary.h" | 9 #include "core/css/cssom/CalcDictionary.h" |
| 9 #include "core/css/cssom/SimpleLength.h" | 10 #include "core/css/cssom/SimpleLength.h" |
| 10 #include "core/css/cssom/StyleCalcLength.h" | 11 #include "core/css/cssom/StyleCalcLength.h" |
| 11 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 CSSPrimitiveValue::UnitType LengthValue::unitFromName(const String& name) | 16 CSSPrimitiveValue::UnitType LengthValue::unitFromName(const String& name) |
| 16 { | 17 { |
| 17 if (equalIgnoringASCIICase(name, "percent") || name == "%") { | 18 if (equalIgnoringASCIICase(name, "percent") || name == "%") { |
| 18 return CSSPrimitiveValue::UnitType::Percentage; | 19 return CSSPrimitiveValue::UnitType::Percentage; |
| 19 } | 20 } |
| 20 return CSSPrimitiveValue::fromName(name); | 21 if (name.is8Bit()) |
| 22 return lookupCSSPrimitiveValueUnit(name.characters8(), name.length()); |
| 23 return lookupCSSPrimitiveValueUnit(name.characters16(), name.length()); |
| 21 } | 24 } |
| 22 | 25 |
| 23 LengthValue* LengthValue::from(const String& cssString, ExceptionState& exceptio
nState) | 26 LengthValue* LengthValue::from(const String& cssString, ExceptionState& exceptio
nState) |
| 24 { | 27 { |
| 25 // TODO: Implement | 28 // TODO: Implement |
| 26 return nullptr; | 29 return nullptr; |
| 27 } | 30 } |
| 28 | 31 |
| 29 LengthValue* LengthValue::from(double value, const String& type, ExceptionState&
) | 32 LengthValue* LengthValue::from(double value, const String& type, ExceptionState&
) |
| 30 { | 33 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return nullptr; | 85 return nullptr; |
| 83 } | 86 } |
| 84 | 87 |
| 85 LengthValue* LengthValue::divideInternal(double, ExceptionState&) | 88 LengthValue* LengthValue::divideInternal(double, ExceptionState&) |
| 86 { | 89 { |
| 87 ASSERT_NOT_REACHED(); | 90 ASSERT_NOT_REACHED(); |
| 88 return nullptr; | 91 return nullptr; |
| 89 } | 92 } |
| 90 | 93 |
| 91 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |