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..75021f921cb1ba5a5c2c143833058d673d477320 |
--- /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" |
alancutter (OOO until 2018)
2016/11/29 06:51:50
CSSValue can just be forward declared.
aazzam
2016/11/30 23:32:53
done
|
+#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)(); |
alancutter (OOO until 2018)
2016/11/29 06:51:50
Why is this a getter and not just "CSSPropertyID i
aazzam
2016/11/30 23:32:53
done
|
+ |
+ bool m_isValidProperty; |
alancutter (OOO until 2018)
2016/11/29 06:51:50
"m_" is for private class data members. For simple
aazzam
2016/11/30 23:32:54
done
|
+ static const CSSPropertyDescriptor& get(CSSPropertyID); |
+ static void add(CSSPropertyDescriptor, CSSPropertyID); |
alancutter (OOO until 2018)
2016/11/29 06:51:50
Does this need to be exposed?
aazzam
2016/11/30 23:32:53
get() is used in CSSPropertyParser so it needs to
|
+}; |
+ |
+template <class T> |
+CSSPropertyDescriptor getDescriptor() { |
+ CSSPropertyDescriptor a; |
alancutter (OOO until 2018)
2016/11/29 06:51:50
Avoid using names like "a" for objects with specif
aazzam
2016/11/30 23:32:53
done
|
+ a.parseSingleValue = &T::parseSingleValue; |
+ a.getID = &T::getID; |
+ |
+ DCHECK(a.parseSingleValue != CSSPropertyAPI::parseSingleValue); |
+ DCHECK(a.getID != CSSPropertyAPI::getID); |
+ |
+ a.m_isValidProperty = true; |
+ return a; |
+} |
alancutter (OOO until 2018)
2016/11/29 06:51:50
Does this need to be in the header file?
aazzam
2016/11/30 23:32:53
as far as I know, templates do need to be in the h
|
+} |