Chromium Code Reviews| 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; |
| +} |
| +} |