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

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

Issue 1373433002: Split out CSSPrimitiveValue's PropertyID into CSSCustomIdentValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_string
Patch Set: Rebase Created 5 years, 3 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/CSSCustomIdentValue.h
diff --git a/third_party/WebKit/Source/core/css/CSSCustomIdentValue.h b/third_party/WebKit/Source/core/css/CSSCustomIdentValue.h
index 71f5dabf926ad664c1fa1cb8caa44b1d731a3378..6383341ce991788d4b53067c80b267db0c17d85e 100644
--- a/third_party/WebKit/Source/core/css/CSSCustomIdentValue.h
+++ b/third_party/WebKit/Source/core/css/CSSCustomIdentValue.h
@@ -5,6 +5,7 @@
#ifndef CSSCustomIdentValue_h
#define CSSCustomIdentValue_h
+#include "core/CSSPropertyNames.h"
#include "core/CoreExport.h"
#include "core/css/CSSValue.h"
#include "wtf/PassRefPtr.h"
@@ -19,21 +20,33 @@ public:
return adoptRefWillBeNoop(new CSSCustomIdentValue(str));
}
- String value() const { return m_string; }
+ // TODO(sashab, timloh): Remove this and move all parsing logic into the
+ // create(String) method.
alancutter (OOO until 2018) 2015/10/07 02:05:10 We won't want to convert to CSSPropertyIDs in ever
sashab 2015/10/07 02:21:02 Ahh yes, you're right. Thanks; done.
+ static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(CSSPropertyID id)
+ {
+ return adoptRefWillBeNoop(new CSSCustomIdentValue(id));
+ }
+
+ String value() const { ASSERT(!isKnownPropertyID()); return m_string; }
+ bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; }
+ CSSPropertyID valueAsPropertyID() const { ASSERT(isKnownPropertyID()); return m_propertyId; }
String customCSSText() const;
bool equals(const CSSCustomIdentValue& other) const
{
- return m_string == other.m_string;
+ return isKnownPropertyID() ? m_propertyId == other.m_propertyId : m_string == other.m_string;
}
DECLARE_TRACE_AFTER_DISPATCH();
private:
CSSCustomIdentValue(const String&);
+ CSSCustomIdentValue(CSSPropertyID);
+ // TODO(sashab): Change this to an AtomicString.
String m_string;
+ CSSPropertyID m_propertyId;
};
DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue());
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCalculationValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSCustomIdentValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698