blob: da7252fe948ff16198f4abd7ea0feed385ebd810 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
{% from 'templates/macros.tmpl' import license %}
{{license()}}
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAMES_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAMES_H_
#include <stddef.h>
#include "third_party/blink/public/mojom/use_counter/css_property_id.mojom-blink.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
namespace WTF {
class AtomicString;
class String;
}
namespace blink {
class ExecutionContext;
enum class CSSPropertyID {
kInvalid = 0,
kVariable = 1,
{{property_enums}}
};
const CSSPropertyID kCSSPropertyAliasList[] = {
{{property_aliases}}
};
const int kIntFirstCSSProperty = {{first_property_id}};
const CSSPropertyID firstCSSProperty = static_cast<CSSPropertyID>(kIntFirstCSSProperty);
const int numCSSProperties = {{properties_count}};
const int kIntLastCSSProperty = {{last_property_id}};
const CSSPropertyID lastCSSProperty = static_cast<CSSPropertyID>(kIntLastCSSProperty);
const CSSPropertyID lastUnresolvedCSSProperty = static_cast<CSSPropertyID>({{last_unresolved_property_id}});
const int numCSSPropertyIDs = static_cast<int>(lastUnresolvedCSSProperty) + 1;
const size_t maxCSSPropertyNameLength = {{max_name_length}};
inline int GetCSSPropertyIDIndex(CSSPropertyID id) {
DCHECK_GE(id, firstCSSProperty);
DCHECK_LE(id, lastCSSProperty);
return static_cast<int>(id) - kIntFirstCSSProperty;
}
inline bool isCSSPropertyIDWithName(CSSPropertyID id)
{
return id >= firstCSSProperty && id <= lastUnresolvedCSSProperty;
}
inline bool isValidCSSPropertyID(CSSPropertyID id)
{
return id != CSSPropertyID::kInvalid;
}
inline CSSPropertyID convertToCSSPropertyID(int value)
{
DCHECK_GE(value, static_cast<int>(CSSPropertyID::kInvalid));
DCHECK_LE(value, kIntLastCSSProperty);
return static_cast<CSSPropertyID>(value);
}
inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id)
{
return convertToCSSPropertyID(static_cast<int>(id) & ~{{alias_offset}});
}
inline bool isPropertyAlias(CSSPropertyID id) { return static_cast<int>(id) & {{alias_offset}}; }
CSSPropertyID CORE_EXPORT unresolvedCSSPropertyID(const ExecutionContext*, const WTF::String&);
CSSPropertyID CORE_EXPORT cssPropertyID(const ExecutionContext*, const WTF::String&);
class CSSPropertyIDList {
STACK_ALLOCATED();
public:
class Iterator {
STACK_ALLOCATED();
public:
Iterator(int id) : id_(id) {}
CSSPropertyID operator*() const { return convertToCSSPropertyID(id_); }
Iterator& operator++() { id_++; return *this; }
bool operator!=(const Iterator& i) const { return id_ != i.id_; }
private:
int id_;
};
Iterator begin() const { return Iterator(kIntFirstCSSProperty); }
Iterator end() const { return Iterator(kIntLastCSSProperty + 1); }
};
mojom::blink::CSSSampleId CORE_EXPORT GetCSSSampleId(CSSPropertyID id);
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAMES_H_
|