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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/LengthValue.cpp

Issue 1938343002: Generate a series of nested switch statements to parse CSSPrimitiveValue units. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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::parse(const String& cssString, ExceptionState& excepti onState) 26 LengthValue* LengthValue::parse(const String& cssString, ExceptionState& excepti onState)
24 { 27 {
25 // TODO: Implement 28 // TODO: Implement
26 return nullptr; 29 return nullptr;
27 } 30 }
28 31
29 LengthValue* LengthValue::fromValue(double value, const String& type, ExceptionS tate&) 32 LengthValue* LengthValue::fromValue(double value, const String& type, ExceptionS tate&)
30 { 33 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698