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

Side by Side Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp

Issue 2533673002: Added CSSPropertyAPI and CSS padding properties which implement this API (Closed)
Patch Set: format Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/css/properties/CSSPropertyDescriptor.h"
6
7 #include "core/css/properties/CSSPropertyAPIPadding.h"
8
9 namespace blink {
10
11 // Initialises a CSSPropertyDescriptor. When functions are added to
12 // CSSPropertyAPI, also add them to the struct initaliser below.
13 #define GET_DESCRIPTOR(X) \
14 { X::parseSingleValue, true }
15
16 // Initialises an invalid CSSPropertyDescriptor. When functions are added to
17 // CSSPropertyAPI, add a nullptr to represent their function pointers in the
18 // struct initaliser.
19 #define GET_INVALID_DESCRIPTOR() \
20 { nullptr, false }
21
22 static_assert(
23 std::is_pod<CSSPropertyDescriptor>::value,
24 "CSSPropertyDescriptor must be a POD to support using initializer lists.");
25
26 static CSSPropertyDescriptor cssPropertyDescriptors[] = {
27 GET_INVALID_DESCRIPTOR(), GET_DESCRIPTOR(CSSPropertyAPIWebkitPadding),
28 };
29
30 const CSSPropertyDescriptor& CSSPropertyDescriptor::get(CSSPropertyID id) {
31 // TODO(aazzam): We are currently using hard-coded indexes for
32 // cssPropertyDescriptor since we have only implemented a few properties.
33 // Later, generate this switch statement, or alternatively return
34 // cssPropertyDescriptors[id], and generate the cssPropertyDescriptors array
35 // to hold invalid descriptors for methods which haven't been implemented yet.
36 switch (id) {
37 case CSSPropertyWebkitPaddingEnd:
38 return cssPropertyDescriptors[1];
39 case CSSPropertyWebkitPaddingStart:
40 return cssPropertyDescriptors[1];
41 case CSSPropertyWebkitPaddingBefore:
42 return cssPropertyDescriptors[1];
43 case CSSPropertyWebkitPaddingAfter:
44 return cssPropertyDescriptors[1];
45 default:
46 return cssPropertyDescriptors[0];
47 }
48 }
49
50 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698