| 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..99a2b578421ad334d71bdb59fc7908b1e77bcef8
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyDescriptor.cpp
|
| @@ -0,0 +1,59 @@
|
| +// 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 {
|
| +
|
| +namespace {
|
| +
|
| +CSSPropertyDescriptor getInvalidDescriptor() {
|
| + CSSPropertyDescriptor a;
|
| + a.isValidProperty = false;
|
| + return a;
|
| +}
|
| +}
|
| +
|
| +static CSSPropertyDescriptor cssPropertyDescriptors[lastUnresolvedCSSProperty];
|
| +
|
| +static void registerDescriptors() {
|
| + // Static isCalled flag is used to sure that the descriptors are only created
|
| + // once
|
| + static bool isCalled = false;
|
| + if (isCalled)
|
| + return;
|
| + isCalled = true;
|
| +
|
| + // cssPropertyDescriptors will hold an invalid descriptor for all elements
|
| + // which haven't been implemented yet
|
| + for (int i = 0; i < lastUnresolvedCSSProperty; i++) {
|
| + cssPropertyDescriptors[i] = getInvalidDescriptor();
|
| + }
|
| +
|
| + // TODO(aazzam): Generate this function
|
| + CSSPropertyDescriptor::add(getDescriptor<CSSPropertyAPIWebkitPaddingEnd>(),
|
| + CSSPropertyWebkitPaddingEnd);
|
| + CSSPropertyDescriptor::add(getDescriptor<CSSPropertyAPIWebkitPaddingStart>(),
|
| + CSSPropertyWebkitPaddingStart);
|
| + CSSPropertyDescriptor::add(getDescriptor<CSSPropertyAPIWebkitPaddingBefore>(),
|
| + CSSPropertyWebkitPaddingBefore);
|
| + CSSPropertyDescriptor::add(getDescriptor<CSSPropertyAPIWebkitPaddingAfter>(),
|
| + CSSPropertyWebkitPaddingAfter);
|
| +}
|
| +
|
| +void CSSPropertyDescriptor::add(CSSPropertyDescriptor descriptor,
|
| + CSSPropertyID id) {
|
| + DCHECK_GE(id, 0);
|
| + DCHECK(id < lastUnresolvedCSSProperty);
|
| + cssPropertyDescriptors[id] = descriptor;
|
| +}
|
| +
|
| +const CSSPropertyDescriptor& CSSPropertyDescriptor::get(CSSPropertyID id) {
|
| + registerDescriptors();
|
| + return cssPropertyDescriptors[id];
|
| +}
|
| +}
|
|
|