OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/CSSPropertyNames.h" | |
6 #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
| |
7 #include "core/css/properties/CSSPropertyAPI.h" | |
8 | |
9 namespace blink { | |
10 | |
11 /* This struct should contain function pointers matching those declared | |
12 in CSSPropertyAPI. API functions should also be added to the getDescriptor | |
13 template below. */ | |
14 struct CSSPropertyDescriptor { | |
15 const CSSValue* (*parseSingleValue)(CSSParserTokenRange&, | |
16 const CSSParserContext&); | |
17 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
| |
18 | |
19 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
| |
20 static const CSSPropertyDescriptor& get(CSSPropertyID); | |
21 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
| |
22 }; | |
23 | |
24 template <class T> | |
25 CSSPropertyDescriptor getDescriptor() { | |
26 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
| |
27 a.parseSingleValue = &T::parseSingleValue; | |
28 a.getID = &T::getID; | |
29 | |
30 DCHECK(a.parseSingleValue != CSSPropertyAPI::parseSingleValue); | |
31 DCHECK(a.getID != CSSPropertyAPI::getID); | |
32 | |
33 a.m_isValidProperty = true; | |
34 return a; | |
35 } | |
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
| |
36 } | |
OLD | NEW |