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

Unified Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h

Issue 2533673002: Added CSSPropertyAPI and CSS padding properties which implement this API (Closed)
Patch Set: Added comments and made code neater Created 4 years, 1 month 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/properties/CSSPropertyDescriptor.h
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h b/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c9523751c566842368a0913d9b914dcab1c2158
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h
@@ -0,0 +1,36 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/CSSPropertyNames.h"
+#include "core/css/CSSValue.h"
+#include "core/css/properties/CSSPropertyAPI.h"
+
+namespace blink {
+
+/* This struct should contain function pointers matching those declared
+ in CSSPropertyAPI. API functions should also be added to the getDescriptor
+ template below. */
+struct CSSPropertyDescriptor {
+ const CSSValue* (*parseSingleValue)(CSSParserTokenRange&,
+ const CSSParserContext&);
+ CSSPropertyID (*getID)();
+
+ bool isValidProperty;
nainar 2016/11/29 02:17:21 should this maybe be m_isValidProperty?
+ static const CSSPropertyDescriptor& get(CSSPropertyID);
+ static void add(CSSPropertyDescriptor, CSSPropertyID);
+};
+
+template <class T>
+CSSPropertyDescriptor getDescriptor() {
+ CSSPropertyDescriptor a;
+ a.parseSingleValue = &T::parseSingleValue;
+ a.getID = &T::getID;
+
+ DCHECK(a.parseSingleValue != CSSPropertyAPI::parseSingleValue);
+ DCHECK(a.getID != CSSPropertyAPI::getID);
+
+ a.isValidProperty = true;
+ return a;
+}
+}

Powered by Google App Engine
This is Rietveld 408576698