Index: third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp |
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4aca20feac5262c3da86722855d0ec35942771d0 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp |
@@ -0,0 +1,47 @@ |
+// 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/css/properties/CSSPropertyDescriptor.h" |
+ |
+#include "core/CSSPropertyNames.h" |
+#include "core/css/properties/CSSPaddingProperties.h" |
+ |
+namespace blink { |
+ |
+CSSPropertyDescriptor getInvalidDescriptor() { |
+ CSSPropertyDescriptor a; |
+ a.isValidProperty = false; |
+ return a; |
+} |
+ |
+static CSSPropertyDescriptor cssPropertyDescriptors[800]; |
aazzam
2016/11/28 23:29:00
CSSPropertyNames.h -- kNumberOfProperties, MAX_PRO
|
+ |
+static void registerDescriptors() { |
aazzam
2016/11/28 23:29:00
TODO(aazzam): generate this function
|
+ static bool isCalled = false; |
aazzam
2016/11/28 23:29:00
comments explaining this and the loop underneath
|
+ if (isCalled) |
+ return; |
+ isCalled = true; |
+ for (int i = 0; i < 800; i++) { |
+ cssPropertyDescriptors[i] = getInvalidDescriptor(); |
+ } |
+ add(getDescriptor<CSSPropertyAPIWebkitPaddingEnd>(), |
+ CSSPropertyWebkitPaddingEnd); |
+ add(getDescriptor<CSSPropertyAPIWebkitPaddingStart>(), |
+ CSSPropertyWebkitPaddingStart); |
+ add(getDescriptor<CSSPropertyAPIWebkitPaddingBefore>(), |
+ CSSPropertyWebkitPaddingBefore); |
+ add(getDescriptor<CSSPropertyAPIWebkitPaddingAfter>(), |
+ CSSPropertyWebkitPaddingAfter); |
+} |
+ |
+const CSSPropertyDescriptor& get(CSSPropertyID id) { |
+ registerDescriptors(); |
+ |
aazzam
2016/11/28 23:29:00
remove newline
|
+ return cssPropertyDescriptors[id]; |
+} |
+ |
+void add(CSSPropertyDescriptor descriptor, CSSPropertyID id) { |
+ cssPropertyDescriptors[id] = descriptor; |
aazzam
2016/11/28 23:29:00
DCHECK(id > 0)
DCHECK(id <= kNumberOfProperties)
|
+} |
aazzam
2016/11/28 23:29:00
add newline
|
+} |