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

Unified 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: fix branch Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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
+}

Powered by Google App Engine
This is Rietveld 408576698