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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserToken.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/parser/CSSParserToken.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
index 51014658dd27281ffba820e298957ff4838f9008..d29560c65f9bbfcdaf463c75007900fadfbe9e28 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
@@ -5,6 +5,7 @@
#include "core/css/parser/CSSParserToken.h"
#include "core/css/CSSMarkup.h"
+#include "core/css/CSSPrimitiveValueUnitTrie.h"
#include "core/css/parser/CSSPropertyParser.h"
#include "wtf/HashMap.h"
#include "wtf/text/StringBuilder.h"
@@ -68,7 +69,11 @@ void CSSParserToken::convertToDimensionWithUnit(CSSParserString unit)
ASSERT(m_type == NumberToken);
m_type = DimensionToken;
initValueFromCSSParserString(unit);
- m_unit = static_cast<unsigned>(CSSPrimitiveValue::fromName(unit));
+
+ if (unit.is8Bit())
+ m_unit = static_cast<unsigned>(lookupCSSPrimitiveValueUnit(unit.characters8(), unit.length()));
+ else
+ m_unit = static_cast<unsigned>(lookupCSSPrimitiveValueUnit(unit.characters16(), unit.length()));
}
void CSSParserToken::convertToPercentage()

Powered by Google App Engine
This is Rietveld 408576698