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

Unified Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValue.h

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
index 0ead913c1005fa47064f1fdffb4f206758f43dc8..8114f109d8c801d1bc92f3468ce75f1dda864502 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
@@ -32,6 +32,7 @@
#include "wtf/PassRefPtr.h"
#include "wtf/TypeTraits.h"
#include "wtf/text/StringHash.h"
+#include "wtf/text/StringView.h"
namespace blink {
@@ -244,6 +245,13 @@ public:
template<typename T> inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h
static const char* unitTypeToString(UnitType);
+ static UnitType stringToUnitType(StringView string)
+ {
+ if (string.is8Bit())
+ return stringToUnitType(string.characters8(), string.length());
+ return stringToUnitType(string.characters16(), string.length());
+ }
+
String customCSSText() const;
bool equals(const CSSPrimitiveValue&) const;
@@ -274,6 +282,10 @@ private:
static void create(unsigned); // compile-time guard
template<typename T> operator T*(); // compile-time guard
+ // Code generated by CSSPrimitiveValueUnitTrie.cpp.tmpl
+ static UnitType stringToUnitType(const LChar*, unsigned length);
+ static UnitType stringToUnitType(const UChar*, unsigned length);
+
void init(UnitType);
void init(const Length&);
void init(CSSCalcValue*);
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/css/CSSPrimitiveValueUnitTrie.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698