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

Unified Diff: third_party/WebKit/Source/core/animation/PropertyHandle.h

Issue 2309873003: Extend PropertyHandle to include custom property identifiers (Closed)
Patch Set: Add unit tests Created 4 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/animation/PropertyHandle.h
diff --git a/third_party/WebKit/Source/core/animation/PropertyHandle.h b/third_party/WebKit/Source/core/animation/PropertyHandle.h
index 28b15166c7b4c4c82412b383232e6799ff36ed30..10dfde5faa0fccde761d11bbcbcdd28b7e650616 100644
--- a/third_party/WebKit/Source/core/animation/PropertyHandle.h
+++ b/third_party/WebKit/Source/core/animation/PropertyHandle.h
@@ -21,6 +21,13 @@ public:
, m_cssProperty(property)
{
DCHECK_NE(property, CSSPropertyInvalid);
+ DCHECK_NE(property, CSSPropertyVariable);
+ }
+
+ explicit PropertyHandle(const AtomicString& propertyName)
+ : m_handleType(HandleCSSCustomProperty)
+ , m_propertyName(propertyName.impl())
+ {
}
explicit PropertyHandle(const QualifiedName& attributeName)
@@ -34,8 +41,11 @@ public:
unsigned hash() const;
- bool isCSSProperty() const { return m_handleType == HandleCSSProperty; }
- CSSPropertyID cssProperty() const { DCHECK(isCSSProperty()); return m_cssProperty; }
+ bool isCSSProperty() const { return m_handleType == HandleCSSProperty || isCSSCustomProperty(); }
+ CSSPropertyID cssProperty() const { DCHECK(isCSSProperty()); return m_handleType == HandleCSSProperty ? m_cssProperty : CSSPropertyVariable; }
+
+ bool isCSSCustomProperty() const { return m_handleType == HandleCSSCustomProperty; }
+ AtomicString customPropertyName() const { DCHECK(isCSSCustomProperty()); return AtomicString(m_propertyName); }
bool isPresentationAttribute() const { return m_handleType == HandlePresentationAttribute; }
CSSPropertyID presentationAttribute() const { DCHECK(isPresentationAttribute()); return m_cssProperty; }
@@ -48,6 +58,7 @@ private:
HandleEmptyValueForHashTraits,
HandleDeletedValueForHashTraits,
HandleCSSProperty,
+ HandleCSSCustomProperty,
HandlePresentationAttribute,
HandleSVGAttribute,
};
@@ -68,6 +79,7 @@ private:
union {
CSSPropertyID m_cssProperty;
const QualifiedName* m_svgAttribute;
+ StringImpl* m_propertyName;
};
friend struct ::WTF::HashTraits<blink::PropertyHandle>;

Powered by Google App Engine
This is Rietveld 408576698