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

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

Issue 2051313002: Encapsulate the CSSPrimitiveValue UnitType trie bethind a method that takes a StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/CSSLengthValue.h" 5 #include "core/css/cssom/CSSLengthValue.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/CSSPrimitiveValue.h"
9 #include "core/css/cssom/CSSCalcLength.h" 9 #include "core/css/cssom/CSSCalcLength.h"
10 #include "core/css/cssom/CSSSimpleLength.h" 10 #include "core/css/cssom/CSSSimpleLength.h"
11 #include "core/css/cssom/CalcDictionary.h" 11 #include "core/css/cssom/CalcDictionary.h"
12 #include "wtf/HashMap.h" 12 #include "wtf/HashMap.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 CSSPrimitiveValue::UnitType CSSLengthValue::unitFromName(const String& name) 16 CSSPrimitiveValue::UnitType CSSLengthValue::unitFromName(const String& name)
17 { 17 {
18 if (equalIgnoringASCIICase(name, "percent") || name == "%") { 18 if (equalIgnoringASCIICase(name, "percent") || name == "%")
19 return CSSPrimitiveValue::UnitType::Percentage; 19 return CSSPrimitiveValue::UnitType::Percentage;
20 } 20 return CSSPrimitiveValue::stringToUnitType(name);
21 if (name.is8Bit())
22 return lookupCSSPrimitiveValueUnit(name.characters8(), name.length());
23 return lookupCSSPrimitiveValueUnit(name.characters16(), name.length());
24 } 21 }
25 22
26 CSSLengthValue* CSSLengthValue::from(const String& cssString, ExceptionState& ex ceptionState) 23 CSSLengthValue* CSSLengthValue::from(const String& cssString, ExceptionState& ex ceptionState)
27 { 24 {
28 // TODO: Implement 25 // TODO: Implement
29 return nullptr; 26 return nullptr;
30 } 27 }
31 28
32 CSSLengthValue* CSSLengthValue::from(double value, const String& type, Exception State&) 29 CSSLengthValue* CSSLengthValue::from(double value, const String& type, Exception State&)
33 { 30 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return nullptr; 82 return nullptr;
86 } 83 }
87 84
88 CSSLengthValue* CSSLengthValue::divideInternal(double, ExceptionState&) 85 CSSLengthValue* CSSLengthValue::divideInternal(double, ExceptionState&)
89 { 86 {
90 NOTREACHED(); 87 NOTREACHED();
91 return nullptr; 88 return nullptr;
92 } 89 }
93 90
94 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698