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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp b/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
index 637f5076a9d7baa48b920d3c8836f105a2ee2146..8d5008f15d5b6eeb22979df924bf55220e69956e 100644
--- a/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/LengthValue.cpp
@@ -5,6 +5,7 @@
#include "core/css/cssom/LengthValue.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "core/css/CSSPrimitiveValueUnitTrie.h"
#include "core/css/cssom/CalcDictionary.h"
#include "core/css/cssom/SimpleLength.h"
#include "core/css/cssom/StyleCalcLength.h"
@@ -17,7 +18,9 @@ CSSPrimitiveValue::UnitType LengthValue::unitFromName(const String& name)
if (equalIgnoringASCIICase(name, "percent") || name == "%") {
return CSSPrimitiveValue::UnitType::Percentage;
}
- return CSSPrimitiveValue::fromName(name);
+ if (name.is8Bit())
+ return lookupCSSPrimitiveValueUnit(name.characters8(), name.length());
+ return lookupCSSPrimitiveValueUnit(name.characters16(), name.length());
}
LengthValue* LengthValue::parse(const String& cssString, ExceptionState& exceptionState)

Powered by Google App Engine
This is Rietveld 408576698